0

So, basically I have a python script which I would like to convert into a Mac Application (.app). The basic structure of the code is this:

while 1:
    command_handler(raw_input("> ",))

What I have here is actually a REPL, which takes input from the user and responds accordingly.

I have tried exporting it with py2app, Platypus, Xcode, Build Applet, AppleScript. Most of them throw an error:

EOFError: EOF when reading a line

Xcode doesn't let me export (I used this to set it up accordingly), it doesn't even create an archive.

Build Applet makes an .app, but when I open it, it closes immediately.

The rest of them throw the EOFError.

What should I do?

1 Answer 1

0

Take a look at this post which is about py2app and the like giving the EOFError while using raw_input. Hope this can lead you in the right direction, I would help test some things out but I am on Windows.

Sign up to request clarification or add additional context in comments.

3 Comments

I've just tried it with Automator. Same thing as AppleScript, same thing as always: EOFError.
The answer and the comments on that question mention you cannot do this with raw_input as you need a terminal open. The last comment on this answer Just package it with Python Distutils and a console script like most cross-platform Python packages do. Is this what you're wanting to do? If so, go with just a console script, else you're left with using a GUI library like Tkinter.
I found a better way. I wrote a script in AppleScript which opens a terminal window and runs the .py script from the resources of the app build. It was a little complicated, but it works fine. Thanks for all the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.