For anybody else using Pygame + PyInstaller

The development version of PyInstaller works mostly out of the box with Pygame 1.9.2 over here on Windows 7, albeit for three problems:

Using pygame.font.SysFont will crash the distributed executable.
My workaround was to simply bundle a font with an open license with my game.

Game resources are not automatically bundled.
To get around this, you have to manually edit the .spec file generated by PyInstaller.
  1. First, use utils\Makespec.py to generate the .spec file.
  2. If you're making a --onefile distribution, put the following line in the EXE entry. Otherwise, put it in the COLLECT entry.
    1. Tree('\\path\\to\\project\\res', prefix="res\\")
  3. Build your executable using utils\Build.py

Last, using the --noconsole option on the command line for utils\Makespec.py has the unexpected side effect of putting your created .exe inside a .app folder, as if you were building for Macintosh.
Instead of using the command line option, use the console=False keyword argument to EXE inside the spec file.


Hope that saves some headaches for fellow contestants!

(log in to comment)

Comments

You might want to add these notes to the PyInstaller 3rd party packages wiki page:
http://www.pyinstaller.org/wiki/SupportedPackages
That is an excellent idea. I've posted my guide on the PyInstaller mailing list, hopefully somebody there will be able to do so.