Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem using Py2exe

Loismustdie129's Avatar
Familiar Sight
 
Join Date: Aug 2006
Posts: 195
#1: Dec 17 '06
I need help with a py2exe example I am working on to get the basics. The example is:

Expand|Select|Wrap|Line Numbers
  1. # setup.py
  2. from distutils.core import setup
  3. import py2exe
  4. setup(name="wxTail",scripts=["wxTail.py"],)
I type this in and then I get the error message:

Expand|Select|Wrap|Line Numbers
  1. Traceback (most recent call last):
  2.   File "<pyshell#2>", line 1, in -toplevel-
  3.     setup(name="wxTail",scripts=["wxTail.py"],)
  4.   File "C:\Python24\lib\distutils\core.py", line 137, in setup
  5.     raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
  6. SystemExit: usage:  [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
  7.    or:  --help [cmd1 cmd2 ...]
  8.    or:  --help-commands
  9.    or:  cmd --help
  10.  
  11. error: no commands supplied
What I want to know is what does this mean and what is the Setup() command do.

Thanks for any help.

bartonc's Avatar
Moderator
 
Join Date: Sep 2006
Location: Minden, Nevada, USA
Posts: 6,403
#2: Dec 18 '06

re: Problem using Py2exe


Here is a link to true911m's Simple guide to using py2exe.
Loismustdie129's Avatar
Familiar Sight
 
Join Date: Aug 2006
Posts: 195
#3: Dec 20 '06

re: Problem using Py2exe


Quote:

Originally Posted by true911m

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/env python
  2. from distutils.core import setup
  3. import py2exe
  4.  
  5. setup(
  6.     console=["HelloWorld.py"],
  7.     zipfile=None
  8.      )

I tried this code out and I got an error message reading:

Quote:
Traceback (most recent call last):
File "<pyshell#6>", line 3, in -toplevel-
zipfile= None
File "C:\Python24\lib\distutils\core.py", line 137, in setup
raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
SystemExit: usage: [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: --help [cmd1 cmd2 ...]
or: --help-commands
or: cmd --help

error: no commands supplied
any thoughts on it?
bartonc's Avatar
Moderator
 
Join Date: Sep 2006
Location: Minden, Nevada, USA
Posts: 6,403
#4: Dec 20 '06

re: Problem using Py2exe


Quote:

Originally Posted by Loismustdie129

I tried this code out and I got an error message.
any thoughts on it?

It needs to be called from the commend line like this:
Expand|Select|Wrap|Line Numbers
  1. python setup.py py2exe --bundle 1
.
How did you invoke you script?
Loismustdie129's Avatar
Familiar Sight
 
Join Date: Aug 2006
Posts: 195
#5: Dec 20 '06

re: Problem using Py2exe


I took that code and put it into my editor, IDLE, and when I hit enter to get out of the "setup" function it returned that error, I never saved anything cause of the error.
bartonc's Avatar
Moderator
 
Join Date: Sep 2006
Location: Minden, Nevada, USA
Posts: 6,403
#6: Dec 20 '06

re: Problem using Py2exe


Quote:

Originally Posted by Loismustdie129

I took that code and put it into my editor, IDLE, and when I hit enter to get out of the "setup" function it returned that error, I never saved anything cause of the error.

There's your problem. IDLE was never quite finished. The Run Module in the Run menu doesn't pass any command line arguments that way that other IDEs do. Follow all the steps in true911m's tutorial. His way uses a batch file to execute setup.py with arguments. This can also be done from a DOS command prompt, but changing directories in there becomes tedious (at best).
true911m's Avatar
Member
 
Join Date: Dec 2006
Location: Baltimore, MD
Posts: 97
#7: Dec 21 '06

re: Problem using Py2exe


I created another walkthrough for PyInstaller if anyone would rather try that.
bartonc's Avatar
Moderator
 
Join Date: Sep 2006
Location: Minden, Nevada, USA
Posts: 6,403
#8: Dec 21 '06

re: Problem using Py2exe


Quote:

Originally Posted by true911m

I created another walkthrough for PyInstaller if anyone would rather try that.

You make this forum a smarter place. Thanks for your contributions!
Reply