packp3d Module Inclusion Issue

I’m trying to compile a game that imports files from the module direct.ETCleveleditor, however I always get the

there are some missing modules: ['direct.ETClevelEditor']

even though I included the following switches:

-p C:\Panda3D-1.7.2\direct\ETCleveleditor -s C:\Panda3D-1.7.2\direct

Help?

direct is a special module, because it’s built-in as part of the Panda modules that are already part of the plugin system. So it’s problematic to add a new subdirectory to direct that wasn’t there at the time the plugin system was built.

Try putting ETClevelEditor under a different directory, somewhere besides a directory called ‘direct’.

David

I can do that. Are there any other directories I shouldn’t put stuff in?

[EDIT] I tried creating a folder called “imports” in Panda3D-1.7.2 and putting it in there, but when I try

from imports.ETCleveleditor import LevelLoader

It tells me there is

No module named imports.ETCleveleditor

am I putting this in the right place?

I wouldn’t add stuff to any standard Panda3D folder; that’s just asking for trouble. Create your old folder and add it to sys.path (or PYTHONPATH), if necessary, or just put it in your application folder.

Remember also that when you create a folder to serve as a Python module it has to contain a file called init.py. That’s just the way Python works.

David

Great! Thanks! It now semi-works! The only issue I am having now is that one of the files in the package tried to import

xml.dom.minidom

and now that the folder is in my project folder, it can’t find it, giving me this:

ImportError: No module named dom.minidom

Any ideas?

xml is a standard Python module, isn’t it? It’s normally installed into site-packages, at least. I don’t think you should put this one in your own directory; just let it install itself where it thinks it belongs.

When you package up your p3d file, add -r morepy, which includes the xml package (among others).

David

I ended up having to do that for ai too, but it ended up working. I’m getting a weird key error now that I haven’t seen before, but I need sleep now and will post more info tomorrow.