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?

Community
  • 1
  • 1
jimkokko5
  • 78
  • 1
  • 11

1 Answers1

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.

Community
  • 1
  • 1
bnlucas
  • 1,724
  • 1
  • 13
  • 18
  • I've just tried it with Automator. Same thing as AppleScript, same thing as always: `EOFError`. – jimkokko5 Jun 25 '13 at 22:23
  • [The answer](http://stackoverflow.com/a/4711673/2037884) 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`. – bnlucas Jun 26 '13 at 00:52
  • 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! – jimkokko5 Jun 26 '13 at 15:03