-

I have recently tried to make some progress on this, but have only narrowed the problem…

I have installed py2exe into a registered version of python and copied the files over to the site-packages directory in panda3d’s python (although IPKnightly’s method above would have worked just as well). I then created a setup.py the same as IPKnightly with all of the direct packages listed, and tried testing it on a simple one-file panda application. I built the file using ppython and these were the warnings:

The first run of the executable, I got this error:

I remembered that PandaModules looks for the .pyz file in the same directory its located, so I copied PandaModules.pyz into the same directory that the executable was. I figured this was ok since PandaModules.pyz is just a bunch of zipped up python files for faster loading (maybe I am wrong about that).

After a couple more runs I had errors about missing .dll files. These were:

and:

I copied those .dll files to the same directory as the executable as well. I really just wanted to see how far I could get. The last error I got was:

I am assuming this was because I was copying dlls into places they should not have been.

When I moved the enitre directory containing the executable outside of the folder I built it in, I finally got IPKnightly’s error of

I figured out that this has nothing to do with pandac, but rather the fact that the direct/init.py file was not trivial. Here is the code from that file:

import os,sys
srcdir1 = os.path.join(__path__[0], 'src')
srcdir2 = os.path.join(__path__[0], '..', '..', 'direct', 'src')
if    (os.path.isdir(srcdir1)): __path__[0] = srcdir1
elif  (os.path.isdir(srcdir2)): __path__[0] = srcdir2
else: sys.exit("Cannot find the 'direct' tree")

Basically it looks for a path either with ‘src’ appended to the path name, or two levels up from the current directory and then ‘direct/src’.

Before I had moved my executable file, it was two directories deep from the direct folder in panda, which inadvertently resolved that issue, but reappeared when I moved the location away from that particular directory structure.

So the real question is what is the best way to fix the non-trivial init problem? When byte-compiled, the init.py file needs to be able to look for the direct packages without trying to mangle the path. At leat thats my best guess. The quick solution would be to include the direct package two directories above the distribution executable, but that is really just a hack and I would like to find the ‘correct’ solution.

Any help would be greatly appreciated.