Raw_input raises EOFError after creating exe with py2exe

After creating an exe from a script with py2exe raw_input() an EOFError occurs.

How can i avoid this?

  File "test.py", line 143, in main raw_input("\nPress ENTER to continue ") EOFError: EOF when reading a line 
+6
python py2exe eoferror
source share
1 answer
 >>> help(raw_input) Help on built-in function raw_input in module __builtin__: raw_input(...) raw_input([prompt]) -> string Read a string from standard input. The trailing newline is stripped. If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError. On Unix, GNU readline is used if enabled. The prompt string, if given, is printed without a trailing newline before reading. 

what's wrong? what do you type on the keyboard?

edit (comment added here):

I assume that you used py2exe with the argument "windows", which means that the console is not open - without the console there is no stdin to use raw_input. Instead, you can use the "console" argument in the setup.py file and your exe will open a console window allowing raw_input to work

+4
source share

All Articles