February 14th, 2003, 02:42 AM
Need help w/converting .py to .exe!
I downloaded and installed Python and py2exe tonight in hopes to make a desktop application in Python instead of having to learn C++ AND Win32. I got my first GUI-based Python script to work using the IDLE, but I can't covert my script to an exe file using py2exe.
Here's the script's source:
And here's my setup file:
from wxPython.wx import *
frame = wxFrame(NULL, -1, "Hello from wxPython")
app = MyApp(0)
But I get this error:
from distutils.core import setup
Traceback (most recent call last):
File "D:\python\setup.py", line 6, in ?
File "D:\python\lib\distutils\core.py", line 125, in setup
raise SystemExit, \
SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
Last edited by marron79; February 14th, 2003 at 02:53 AM.
February 14th, 2003, 06:11 PM
when you call the setup.py file make sure you call it like this:
You cannot just run the setup.py file by itself. Try the above method and let me know if that works.
python setup.py py2exe
February 14th, 2003, 11:24 PM
Yes, that is when I get the error I posted above. I tried loading it in the IDLE and the command line tool. Both produce errors.
February 20th, 2003, 04:16 AM
Ok, well im assuming your working on Windows
this is what you had before -
python setup.py py2exe
this might sound kinda silly but i got me a few times, try putting the full path to setup.py. if its on ur decktop it should be -
python C:\windows\desktop\setup.py py2exe
(if your useing windows 98 or 95, NT, 2000 and xp have there desktop in different places i believe)
February 20th, 2003, 03:14 PM
I'm using Windows XP Pro. I will try using the full path, but I'm pretty sure it won't matter since I get the same error no matter what I put as the script name. Will give it a try, thanks!
February 21st, 2003, 06:44 PM
I tried using the full path as seen in this screenshot. I also tried it using python d:\setup.py py2exe. Same error.
February 21st, 2003, 09:27 PM
Um, don't run it from within the python interpreter. Run it from the DOS prompt.
February 22nd, 2003, 12:14 AM
Duh! Why didn't I think of that?
Now it says "python isn't recognized as a command," which is weird because I know Python is installed (it's in the Program Files folder and shows up in the add/remove programs list).
February 23rd, 2003, 02:04 PM
So provide the full path to your python exe.
February 23rd, 2003, 04:07 PM
Great! It works!! Any chance of getting ride of the ugly DOS Prompt windows in the back when the app loads? Thanks!
February 24th, 2003, 08:49 AM
The .pyw (PythonWindow/less?) excentionis great for GUI apps, it simply runs the program without Python/DOS window. i dont know how this works in Py2exe but its worth a try.
February 24th, 2003, 03:59 PM
How do I make those? Does the person opening a .pyw file need Python to run the app?
February 25th, 2003, 07:02 PM
Thanks to a tip from an anonymous DevShed guest, I now know how to make Python scripts into .exe w/out the DOS window in the background! It's so simple, I can't believe I didn't try it before.
python setup.py py2exe -w
Yep, that's all you have to do...add a "w" argument on the end!