Converting .py to .exe in python 2.5: doesnt execute .exe program directly
I have successfully converted my .py script to .exe but the problem is that it wont get executed when I press the .exe icon. A black screen pops up for a fraction of a 开发者_如何学Pythonsecond and then disappears.
I tried executing it through the command prompt and it did get executed but doesn't run if I click the .exe directly. Just want to know if there is some error in placing the .exe file due to which I am encountering this problem.
# setup.py
from distutils.core import setup
import py2exe
setup(console=["myscript.py"])
python setup.py py2exe --help
python setup.py py2exe
Your shell disappears because the program finishes.
End your program with a raw_input('enter to finish')
line and the console will stay allowing you to see the result.
How do you know it got executed when you ran it from command prompt? If the app just outputs something and exits, you will see the behavior you are describing: the black window will flash and disappear. That the same as running any other win32 console app from windows explorer.
精彩评论