I installed it, and I'm trying to follow the tutorial but it won't work right.
I made the test file, but when I type "python test.py" in command prompt it doesn't work.
What am I doing wrong?

Recommended Answers

All 5 Replies

Who knows?

Care to share what unexpected behavior you are observing?

Well, I'm not exactly sure of where to put the test.py file. If I put it on the desktop and then just run command prompt, it says python is not recognized. This makes sense since python is not saved on the desktop :p
So I tried moving my test.py file to the python directory, and then changing the command prompt directory to that. When I do this I get:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\James>cd C:\python26

C:\Python26>python test.py
C:\Python26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning: the se
ts module is deprecated
import sets
usage: test.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: test.py --help [cmd1 cmd2 ...]
or: test.py --help-commands
or: test.py cmd --help

error: no commands supplied

And I'm not really sure what to do with that.

Py2exe scripts are usually run like this:

python [script] py2exe

so yours would become:

python test.py py2exe

A tip on running scripts from the command line:

Add C:\Python26 to your PATH environment variable (see http://www.computerhope.com/issues/ch000549.htm).

Now the python command is available from any directory (you have to re-open command prompt first), so instead of littering your python directory with your scripts, you can just navigate to the directory that your script is in and in command prompt do python script.py .

Better yet (I know this works on Vista and 7; not sure about XP), if python is registered to handle .py files (the installer sets this), you can just navigate to the script directory and do script.py and windows would load it into python for you.

Okay, now I have it so that "python test.py" runs it as expected.
However, "python test.py py2exe" runs it exactly the same without converting anything.

Nevermind, I seem to have got it. If I try to import py2exe it says no such module exists. But if setup.py and test.py are in the same directory and i do python setup.py py2exe, it works.
Thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.