OS: Win 7 32 bit
Python version: 2.7.3
Py2exe version: py2exe-0.6.9.win32-py2.7
This bug is very simple to reproduce:
import code
if __name__ == '__main__':
code.interact()
from distutils.core import setup
import py2exe
setup(
console=[{
'script': 'main.py'
}],
options={
'py2exe': {
'unbuffered': True
}
}
)
1
2
1. Compile with `python setup.py py2exe`.
2. Start dist/main.exe.
3. Copy the contents of test.txt to the clipboard.
4. Paste into the main.exe console. You should see:
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> 1
1
>>> 2
5. Press Enter.
Pressing Enter should result in 2 being evaluated by the interactive console, so 2 should be displayed:
...
>>> 2
2
>>>
The console "hangs" and does not process the input 2. Pressing Enter again results in the following output:
>>> 2
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'm' is not defined
>>>
It seems like the Python interactive console that was invoked by code.interact() does not receive the input "2" but "m\x00".
Everything works fine when py2exe option 'unbuffered' is set to True.
main.py, setup.py and test.txt