Include Resource file (xml, txt, prc ...) with ppackage

I use ppackage to create p3d package:

“ppackage -i ./ myapp.pdef”

import sys, os
cwd = os.getcwd()
sys.path.append(cwd) 
sys.path.append("/usr/lib/python2.7")


class MyP3D(p3d):
    require('panda3d')
 
    config( 
        version="0.0", 
        display_name="MyP3D") 

    module('xml')
    mainModule('Test')
    file(os.path.join(cwd, 'config/config.xml')) # try with static address
    file('event.txt') # try with dynamic address

but in “start” directory in the runtime Panda directory, I can’t find config folder with config file and txt file.
How to fix it ?

I want to read these file at runtime !

They are embedded in the .p3d files, and mounted through the virtual file system. You should be able to load it without problems, since Panda registers hooks for the VFS into Python’s open() system.

If you need to use some other type of API that does not respect the Panda VFS, then you can pass extract=True to the file() call to have the file extracted to disk whenever you run it.

I have a directory called “scripts” contains python files for dynamic loading.
I got some error with modulefinder when use dir() call:

:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/direct/p3d/AppRunner.py", line 638, in run
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/direct/task/Task.py", line 502, in run
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/direct/task/Task.py", line 460, in step
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/direct/showbase/Messenger.py", line 424, in __taskChainDispatch
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/direct/showbase/Messenger.py", line 482, in __dispatch
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/direct/p3d/AppRunner.py", line 748, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/p3d/ppackage.py", line 235, in <module>
  File "/Users/buildbot/slave/release_rtdist_osx/build/panda3d/built_cmu/direct/p3d/Packager.py", line 2625, in readPackageDef
  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 "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/direct/showutil/FreezeTool.py", line 869, in done
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/direct/showutil/FreezeTool.py", line 959, in __loadModule
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/direct/showutil/FreezeTool.py", line 1411, in load_module
  File "/usr/local/lib/python2.7/modulefinder.py", line 305, in load_module
    self.scan_code(co, m)
  File "/usr/local/lib/python2.7/modulefinder.py", line 414, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "/usr/local/lib/python2.7/modulefinder.py", line 323, in _safe_import_hook
    self.import_hook(name, caller, level=level)
  File "/usr/local/lib/python2.7/modulefinder.py", line 125, in import_hook
    parent = self.determine_parent(caller, level=level)
  File "/usr/local/lib/python2.7/modulefinder.py", line 162, in determine_parent
    parent = self.modules[pname]
KeyError: 'scripts'

How to add it the my pdef file ?

Someone help me !