Creating a .pdef file


I’m trying hard to create a .pdef correctly. I can create my .p3d file but when I open it, I have a panda picture with the exclamation mark :frowning:

My .pdef is this:

from panda3d.core import * 
import sys
print sys.path

class myresources(package):
class pandagame(p3d):
	mainModule('main', filename=Filename(''))      

It seems to create the .p3d correctly but I don’t understand why it doesnt work. when I look the log for the .p3d file is this:

_root_dir = C:\Users\Ricardo\AppData\Local/Panda3D, _temp_directory = C:\Users\Ricardo\AppData\Local\Temp\, platform = win32, host_url =, verify_contents = 0
api_version = 16
read contents.xml, max_age = 5, expires in 0 s
Plugin version: 1.0.4
Plugin distributor: cmu
Core API host URL:
Core API version: 1.8.0
Core API date: Mon Feb 13 08:03:24 2012

Creating P3DInstance 00A2AB68:  console_output="0" auto_start="1"
setting background to download, splash_window = 00000000
All 8 extracts of images seem good.
report_package_info_ready: images
Done installing images: success = 1
p3d_basename = C:\Panda3D-1.7.2\samples\Procedural-Cube\salida\pandagame.p3d
p3d trusted
_matches_run_origin = 1
_matches_script_origin = 0
_auto_install = 1, _auto_start = 1, _stop_on_ready = 0
panda3d: asked for seq 2, we have seq 2
All 57 extracts of panda3d seem good.
report_package_info_ready: panda3d
Couldn't find package myresources in contents file.
make_temp_filename: C:\Users\Ricardo\AppData\Local\Temp\p3d_285134.xml
set_wparams: 1 640 480
image_filename = C:\Users\Ricardo\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/images/download.png, thread_id = 7976
notify: onpluginload 
notify: onauth 
Created splash window 2FCA091E
Loaded image: C:\Users\Ricardo\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/images/download.png
Downloading 44.7%, 00A31878
Downloaded 100%, 00A31878, success = 1
release_temp_filename: C:\Users\Ricardo\AppData\Local\Temp\p3d_285134.xml
Redownloading contents.xml didn't help.
Done installing myresources: success = 0
setting background to failed, splash_window = 00A31298
image_filename = C:\Users\Ricardo\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/images/failed.png, thread_id = 7976
Loaded image: C:\Users\Ricardo\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/images/failed.png
notify: ondownloadfail 
notify: onfail 
notify: onpythonstop 
finish_instance: 00A2AB68
P3D_finalize called
counts: 5 1 1 1 

Can somebody help here plz, It looks like it cant find the myressources package, what Im doing wrong?

Thank you.

You are correct, it cannot find your myresources package, because you didn’t specify the URL that you will be hosting this package. As I said already in the other thread, you must specify this URL like this:

require(‘myresources’, host = ‘file:///c:/Users/myname/mydirectory’)

If you omit the host, it assumes the same URL as the panda3d package, which is of course incorrect.


Hi David,

ok, I see, because in the Panda1.7 Game Developer Cookbook they put the resource package and the p3d together in the same .pdef, and they didn’t put the host :s so I thought that the p3d would find the ressource.

Anyway, I split this in 2 .def for package my resources and the other for my .p3d with the host file like this:

from panda3d.core import * 
import sys
print sys.path	
class pandagame(p3d):	
	require('myresources', host = 'file:///C:/Panda3D-1.7.2/samples/Test_pdef/test')
	mainModule('main', filename=Filename(''))      

This creates my .p3d, but when I run this file, I got a timeout connection:

:downloader: [02D46458] begin GET [ ]
:downloader: [02D46458] Timeout connecting to for
Error getting URL

It has to connect to the panda server, is that normal? Cuz I have problems with my proxy at work ( btw for the proxy do I need to put my credentials with the proxy in the config.prc file too? )

Thats weird, because, When I create a .p3d with a .pdef that doesn’t need other packages, it works and it doesnt try to connect to the panda server.

Thanks for the help.

The file you name with the host parameter needs to be the directory that contains the contents.xml that you generated when you created the package. So, in your example you are asking Panda to look for the file c:\Panda3D-1.7.2\samples\Test_pdef\test\contents.xml. Is that the correct path to this file?

I think it is normal for it to contact; actually, I’m not sure why it doesn’t do this in every case.

You can put “http-proxy-username username:password” in your Config.prc file to supply your proxy login credentials. This doesn’t work for every proxy; it depends on the login mechanisms that your proxy supports.


Yes, it’s the correct path to contents.xml of myresources package, but I still having the same error in the log: Couldn’t find package myresources in contents file

Btw, at least that fixed my proxy problem, but there is another problem with my .pdef. I’m trying this with the panda sample, so its works ok this file.

For create the package myresource I do:

from panda3d.core import * 
import sys
print sys.path	
class myresources(package):

And I call this with: ppackage -i test .pdef

There is something else that I’m forgetting?

(Sorry for all the questions, but its the first time with python and my project is in c++, so I didn’t even start with my things ):

Thank you.

I don’t see a problem with your package creation. Does the contents.xml file actually contain a reference to myresources?

You should probably also use the -f parameter to panda3d, to force it to re-read your latest contents.xml file (the default is to always read a previously-cached version if it is available).


Yes, there is a reference to myresources, and that file is there too.

<contents seq="1">
    <host url="" download_url="" />
    <package name="myresources" seq="1" filename="myresources/myresources.xml" size="358" timestamp="1349468033" hash="962cfc7bdaa84ddc850cc8e8d26c5217">
        <import filename="myresources/myresources.import.xml" size="378" timestamp="1349468033" hash="3b85f329ae53613a561b49482b079bec" />

Does the host url suppose to be that?

Even with the -f parameter, its the same error.


No, the host_url isn’t supposed to name like that. I’m not sure how that got in there. You can override it with the statement:


at the top of your pdef file.

Or just hand-edit the contents.xml file and remove it yourself; or blow away the entire test directory and let ppackage repopulate it.


Ok good, that fix that problem, but its not finish :frowning:
Now, I have an error of linking I think:

File "", line 19, in <module>
ImportError: cannot import name Lerp

because I always have a warning when I create the .p3d package :

There are some missing modules: ['panda3d.core']

But I read that we can ignore that warning, but it looks that not any more.

The line 19 in the python file is:

from panda3d.core import Lerp

But, I did in my .pdef a:

from panda3d.core import * 

do I have to include something else?


when I try with other samples like chessboard, I have another error:

:loader(error): Couldn't load file models/square.bam: not found on model path

But, when I create the package myressource I have a warning:

:loader(warning): Unable to load libp3ptloader.dll: Path not found

Are the warnings related? I feel Im close, but its not easy to debug this.


“from panda3d.core import Lerp”? What is Lerp? Does this line work when you run it directly in Python? It doesn’t work for me. Edit: Ah, I see. Lerp is an old deprecated module; it was removed in Panda3D 1.8. Be sure you are using the ppackage tool that matches the version of Panda you wish to publish.

To include model files like models/square.bam, add require(‘models’) to your pdef file, or -r models if you use packp3d.

libp3ptloader.dll isn’t included in any package, I think. I don’t think it’s normally necessary.


Good, it works!

Thank you.