P3D compiling for Windows

Hello.

I am trying to compile My Panda3D program using P3D utility.

I have to use my Panda3D-1.9.0 version since it is a fork and includes Astron Networking.

I have tried other version of Panda and get the same results.

I am trying the following:

C:\Panda3D-1.9.0\direct\p3d>packp3d -o toontownworld.p3d -d c:/toontownworld -m start_game_localhost.bat

The .BAT file loads the login and Python Path and then opens another PY file. This file is where the launcher starts.

Here is the error:

:AppRunner: Total Panda3D disk space used: 281 MB
:AppRunner: Configured max usage is: 2048 MB
DCFile::read of /c/toontownworld/RetroResources/phase_3/etc/otp.dc
DCFile::read of /c/toontownworld/RetroResources/phase_3/etc/toon.dc
couldn't import toontown.pets.PetDCImports
couldn't import toontown.pets
couldn't import toontown
couldn't import toontown.coghq.InGameEditorDCImports
couldn't import toontown.coghq
couldn't import toontown
DCFile::read of /c/toontownworld/ToontownInfiniteRetro/astron/otp.dc
DCFile::read of /c/toontownworld/ToontownInfiniteRetro/astron/toon.dc
couldn't import toontown.pets.PetDCImports
couldn't import toontown.pets
couldn't import toontown
couldn't import toontown.coghq.InGameEditorDCImports
couldn't import toontown.coghq
couldn't import toontown
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 424, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 482, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 748, in __startIfReady
    self.initialAppImport = True
  File "VFSImporter", line 153, in load_module
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 225, in <module>
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 215, in makePackedApp
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 2744, in endPackage
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 444, in close
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 546, in installMultifile
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 869, in done
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 959, in __loadModule
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 1411, in load_module
  File "c:\python27\lib\modulefinder.py", line 305, in load_module
  File "c:\python27\lib\modulefinder.py", line 414, in scan_code
  File "c:\python27\lib\modulefinder.py", line 323, in _safe_import_hook
  File "c:\python27\lib\modulefinder.py", line 125, in import_hook
  File "c:\python27\lib\modulefinder.py", line 162, in determine_parent
KeyError: 'ToontownInfiniteRetro'
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 638, in run
    try:
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 502, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 460, in step
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 424, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 482, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 748, in __startIfReady
    self.initialAppImport = True
  File "VFSImporter", line 153, in load_module
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 225, in <module>
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 215, in makePackedApp
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 2744, in endPackage
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 444, in close
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 546, in installMultifile
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 869, in done
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 959, in __loadModule
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 1411, in load_module
  File "c:\python27\lib\modulefinder.py", line 305, in load_module
  File "c:\python27\lib\modulefinder.py", line 414, in scan_code
  File "c:\python27\lib\modulefinder.py", line 323, in _safe_import_hook
  File "c:\python27\lib\modulefinder.py", line 125, in import_hook
  File "c:\python27\lib\modulefinder.py", line 162, in determine_parent
KeyError: 'ToontownInfiniteRetro'
Failure on startup.

I hope someone can help.

Thanks.

Someone else just asked almost the exact same question:

Two issues:
(1) packp3d cannot find the location of your “toontown” package. One way to solve this is to copy the “toontown” directory into the game directory.
(2) you can’t pass a .bat file to the -m option. It has to be a Python file.

I would also advise running packp3d from the c:/toontownworld directory.

Hi.

Thanks for replying.

Can I try turning the .bat into a .py file?

The folders are: Toontown and Resources (graphical assets)
Inside Toontown is necessary files like the code, and other bits.

I do not know what you mean by “copy the “toontown” directory into the game directory”
Here are screenshots of the folder structure:


Hi.

I moved toontown (inside ToontownInfiniteRetro) into the root.
I created a .py file for start_game_localhost.bat and placed it in the root.

See screenshot, and I got an error:

C:\Panda3D-1.9.0\direct\p3d>packp3d -o toontownworld.p3d -d c:/toontownworld -m
start_game.py
:AppRunner: Total Panda3D disk space used: 281 MB
:AppRunner: Configured max usage is: 2048 MB
:Packager(warning): No such file: /c/toontownworld/start_game.py.py
DCFile::read of /c/toontownworld/RetroResources/phase_3/etc/otp.dc
DCFile::read of /c/toontownworld/RetroResources/phase_3/etc/toon.dc
couldn't import toontown.pets.PetDCImports
couldn't import toontown.coghq.InGameEditorDCImports
DCFile::read of /c/toontownworld/ToontownInfiniteRetro/astron/otp.dc
DCFile::read of /c/toontownworld/ToontownInfiniteRetro/astron/toon.dc
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 424, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 482, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 748, in __startIfReady
    self.initialAppImport = True
  File "VFSImporter", line 153, in load_module
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 225, in <module>
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 215, in makePackedApp
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 2744, in endPackage
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 444, in close
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 546, in installMultifile
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 869, in done
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 959, in __loadModule
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 1411, in load_module
  File "c:\python27\lib\modulefinder.py", line 305, in load_module
  File "c:\python27\lib\modulefinder.py", line 414, in scan_code
  File "c:\python27\lib\modulefinder.py", line 323, in _safe_import_hook
  File "c:\python27\lib\modulefinder.py", line 125, in import_hook
  File "c:\python27\lib\modulefinder.py", line 162, in determine_parent
KeyError: 'ToontownInfiniteRetro'
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 638, in run
    try:
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 502, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 460, in step
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 424, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 482, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 748, in __startIfReady
    self.initialAppImport = True
  File "VFSImporter", line 153, in load_module
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 225, in <module>
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 215, in makePackedApp
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 2744, in endPackage
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 444, in close
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 546, in installMultifile
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 869, in done
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 959, in __loadModule
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 1411, in load_module
  File "c:\python27\lib\modulefinder.py", line 305, in load_module
  File "c:\python27\lib\modulefinder.py", line 414, in scan_code
  File "c:\python27\lib\modulefinder.py", line 323, in _safe_import_hook
  File "c:\python27\lib\modulefinder.py", line 125, in import_hook
  File "c:\python27\lib\modulefinder.py", line 162, in determine_parent
KeyError: 'ToontownInfiniteRetro'
Failure on startup.

C:\Panda3D-1.9.0\direct\p3d>packp3d -o toontownworld.p3d -d c:/toontownworld -m
start_game
:AppRunner: Total Panda3D disk space used: 281 MB
:AppRunner: Configured max usage is: 2048 MB
DCFile::read of /c/toontownworld/RetroResources/phase_3/etc/otp.dc
DCFile::read of /c/toontownworld/RetroResources/phase_3/etc/toon.dc
couldn't import toontown.pets.PetDCImports
couldn't import toontown.coghq.InGameEditorDCImports
DCFile::read of /c/toontownworld/ToontownInfiniteRetro/astron/otp.dc
DCFile::read of /c/toontownworld/ToontownInfiniteRetro/astron/toon.dc
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 424, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 482, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 748, in __startIfReady
    self.initialAppImport = True
  File "VFSImporter", line 153, in load_module
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 225, in <module>
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 215, in makePackedApp
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 2744, in endPackage
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 444, in close
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 546, in installMultifile
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 869, in done
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 959, in __loadModule
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 1411, in load_module
  File "c:\python27\lib\modulefinder.py", line 305, in load_module
  File "c:\python27\lib\modulefinder.py", line 414, in scan_code
  File "c:\python27\lib\modulefinder.py", line 323, in _safe_import_hook
  File "c:\python27\lib\modulefinder.py", line 125, in import_hook
  File "c:\python27\lib\modulefinder.py", line 162, in determine_parent
KeyError: 'ToontownInfiniteRetro'
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 638, in run
    try:
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 502, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 460, in step
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 424, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 482, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 748, in __startIfReady
    self.initialAppImport = True
  File "VFSImporter", line 153, in load_module
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 225, in <module>
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/packp3d.py", line 215, in makePackedApp
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 2744, in endPackage
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 444, in close
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/
p3d/Packager.py", line 546, in installMultifile
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 869, in done
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 959, in __loadModule
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showut
il\FreezeTool.py", line 1411, in load_module
  File "c:\python27\lib\modulefinder.py", line 305, in load_module
  File "c:\python27\lib\modulefinder.py", line 414, in scan_code
  File "c:\python27\lib\modulefinder.py", line 323, in _safe_import_hook
  File "c:\python27\lib\modulefinder.py", line 125, in import_hook
  File "c:\python27\lib\modulefinder.py", line 162, in determine_parent
KeyError: 'ToontownInfiniteRetro'
Failure on startup.


That all really depends on the exact structure and what the .bat file does.

If you have a very complicated set-up, it might be worth it to use the more advanced ppackage tool where you can specify the directories to include (and how to rename them) via instructions in a .pdef file. It also allows you to set sys.path such that ppackage can find the location of the nested packages.

Keep in mind that packp3d/ppackage build against an official build of Panda3D 1.8, rather than a custom SDK build (such as one built with Astron).

Hi,

The game will not run without Astron components inside Panda.

I am not familiar with ppackage. I had a look at the help, I couldn’t make much sense of it. :frowning:

I might need to play around with it. :\

Batch files and python files are of different languages, so the only way you could turn the .bat into a .py would be to translate the code yourself, or somehow make a python file that executes the batch file. Unfortunately, I don’t know exactly how to do that, so you would have to figure that out on your own.

voarsh, here’s how I compile my programs into p3d files:

  1. Create a folder on your desktop or any other area on your computer you can easily access.

  2. Put all of your files you are using in the program (code files, models, png images, custom libraries you import (such as your toontown libraries), etc) in the folder.

  3. Open the command prompt. You can find it by opening your start menu and typing ‘cmd’ in the search bar. Or, you can open windows explorer, and in the navigation bar type ‘cmd’ and the command prompt will automatically open.

  4. In the command prompt, cd to the directory you created in step 1. If you don’t know how, here are a few simple steps:

Let’s say the path to my directory is ‘C:\Users\user\Desktop\Game Directory’.
I would type this in the command prompt:

cd "C:\Users\user\Desktop\Game Directory"

You can also type ‘cd’ in the command prompt, then click and drag the folder you created in set 1 into the command prompt.

  1. Now type ‘packp3d’ in the command prompt. You can access all of packp3d’s features by typing:
packp3d -h
  1. Now give the proper tags in the packp3d command. Let’s say the file that launches the whole program is called ‘launcher.py’. We would clarify the name of the file by giving it the -m tag in the command prompt:
packp3d -m launcher.py

You MUST give your command the -o tag. This names the p3d file you want to generate, so if you wanted it to be ‘program.p3d’:

packp3d -m launcher.py -o program.p3d

If you decided not to cd to the directory for some reason, you don’t have to start all over. Simply give the command the -d tag. This tag will cd to the given directory in the command:

packp3d -m launcher.py -o program.p3d -d "C:\Users\user\Desktop\Game Directory\"
  1. That should be about it! Press enter and packp3d will generate your p3d file. Good luck :slight_smile: