|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
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: Code:
from wxPython.wx import * class MyApp(wxApp): def OnInit(self): frame = wxFrame(NULL, -1, "Hello from wxPython") frame.Show(true) self.SetTopWindow(frame) return true app = MyApp(0) app.MainLoop() And here's my setup file: Code:
# setup.py
from distutils.core import setup
import py2exe
setup(name="win",
scripts=["win.py"],
)
But I get this error: Code:
Traceback (most recent call last):
File "D:\python\setup.py", line 6, in ?
scripts=["win.py"],
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
Help!! Please!!
__________________
Matt Last edited by marron79 : February 14th, 2003 at 01:53 AM. |
|
#2
|
||||
|
||||
|
when you call the setup.py file make sure you call it like this:
Code:
python setup.py py2exe You cannot just run the setup.py file by itself. Try the above method and let me know if that works. |
|
#3
|
||||
|
||||
|
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.
|
|
#4
|
|||
|
|||
|
directory
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) Tytan |
|
#5
|
||||
|
||||
|
Re: directory
Quote:
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! |
|
#6
|
||||
|
||||
|
I tried using the full path as seen in this screenshot. I also tried it using python d:\setup.py py2exe. Same error.
![]() |
|
#7
|
|||
|
|||
|
Quote:
Um, don't run it from within the python interpreter. Run it from the DOS prompt. |
|
#8
|
||||
|
||||
|
Quote:
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). |
|
#9
|
|||
|
|||
|
Quote:
So provide the full path to your python exe. |
|
#10
|
||||
|
||||
|
Quote:
Great! It works!! Any chance of getting ride of the ugly DOS Prompt windows in the back when the app loads? Thanks! |
|
#11
|
|||
|
|||
|
pyw
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.
Tytan |
|
#12
|
||||
|
||||
|
Re: pyw
Quote:
How do I make those? Does the person opening a .pyw file need Python to run the app? |
|
#13
|
||||
|
||||
|
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! ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Need help w/py2exe please! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|