We're working on a Cocos2D game for Ludum Dare right now, and we are having issues packaging the game into an executable of some kind.
We have tried using py2exe, but it doesn't seem to work. I've read that py2exe often causes problems with this kind of libraries, but that they are usually workable. However, I've been doing some research for the last few hours and I can't seem to find a solution.
Here's the error message it gives us when executing the .exe, apparently it can't import the pyglet.resource module.
C:\Users\Jon\Documents\GitHubVisualStudio\King-of-the-Dungeon\King of the Dungeon\King of the Dungeon\dist>king_of_the_dungeon.exe
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pyglet\__init__.py", line 351, in __getattr__
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'path'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "king_of_the_dungeon.py", line 1, in <module>
File "C:\Python34\lib\site-packages\cocos2d-0.6.3-py3.4.egg\cocos\__init__.py", line 71, in <module>
pyglet.resource.path.append(
File "C:\Python34\lib\site-packages\pyglet\__init__.py", line 357, in __getattr__
__import__(import_name)
ImportError: No module named 'pyglet.resource'
I just tried it myself and It works without problem. But I used cx_freeze. See, Py2exe is old, no longer maintained, and overall you're better off using cx_freeze.
create a setup.py file to create an exe:
open cmd / terminal and build with ; python setup.py build
I just tried it with a simple game and it compiled with no trouble.