Hi. I have managed to package my game into a shared library (.pyd), but I wanted to go one step further and make it less easy to attack/decompile. I tried to change the extension of .pyd to .exe in my builder (that just uses pfreeze). I have the command it executes here:
The executable is generated with no errors. When I run it, it gives this traceback:
Traceback (most recent call last):
File "__main__", line 23, in <module>
ImportError: No module named core
The main module, ClientStartDist, errors on line 23. The line is:
from panda3d.core import loadPrcFileData
The error is obvious. It is not including panda3d.core. But, the command CLEARLY states to include ALL the modules under the panda3d folder.
When I try freezing with the unsupported 1.8.1, it decides to work until a module named libpandadna tries to import panda3d.core, giving the very confusing and misleading error “DLL Load failed”.
Any and all help is appreciated, and if you need more information, I am happy to supply it. Thank you
This is a shortcoming in Python; it cannot load extension modules inside frozen packages. You should use -x panda3d to leave out the panda3d package entirely, or use dark magic to set the path appropriately, such as this:
However, there’s an alternative approach I just pushed to pfreeze.py and FreezeTool.py. If you pass the -l option to pfreeze, it will link in the extension modules directly, causing them to be treated as built-in modules to the Python interpreter. This is experimental, but it seems to work on both Linux and Windows, and panda3d.core et al are handled seamlessly.
Thank you for the help. However, this didn’t appear to work, and still returned no module named core. The linking works, but I needed a custom panda that has support for Astron. So, I built it and installed it. I tried using pfreeze and freezetool from 1.10 with the Astron panda3d, and that kept returning errors. So, I reinstalled it and tried your suggestion, and it didn’t work.