Packaged code runs differently than main.py

When I run my main.py file, the game runs fine.
When I try to run the .p3d file after packaging the game, it give me an error, and adds the letter ‘u’ to the front of a file it loads. Did I compile this wrong? Or is this a know bug?

You haven’t told us enough information to understand the nature of the problem. What is the exact error message it gives you?

David

It says:

KeyError: u'wall_strait'

where wall_strait is the object to be loaded.

That’s still not really enough information, but I’m guessing some file that your Python program is trying to load didn’t get packaged into the p3d file, or something along those lines. Do you need further help debugging that exact problem?

The u, by the way, is normal Python behavior. That just means it’s a Unicode string.

David

That makes more sense. I was thinking it was looking for a different file. I’ll try adding -n to exclude it from compression, and report back.

[EDIT]: Just realized that I was getting gobj errors. Oops.

Now that I know what that u means, fixing everything else was way easier! I was thinking it was appending some random character to the string, but I’m glad that it was supposed to do that.

I’m still getting the same error, even though its not giving me gobj(error)s. It runs fine from the .py file, which tells me that a file is probably missing, but all of the files required for the object it is looking for are there.

Here is the batch file I’m running when I run packp3d, do you notice anything wrong?

packp3d -o ColdenCullen_FinalProject.p3d -d %CD%\FinalProject -m main_IIM.py -p %CD%\FinalProject\ETCleveleditor -s %CD%\FinalProject -r morepy -r wx -r ai -n scene

Well, this is actually a program error of some kind. “KeyError” means that the string “wall_strait” wasn’t found in a dictionary (or something similar) within your Python code.

So, to figure out what’s actually going wrong, you need to look at that dictionary (or whatever it is) and figure out whether it actually should have had the string “wall_strait” within it, and if it should, what part of your program was supposed to put it there, and then see if you can figure out why that part of your program failed to do so.

None of this is directly related to Panda. Surely there is something different about running in a p3d that’s causing your underlying problem, but whatever it is, I have no way to know from here. Presumably it will become clearer when you know more precisely what part of your program is going wrong.

David

Thanks, I will look into that.