I have a folder with my game on Desktop. I've installed py2exe, 'cause it seemed to be a very good game and I wanted to share it.
Now, I did everything right (i followed youtube tutorial), but when I start command prompt and typed 'a.py py2exe' it returned a message saying something like 'py2exe module not found'. What should I do? I've put this into a.py:

from distutils.core import setup
import py2exe

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

and I've put a.py in folder where my game.py and game data are.
What to do?

Recommended Answers

All 10 Replies

Did you install py2exe correctly?
Also, you might want to change "console" to "window". That will make it so no console window opens up, just the game.
Also, I think I remember reading somewhere that pygame isn't compatible with py2exe, might want to google that.

EDIT:
Found this:
http://www.moviepartners.com/blog/2009/03/20/making-py2exe-play-nice-with-pygame/

I suppose you have python installed on your c:/ drive. So, first go to the folder where python is, for example mine is c:/python26/, so copy the game.py and the a.py to your python directory, now open up a windows command prompt and move to the folder where your python.exe is, to change directory you use cd, to go back a directory you use "cd ..", or you can go directly to the folder where the python.exe is by "cd C:\Python26", now type "python a.py py2exe", now a new folder will be created, probably called dist or something like that, and you can see your exe there, hope this works, Dan08.

Fotget my last post... To make an executable with py2exe, you need to have Game.py and a.py on your Python directory (default = 'C:\PythonVV\'). Now, go into the command prompt and change directory to your python location. You can change location by using the command 'cd' followed by the location, so if you have installed python in your C:\, you should first run something like 'cd C:\PythonVV\', where the 'VV' is, you must cahnge it with your python version, so in my case it would become 'cd C:\Python26\'. Finally, if you are completly sure that you're working on python dir, you can now run the command to make your python game become an executable, now write the following code:

python a.py py2exe

After you run this code, a new folder will be created in you python dir, if you want to redistribute your executable you must give all the files in that dir. Now, I know you didn't ask for an installer, but well, the one that I personally preffer is Inno Setup, you can download it here. Dan08

Have you tried Andrea's Gui2exe? That should enable you to configure setup.py GUIcally
try that and say what you think!

Now, I know you didn't ask for an installer, but well, the one that I personally preffer is Inno Setup, you can download it here. Dan08

Have you ever made it work with wxPython without crashes?

Hey evstevemd, first of all, I don't use wxPython, so I can't tell if there is same problem, for example I made a GUI program using Tkinter, when I use INNO Setup, it creates the the installer somewhere, lets suppose that I let the user choose whether or not to create shortcuts on the desktop. If the user chooses to create a desktop shortcut, it basically won't work with me. I don't know why, I've tried it a couple of times but it just doesn't work. Well, I think it can be because I used the wizard, maybe the wizard got a bug or something... but anyway, at the moment I don't have time to learn how to use all those codes in the IDE of Inno. PM me if you got something similar, because sravan953, is doing a the next version of pymailer in wxPython I guess, and would be nice of you, telling us your experiences with Inno.

I have a folder with my game on Desktop. I've installed py2exe, 'cause it seemed to be a very good game and I wanted to share it.
Now, I did everything right (i followed youtube tutorial), but when I start command prompt and typed 'a.py py2exe' it returned a message saying something like 'py2exe module not found'. What should I do? I've put this into a.py:

from distutils.core import setup
import py2exe

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

and I've put a.py in folder where my game.py and game data are.
What to do?

Did my answer help you? Please mark this thread as solved if it did. Dan08

I saw your project with Sravan and was interested to see if Inno Worked. I Actually made installer with wxPython+Py2exe+Inno but as for you, shortcuts didn't worked!
I think there is issues with Inno+Python. It worked by creating shortcut manually. So I guess it will be good to code a PyInstallerMachine, a program to create Python installation that doesn't need to mess up with registry. what do you think?

I saw your project with Sravan and was interested to see if Inno Worked. I Actually made installer with wxPython+Py2exe+Inno but as for you, shortcuts didn't worked!
I think there is issues with Inno+Python. It worked by creating shortcut manually. So I guess it will be good to code a PyInstallerMachine, a program to create Python installation that doesn't need to mess up with registry. what do you think?

That actually sounds good, couple months ago I thought about that but I wanted someone to help doing it, if you interested. Dan08

That shouldn't be that hard. Since it doesn't need to mess up with registry then It will be easy I will add it to my to-do-list and see if I can start coding next week. I'll post back once I start coding

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.