Carrying over from the previous thread about py2exe, etc. I've messed
around with Pypack some more, and now recall what turned me off initially.
1) The script to use is called pypackage.py, but the docs and comments
refer to it as pypack. Easy enough to fix, but makes it immediately
clear this is alpha code. Hence my reticence to dig far.
2) The .exe it generates doesn't work, yielding this error:
Traceback (most recent call last):
File "runapp.py", line 33, in ?
File "Myth/Client/legacy.py", line 6, in ?
from twisted.internet import reactor
ImportError: cannot import name reactor
Sure enough, when I look under the "extlib" dir tree, reactor.pyc is
missing. So Pypack apparently missed a static import from my starting
script -- the 3rd thing I import. My confidence is not high after
seeing this, but I gamely copy over reactor.pyc by hand, and ...
Traceback (most recent call last):
File "runapp.py", line 33, in ?
File "Myth/Client/legacy.py", line 8, in ?
from Realms.Myth.map import MythMap, Plains
ImportError: No module named Realms.Myth.map
This is the first import of my code. Turns out Realms.Myth.map is
stored under Realms/app/Myth. This leaves me guessing that I actually
need to run pypackage from the directory /containing/ my root dir -- in
contrast with what the docs say.
Ok... so I try this, and momentarily my reservations vanish, as I see my
opening Menu! Until I try to play a game, and see some odd error from PIL:
...
File "C:\Python24\Lib\site-packages\PIL\Image.py", line 1289, in save
exceptions.KeyError: '.png'
Looking at the PIL source it looks like it's expecting some sort of
extension to handle .png's, which is apparently missing? Hmmm, I seem
to recall a PIL entry for py2exe, so I check that. I hack my code to
force import of PngImagePlugin and trick PIL into thinking everything is
ok, and PIL now works.
But now I find that twisted.python.threadpool.pyc is missing, because
twisted.internet.base imports it dynamically. I would guess this is to
avoid Python's refusal to handle circular imports, which is something
I'm also forced to do... I copy threadpool.pyc, and then realize that
everything threadpool imports I'll also have to manually deal with, or
change my code to force import...
Clearly I need someway to manually include certain things, but the
Pypack docs give no indication of how to do this... Is there a way to
force Pypack to import missing things? I don't know, and so I'm back to
futzing with py2exe, for which my .exe is presently looking for
datafiles in a different place than py2exe put them. :-(
-Jasper