0

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 second 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
1
  • Now when i put this .exe program on my desktop instead of the folder where my .py script is, it gives the same error of opening a black screen for a second and then closing it :( despite using raw_input. Is there some error in placement of .exe file on desktop...what is the mistake now? Commented Oct 13, 2011 at 7:30

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

3 Comments

using command prompt displays the "result" of the script...for eg: if my script "myscript.py" is counting 10 numbers....then i'll get the o/p displayed on prompt window i.e. 10
Well, then you need to wait for user input before the program exits. Or create a gui application using TkIntel or WxPython.
i need to take user input actually. bcoz makin a GUI isnt what i want. my script is not a GUI script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.