Raw_input يسبب eoferror بعد إنشاء exe مع py2exe
سؤال
بعد إنشاء exe من البرنامج النصي مع py2exe
raw_input()
يسبب eoferror.
كيف يمكنني تجنب ذلك؟
File "test.py", line 143, in main
raw_input("\nPress ENTER to continue ")
EOFError: EOF when reading a line
المحلول
>>> 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.
ماالخطب؟ ماذا تكتب على لوحة المفاتيح؟
تحرير (تم الإبلاغ عن تعليق هنا):
أظن أنك استخدمت Py2exe مع وسيطة "Windows" ، وهذا يعني أنه لا يتم فتح وحدة تحكم - بدون وحدة تحكم لا يوجد stdin لاستخدام RAW_INPUT. يمكنك بدلاً من ذلك استخدام وسيطة "وحدة التحكم" في الإعداد الخاص بك
لا تنتمي إلى StackOverflow