packp3d key error[SOLVED]

Some friends of mine are demanding a demo of the game I’m working on, so I thought I’d pack up what I have and pass it along. When I try to run packp3d in preparation for using pdeploy, but I’m getting a key error. I did a quick search on the forums for information on it, and the thread I found talks about importing modules. My key error seems a bit different, however.

In my case, the error is occurring in a function called determine_parent, at line 162 which is parent = self.modules[“pname”]

Obviously this points to a problem with modules, but the key error itself is KeyError’Models.AutoCores’. I don’t have any modules named “AutoCores”, but I do have a bam file in the subdirectory “Models\AutoCores”. I’m thinking there’s some trouble finding it.

Unfortunately, I don’t have any idea how to resolve this. The file path is correct, both in spelling and in case sensitivity. I’m not sure what to do.
[/code]

Somehow it seems to be thinking you’re importing a Python module from that directory. I don’t know why. Can you try to reproduce the problem with a smaller bit of code?

David

I think I’ve figured out what’s producing the error. I started by going through all my classes and finding the ones that had the word “AutoCores” in them and commenting them out, but that didn’t produce any different results.

Then I had an idea, and I went into the Models/AutoCores folder and I deleted the python file there, which was an app for loading an egg, applying some texture stuff to it, and saving it out as a bam. I use several apps like this to apply glow and gloss maps to models prior to their being loaded in the game.

Deleting that file caused the error to change. I think that the error is related to incorrectly using the file path to python files in subdirectories as the names of their parents.

I’m going to go through my entire directory tree now and remove every python file that isn’t in the root folder, to see if that removes the error completely.

Yeah, that solved the problem. It was finding those stand-alone .py files in the subdirectories and I guess trying to link them back to the main application or something, I’m not sure exactly. They aren’t used by the main application, I run them manually when I need to in order to save out bam files of models with various effects applied to them. But there you have it. Those files were the cause.

Ah, that does explain it. Right, the p3d packer responds to the dir() command by looking recursively for .py files and assuming they are meant to be part of the application. But if the directory itself isn’t a Python module (that is, it lacks an init.py file), then these .py files can’t be loaded and it generates an error.

Seems like there should be an easy fix. If nothing else, I can avoid implicitly adding .py files from a directory that lacks init.py.

David

Now I’m running into another somewhat perplexing problem. I’ve got a .p3d file, but when I try to run the file with panda3dw.exe, which is what my system recommends after installing the panda3d runtime, it opens a command line window, which immediately closes, and then nothing happens. The game doesn’t run. I get the same problem after installing the game with an installer made by pdeploy and trying to run that.

I tried moving my run() command in main.py into a function called main, like the -h for packp3d suggests, but that didn’t seem to work. I’m also a bit concerned by the fact that that my game’s folder is 500+ mb with all the images, models, etc but the p3d file is only 20.0 mb. Is that really the result of compression, or are things missing?

Any thoughts on why my s— be broke?

There are two important ways to diagnose problems like this:

(1) Examine the log files, in your Panda3D runtime directory. There you’ll see the Python output, and you should see why it is aborting.

(2) Use the multify command to examine the actual contents of your p3d file. You can use “multify -tvf myfile.p3d”, for instance. This is how you can answer questions about whether something essential was omitted.

Note that, for the record, the actual run() call within your py file doesn’t matter–this is ignored. The real run() call is made by the p3d runtime, after it has imported your main.py.

David

Is there anyway to get a paged version of the -t output? Or get in a text file or something? I can’t view the whole thing, unfortunately.

I checked in my panda runtime folder for logs, but there weren’t any logs or subfolders. That implies to me that it isn’t crashing, it’s exiting gracefully, without having run my game properly.

I also tried looking at multify with the suggested flags. I couldn’t read the entire output because the command prompt only let’s me read so many lines. I did find a section that listed some pyo files that match my py files, and the section was incomplete. Since i can’t see the entire output of multify, though, I can’t tell if this is conclusive or not.

When you say my runtime folder, you mean the folder for the end-user application people can download to play Panda3D games, right?

The application that’s in Program Files x86, under Panda3D?

Where would the logs be? I’ve just got some dlls, exes, and an ocx. And one without an extension, called Panda3D Game Engine. No sub folders.

I’d love to see these logs, but I can’t find them. :frowning:

Use redirection to send the output to a file:

multify -tvf myfile.p3d >output.txt

No, that’s the application folder. I mean the folder described in the manual page called The runtime Panda3D directory.

David

Alright, now that I know how to use these debugging tools property I’m confident I can figure out the problem. I’ll post again if I can’t.