I generated a p3d from my small game with packp3d (after solving the missing packp3d.p3d in 1.7.0). When starting the generated p3d with Panda a console window appears with:
Then nothing happens, the download image appears (after it downloaded everything) and the p3dpythonw.exe generates massive CPU load. I let the program run for 20 Minutes and nothing happened.
The p3d can be downloaded from here. The last lines in p3dcore.log are:
Try running the p3d file from the command line, with the command “panda3d -f myfile.p3d”. This will (a) show you the Python log output, which may give you a clue where it’s getting hung up, and (b) the -f parameter works around a minor bug in the 1.7.0 release of panda3d.exe.
I just tried that command on Windows XP with Panda 1.7.0 and Ubuntu 10.04 with the latest version from the build bot. In both cases, there are no messages in the console window, nothing happens and both processes generate loads of CPU load
Edit: With a generated standalone executable happens the same
The bottom line is, your program should run if you execute “python -c ‘import main’”. If it doesn’t, then it won’t run when you pack it into a p3d file either.
In your case, you have two choices: either import DirectStart, or derive from ShowBase and then remember to create an instance of your class in main.py. You should only have exactly one instance of ShowBase, never two; and importing DirectStart will create an instance of ShowBase, so you shouldn’t both import DirectStart and also derive from ShowBase in the same program.
Since you are deriving from ShowBase, it means you shouldn’t import DirectStart, but it does mean you need to have this line in your main.py:
Yes, that seems to be a common mistake. People assume that importing main.py in the p3d file is the same as running it on the command line, which would set the name to “main” instead of “main”.
We’ve talked about making this change in practice, to make it more consistent with people’s expectations. If we did so, then it would be correct to check for name == “main”. The only problem with this is, it’s still not the same as running it on the command line; in particular, there’s an issue with the GIL and threads that behaves differently from a command-line file and from an explicitly-imported file. But for most naive uses, it will be the same.