Single EXE game: Py2exe and Rar/SFX
Hi friends,I'm new to Python game programming, so maybe this is too basic, but for me it is very interesting.
Tonight I was playing with py2exe as I want to distribute my games to people who doesn't neccesarily have Python installed in their computers.
After reading a couple of tutorials I could create an exe file.
Then using WinRAR I created a SFX file that uncompresses the file (plus libraries and media) in the temp directory and runs the exe automatically (so the user doesn't know is a SFX).
So now I can distribute my Python games as a single EXE's. Great!!!
You can test it here. (It doesn't do too much... just move the sprite using arrowkeys).
Best regards
JF
(log in to comment)
Comments
Hi tartley,
Thank for sharing your tutorial it's great... and you are right I didn't include the runtime :(
So my options are:
1.- Ask user to download and install the vcredist_x86.exe from microsoft.com
2.- Install MS VC++ 2008 Express Edition in my PC and check if I have the right to include the Microsoft.VC90.CRT folder.
3.- If I don't have the right I'm thinking in adding the vcredist_x86.exe file to the SFX, code a script to check if it is already installed (I don't know how to do it yet :) ) and if it is not installed run the vcredist_x86.exe before my py2exe generated exe.
Of course, I could buy MS Visual Studio...
Best regards
JF
Thank for sharing your tutorial it's great... and you are right I didn't include the runtime :(
So my options are:
1.- Ask user to download and install the vcredist_x86.exe from microsoft.com
2.- Install MS VC++ 2008 Express Edition in my PC and check if I have the right to include the Microsoft.VC90.CRT folder.
3.- If I don't have the right I'm thinking in adding the vcredist_x86.exe file to the SFX, code a script to check if it is already installed (I don't know how to do it yet :) ) and if it is not installed run the vcredist_x86.exe before my py2exe generated exe.
Of course, I could buy MS Visual Studio...
Best regards
JF
Sorry for the double post...
Good news. I just installed MS Visual C++ 2008 Express Edition in my PC, and I have a redist.txt file that says:
"For your convenience, we have provided the following folders for use when redistributing VC++ runtime files. Subject to the license terms for the software, you may redistribute the folder (unmodified) in the application local folder as a sub-folder with no change to the folder name. You may also redistribute all the files (*.dll and *.manifest) within a folder, listed below the folder for your convenience, as an entire set. " ....
"\VC\redist\x86\Microsoft.VC90.CRT\
msvcm90.dll
msvcp90.dll
msvcr90.dll
Microsoft.VC90.CRT.manifest"
And I have the folder \VC\redist\x86\Microsoft.VC90.CRT\ :)
So from now and on I will include this files (tutorial part 5.2.1) with my single exe games ;)
Thank you again.
JF
tartley on 2010/04/02 09:04:
That's completely brilliant. Thanks for sharing the insight.Incidentally, last time I messed with py2exe and similar programs, the thing that caught me out was I forgot to bundle up the Microsoft C runtime dll with my program. Python was compiled with this, and so the Python DLL in the output of py2exe needs it to run. As a developer, you probably already have this DLL installed on your machine, so you are fine. Other users probably don't have it, however. So for your py2exe programs to work on their machines, you will need to include this DLL. After I figured this out, I added details of how to do it to the py2exe tutorial page:
http://www.py2exe.org/index.cgi/Tutorial#Step5