Hey All

I'm having trouble making executables with py2exe.
I'm using Python 2.6 and I'm trying to make the simple 'Hello World!' program work as an executable. My setup script is as follows:

from distutils.core import setup
import py2exe

setup(console=['hello.py'])

When I run the setup script in the command prompt 'C:\Python26\setup.py py2exe', I get the error message: 'error: hello.py: No such file or directory'

I've tried importing hello.py using IDLE and it works perfectly.

Does anyone know why it can't seem to find it when I use the command prompt?

I also get a 'DeprecationWarning' but I don't think this is important.

My hello.py script and setup.py script are both in the same directory.

Any help would be appreciated

You should be running py2exe as such: python setup.py py2exe you'll want to make sure you're inside the directory where both files are located.

Also your console item should be: console = [{"script": 'Hello.py'}] )

If you're new to python, its easiest to get yourself a script someone else has already written. I know vegaseat has a few i use from time to time. But also i find things that automate most of the process for you is quite nice.

For that i would recommend using Gui2exe http://code.google.com/p/gui2exe/ Its nice and easy to use.

Hope that helps

Thanks for all the help but I still havn't got this working.

I've changed my script so it is now:

setup(console = [{"script": 'test.py'}] )

When you say I should be running py2exe as such:

python setup.py py2exe

Does this mean that this is all I input into the command prompt?Because if I do it doesn't recognize it.
Do I need to add python to the command prompt's variables or somthing? If so, how would I go about doing this?]

Also, can't this step be done using the python command line that came with the interpreter?

I've downloaded Gui2exe and have tried using it. After hitting the compile button, I get a number of compiler messages(among them is a warning that the sets module is deprecated). The compiler messages stop on "copying files". Is it stuck? A window is created in the dist folder but upon trying to run it I get a message block telling my that it cannot locate MSVCR90.dll.
Do I need to reinstall py2exe or Gui2exe or the interpreter to fix this .dll problem?
Do you perhaps know a basic tutorial on using Gui2exe?

I'm new to this so please bear with me

Try using pyinstaller, there are some tutorials for that, I find it very simple to use.

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.