Packpanda not working

My main.py contains following code

import direct.directbase.DirectStart

run()

Still when i am trying to run packpanda then I see following:

Please help

Hello.

Located the file “packpanda.py” on your computer, and look at lines 174 to 185. You will see that there is no magic in there, just normal filesystem operations. To find out what actually goes wrong on your computer you can remove the try/except pair (replace “try” with “if true:” so you don’t have to adjust indention). You will get a full traceback now.

enn0x

Following is the Traceback:

But i still cannot figure out why is it looking out for etc Directory in Python\Lib\Site-Packages.

Please guide.

The Panda3D installation directory (in your case “E:/ALL/Panda3d-1.4.2”) is not intended to be a working directory. Place your game (“E:/ALL/Panda3D-1.4.2/MyGame”) somewhere else, e.g. “E:/MyGame”. Perhaps this is why PANDA (the variable where Panda3D location is stored) is set to the wrong value. It should be “E:/ALL/Panda3D-1.4.2” in your case.

I don’t have much time today, but you could look at packpanda.py, lines 71 to 77. This is where the script locates Panda3D. Adding a few print statements will help debugging.

enn0x

Thanks a lot !!
Atleast you have given me direction.
I’ll try your suggestion.

Anyways, thanks again for your time.

Due to your guidance, Pack panda has started working at my end.
I debugged packpanda.py and modified

    
if (dir != "") and os.path.exists(os.path.join(dir,"direct")) and os.path.exists(os.path.join(dir,"pandac")):
        PANDA=os.path.abspath(dir)

TO

if (dir != "") and os.path.exists(os.path.join(dir,"direct")) and os.path.exists(os.path.join(dir,"pandac")):
        PANDA=os.path.abspath(dir)
        break

The

for dir in sys.path

was giving two results
E:\All\Panda3D-1.4.2
E:\ALL\Panda3D-1.4.2\python\Lib\site-packages

So I put a break in there so as to make PANDA accept the first one.
Atleast its working now.

Thanks enn0x.

Hmm… I think this is just way around your real problem. I have learned that such patches sooner or later come back at you, and then they are even worse to handle. So better find the real problem and remove it.

In my case sys.path looks like this:

C:\Users\rpf>ppython
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for x in sys.path: print x
...

C:\Program Files\Panda3D-1.4.2\python\python24.zip
C:\Program Files\Panda3D-1.4.2\python\DLLs
C:\Program Files\Panda3D-1.4.2\python\lib
C:\Program Files\Panda3D-1.4.2\python\lib\plat-win
C:\Program Files\Panda3D-1.4.2\python\lib\lib-tk
C:\Program Files\Panda3D-1.4.2\python
C:\Program Files\Panda3D-1.4.2
C:\Program Files\Panda3D-1.4.2\bin
C:\Program Files\Panda3D-1.4.2\python\lib\site-packages

Try to remove your messed up Panda3D directory first.

enn0x

Like I said(in the other-py2exe thread), I did reinstall Panda3D, but in vain.

And what happened?
Where did it fail?
What error messages do you get now?
Are the “build” and “dist” directories inside Panda3D gone?
Did you use ynjh_jo’s modified setup.py script (didn’t check it so far, perhaps next weekend), or did you copy the direct/src subfolders?

Sorry, but clairvoyance it something I didn’t learn so far. To help we NEED some info beyond “in vain”.

enn0x

Thanks a lot, enn0x, for your concern.
I’m back to square one.
I used Packpanda successfully(with the modifications i told u above :wink: )

But, I think this is not what is wanted.
My code is still visible.
How do you think can the code be hidden from the user.
I am considering following options:

  1. py2exe - Still not working at my end
  2. encrypting the .py files - couldn’t find anything on net about it.
  3. How about the idea of creating .dll and refering it.But not sure whether it is possible to create a DLL out of python code.

Please suggest.

Your “break” modification from above is something that should not be required. I’m not sure if this will break other things. But good to hear that you finally got an installer. Still you should try to undo your modification and build the installer again.

Did you remove thPanda3D directory by hand? Might be that your attempt to create an installer from within left some artifacts, artifacts which won’t get removed by simply uninstalling Panda3D. So re-installing might give you a messed up Panda3D again.

Hiding code from a user is, well, an illusion. This is true for any software, written in any language. It is just a matter of how much effort someone has to spend on hacking your application.

Read through the packpanda script. There is an option to compile .py to .pyc and only distribute .pyc files (Python bytecode). Bytecode is not human readable, but it is possible to reverse engineer. For 99% of home-brew games this will be more than sufficient. If not: learn to be better than the best hackers, and come back in, say, 30 years.

By the way: py2exe does not provide any better protection. It just packs all .pyc files into a zip archive (which can be appended to the .exe). The zip archive can be extracted very easily, and then a hacker has the bytecode again.

enn0x