Packpanda

I’ve been using packpanda to distribute my app because of its simplicity, but I’m wondering, is there a way to create patches for those applications? For whatever reason, my packpanda apps don’t uninstall properly. At least, not from the start menu.

Packpanda is deprecated. I recommend using pdeploy instead, which does create a working uninstaller.

The only reason I haven’t used it is because I’m having trouble trying to get my program exported as a p3d. I need to use the packaging system because I include my own .pyd module, and I haven’t entirely figured it out yet. The manual page on the packaging system is a tad vague to me.

Well, I’ve managed to get the package system mostly working. But when I try to download the package, I get this:

:downloader: GET [ http://www.fluggo.com/games/virtualtabletop/contents.xml?1309
460411 ]
:HostInfo(warning): Successfully downloaded http://www.fluggo.com/games/virtualt
abletop/contents.xml?1309460411
:AppRunner: Freshening http://www.fluggo.com/games/virtualtabletop/Enet/win32/En
et.win32.import.xml
:downloader: GET [ http://www.fluggo.com/games/virtualtabletop/Enet/win32/Enet.w
in32.import.xml ]
[b]:AppRunner: http://www.fluggo.com/games/virtualtabletop/Enet/win32/Enet.win32.im
port.xml is still no good after downloading.[/b]
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 415, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 473, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 745, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/packp3d.py", line 219, in <module>
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/packp3d.py", line 202, in makePackedApp
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/Packager.py", line 3006, in do_require
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/Packager.py", line 3032, in requirePackagesNamed
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/Packager.py", line 2748, in findPackage
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/Packager.py", line 2855, in __findPackageOnHost
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\direct
notify\Notifier.py", line 132, in error
StandardError: Couldn't download import file.
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 636, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 502, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 460, in step
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 415, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 473, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 745, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/packp3d.py", line 219, in <module>
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/packp3d.py", line 202, in makePackedApp
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/Packager.py", line 3006, in do_require
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/Packager.py", line 3032, in requirePackagesNamed
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/Packager.py", line 2748, in findPackage
  File "/home/buildbot/slave/release_rtdist_linux_amd64/build/panda3d/built_cmu/
direct/p3d/Packager.py", line 2855, in __findPackageOnHost
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\direct
notify\Notifier.py", line 132, in error
StandardError: Couldn't download import file.
Failure on startup.

It means the md5 hash of Enet.win32.import.xml, as seen after downloading the file, is different from the md5 hash of the file after it was generated, which is stored in contents.xml.

There are several reasons the hash could have changed, but the most common is a dos-to-unix end-of-line conversion, or vice-versa.

Check the md5 hash of this file after downloading it yourself, and compare it to the md5 hash in contents.xml, and also to the md5 hash of the file as hosted on the server. It shouldn’t be hard to track down where it went wrong.

David

It must be in the download, because the server matches the initial build. Where is that download saved?

You can find it in your runtime Panda3D directory. But it’s just storing exactly what’s provided by the URL; you can download it yourself from the same URL to test it.

David

Odd, there were 3 different temp folders in that directory and one of them contained the correct md5. I deleted all the temp folders and managed to get Enet to download. However, when I run the app, all I get is a wait bar that says “Installing Enet” followed by nothing.

Enet is a .pyd file. How should I save that to the package, as a module or a file? Both?

I think you should save it as a file, not as a module.

You might gain some insight into the current problem from the log files in your runtime directory.

David

This is as far as its ever gotten:

C:\Users\Sprite101\Python Scripts\Game_board>panda3d tabletop.p3d
:downloader: [001405C8] begin GET [ http://fluggo.com/games/virtualtabletop/cont
ents.xml?1309465424 ]
:downloader: [001405C8] begin GET [ http://fluggo.com/games/virtualtabletop/Enet
/win32/Enet.win32.xml ]
:downloader: [001405C8] begin GET [ http://fluggo.com/games/virtualtabletop/Enet
/win32/Enet.win32.mf.pz ]
Installing Enet
Install complete.
:PackageInfo: Package Enet uses 0 MB
:AppRunner: Total Panda3D disk space used: 112 MB
:AppRunner: Configured max usage is: 2048 MB

And then the core log gives me this:

_root_dir = C:\Users\Sprite101\AppData\Local/Panda3D, _temp_directory = C:\Users\SPRITE~1\AppData\Local\Temp\, platform = win32, host_url = https://runtime.panda3d.org/, verify_contents = 0
api_version = 16
read contents.xml, max_age = 5, expires in 0 s
Plugin version: 1.0.3
Plugin distributor: cmu
Core API host URL: https://runtime.panda3d.org/
Core API version: 1.7.2
Core API date: Fri Apr 15 13:39:22 2011

Creating P3DInstance 00340CB8:  console_output="1" 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:\Users\Sprite101\Python Scripts\Game_board\tabletop.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
No longer current: Enet
make_temp_filename: C:\Users\SPRITE~1\AppData\Local\Temp\p3d_138b81.xml
set_wparams: 1 640 480
image_filename = C:\Users\Sprite101\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/images/download.png, thread_id = 6608
notify: onpluginload 
notify: onauth 
Created splash window 00220A54
Loaded image: C:\Users\Sprite101\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/images/download.png
Downloading http://fluggo.com/games/virtualtabletop/contents.xml?1309465424: 0M, 00328808
Downloaded http://fluggo.com/games/virtualtabletop/contents.xml?1309465424: 100%, 00328808, success = 1
read contents.xml, max_age = 5, expires in 5 s
release_temp_filename: C:\Users\SPRITE~1\AppData\Local\Temp\p3d_138b81.xml
C:\Users\Sprite101\AppData\Local/Panda3D/hosts/fluggo.com_a93f7146f6f59938/Enet/Enet.win32.xml is stale.
Downloading http://fluggo.com/games/virtualtabletop/Enet/win32/Enet.win32.xml: 0M, 02DC3580
Downloaded http://fluggo.com/games/virtualtabletop/Enet/win32/Enet.win32.xml: 100%, 02DC3580, success = 1
File is incorrect: Enet.win32.mf
report_package_info_ready: Enet
Beginning install of 1 packages, total 46343 bytes required (18696672 previously downloaded).
P3DSplashWindow::set_visible(1)
Installing Enet, package 1 of 1, 46343 bytes.
Selected install plan for Enet: 0 of 48063.8
notify: ondownloadbegin 
notify: ondownloadnext 
get_panda_script_object
Downloading http://fluggo.com/games/virtualtabletop/Enet/win32/Enet.win32.mf.pz: 43.5%, 02DC1548
Downloaded http://fluggo.com/games/virtualtabletop/Enet/win32/Enet.win32.mf.pz: 100%, 02DC1548, success = 1
Spawning thread to handle Enet
Spawning thread to handle Enet
Done installing Enet: success = 1
setting background to launch, splash_window = 00341928
image_filename = C:\Users\Sprite101\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/images/download.png, thread_id = 6608
Search path is C:\Users\Sprite101\AppData\Local\Panda3D\hosts\fluggo.com_a93f7146f6f59938\Enet;C:\Users\Sprite101\AppData\Local\Panda3D\hosts\runtime.panda3d.org_0f5faf88846080ae\panda3d\cmu_1.7
Setting environment:
  SYSTEMROOT=C:\Windows
  USERPROFILE=C:\Users\Sprite101
  COMSPEC=C:\Windows\system32\cmd.exe
  SYSTEMDRIVE=C:
  ALLUSERSPROFILE=C:\ProgramData
  APPDATA=C:\Users\Sprite101\AppData\Roaming
  COMMONPROGRAMFILES=C:\Program Files (x86)\Common Files
  PROGRAMFILES=C:\Program Files (x86)
  WINDIR=C:\Windows
  PROGRAMDATA=C:\ProgramData
  USERDOMAIN=Lappy386
  PATH=C:\Users\Sprite101\AppData\Local\Panda3D\hosts\fluggo.com_a93f7146f6f59938\Enet;C:\Users\Sprite101\AppData\Local\Panda3D\hosts\runtime.panda3d.org_0f5faf88846080ae\panda3d\cmu_1.7;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files\Intel\DMIX;c:\Program Files\WIDCOMM\Bluetooth Software\;c:\Program Files\WIDCOMM\Bluetooth Software\syswow64;;C:\Program Files\Dell\DW WLAN Card;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Panda3D-1.7.2\python;C:\Panda3D-1.7.2\bin;C:\Panda3D-1.7.2\;C:\Program Files (x86)\Panda3D;C:\Program Files\Common Files\Microsoft Shared\Windows Live
  LD_LIBRARY_PATH=C:\Users\Sprite101\AppData\Local\Panda3D\hosts\fluggo.com_a93f7146f6f59938\Enet;C:\Users\Sprite101\AppData\Local\Panda3D\hosts\runtime.panda3d.org_0f5faf88846080ae\panda3d\cmu_1.7
  DYLD_LIBRARY_PATH=C:\Users\Sprite101\AppData\Local\Panda3D\hosts\fluggo.com_a93f7146f6f59938\Enet;C:\Users\Sprite101\AppData\Local\Panda3D\hosts\runtime.panda3d.org_0f5faf88846080ae\panda3d\cmu_1.7
  PYTHONPATH=C:\Users\Sprite101\AppData\Local\Panda3D\hosts\fluggo.com_a93f7146f6f59938\Enet;C:\Users\Sprite101\AppData\Local\Panda3D\hosts\runtime.panda3d.org_0f5faf88846080ae\panda3d\cmu_1.7
  PYTHONHOME=
  PRC_PATH=C:\Users\Sprite101\AppData\Local\Panda3D\prc;C:\Users\Sprite101\AppData\Local\Panda3D\hosts\fluggo.com_a93f7146f6f59938\Enet;C:\Users\Sprite101\AppData\Local\Panda3D\hosts\runtime.panda3d.org_0f5faf88846080ae\panda3d\cmu_1.7
  PANDA_PRC_PATH=C:\Users\Sprite101\AppData\Local\Panda3D\prc;C:\Users\Sprite101\AppData\Local\Panda3D\hosts\fluggo.com_a93f7146f6f59938\Enet;C:\Users\Sprite101\AppData\Local\Panda3D\hosts\runtime.panda3d.org_0f5faf88846080ae\panda3d\cmu_1.7
  TEMP=C:\Users\SPRITE~1\AppData\Local\Temp\
  PANDA3D_ROOT=C:\Users\Sprite101\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/panda3d/cmu_1.7
  ENET_ROOT=C:\Users\Sprite101\AppData\Local/Panda3D/hosts/fluggo.com_a93f7146f6f59938/Enet
Attempting to start python from C:\Users\Sprite101\AppData\Local\Panda3D\hosts\runtime.panda3d.org_0f5faf88846080ae\panda3d\cmu_1.7\p3dpython.exe
Setting working directory: C:\Users\Sprite101\AppData\Local\Panda3D\start
notify: ondownloadcomplete 
notify: onready 
application shares main object
notify: onpythonload 

And that “File is incorrect” line bothers me a bit.

The “File is incorrect” message should probably read “Local file is incorrect or missing.” It just means that your local copy needs to be refreshed for one reason or another, and is a perfectly normal message, especially if your runtime directory was initially empty.

It looks like it’s downloaded everything successfully and launches Python, but something in Python locks up when it runs. Perhaps you should put some print statements at the top of your main.py to see where it might be going wrong there? It’s a likely guess that it’s failing to import your enet.pyd for some reason, but it could be anything.

David

Its working now. Just a simple error. I had an unnecessary line in main.py:

if __name__ == '__main__':

Once I removed that, it ran fine. Thanks for all the help.

Alright, I kindof have a new issue:

I seem to completely lose my directory setup with panda3d and pdeploy. I’m no longer able to open, read and write text files and I have no idea where my models and whatnot have ended up. How is that supposed to work?

Wow. I’m getting really frustrated with this. I don’t understand why I did all my directory setup if packp3d is just going to ignore all of it. Why is packpanda depreciated? It actually WORKS. I’m not sure how the crap I’m supposed to save and load servernames and maps, much less my models, if I can’t reference the same directory set up after I convert my app to a p3d.

Honestly, it seems as though it would be easier to tell my friends to download the SDK, and set up an SVN and a batch file to get this thing running than using packp3d.

Why is it so hard and counter-intuitive to package this thing? What am I supposed to do?

I apologize for my rant. Most of my files were based on relative paths using sys.path. I removed that reference
and managed to open a file. Sorry.

It’s true that the p3d environment is radically different from your normal development environment, and the differences can surprise you at times.

Most of these differences are necessary to support the key features that p3d provides, which is true platform independence, including even the ability to embed in a web page. (Of course, if you supply your own .pyd file, you lose the platform-independent part of this, unless you make a version of this package for each platform you wish to support.)

It’s true that packpanda wasn’t as counter-intuitive, though.

David

Well, I have most of my file working now. The last problem I’m coming up against is I opened a file and pickle doesn’t like it:

import pickle
		f = open('maps/' + map, 'rb')
		print 'file:',f
		tokens = []
		self.world.tiles = {}
		while True:
			try:
				data = pickle.load(f)
				#print data
				if data[0] == 'Gridspace':
					self.world.addActor(loadObjects[data[0]], **data[1])
					self.world.tile_type = data[1]['modeltype']
				elif data[0] == 'StaticObject':
					self.world.addActor(loadObjects[data[0]], **data[1])
				else:
					tokens.append(data)
			except EOFError:
				break
file:<direct.stdpy.file.file instance at 0x03D72FD0>
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\EventManager.py", line 61, in eventLoopTask
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\EventManager.py", line 55, in doEvents
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\EventManager.py", line 122, in processEvent
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Messenger.py", line 388, in send
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Messenger.py", line 473, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\gui\DirectButton.py", line 103, in commandFunc
  File "C:\Users\Sprite101\Python Scripts\Game_board\GUITEST.py", line 874, in finalize
    self.controls.loadWorld(self.selection)
  File "C:\Users\Sprite101\Python Scripts\Game_board\GUITEST.py", line 1289, in loadWorld
    data = pickle.load(f)
  File "pickle", line 1370, in load
  File "pickle", line 858, in load
  File "pickle", line 966, in load_string
ValueError: insecure string pickle
:task(error): Exception occurred in PythonTask eventManager
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\AppRunner.py", line 636, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\Task.py", line 502, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\Task.py", line 460, in step
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\EventManager.py", line 61, in eventLoopTask
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\EventManager.py", line 55, in doEvents
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\EventManager.py", line 122, in processEvent
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Messenger.py", line 388, in send
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Messenger.py", line 473, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\gui\DirectButton.py", line 103, in commandFunc
  File "C:\Users\Sprite101\Python Scripts\Game_board\GUITEST.py", line 874, in finalize
    self.controls.loadWorld(self.selection)
  File "C:\Users\Sprite101\Python Scripts\Game_board\GUITEST.py", line 1289, in loadWorld
    data = pickle.load(f)
  File "pickle", line 1370, in load
  File "pickle", line 858, in load
  File "pickle", line 966, in load_string
ValueError: insecure string pickle
:TaskManager: TaskManager.destroy()
Failure on startup.

Hmm, that’s weird. The exception seems to suggest that the file is corrupt. Can you examine the file data directly, for instance with the multify command, to see if it is in fact corrupt? When you packed it, did you specify it is a binary file or a text file?

I didn’t specify, but this problem occurred before adding the ‘rb’. I’ve switched it back and still get the same error, with mutliple files that work fine from the SDK

Right, but I was asking about the contents of the file itself as it got packed into the p3d file. Looking now at the code that implements packp3d, it appears that it always packs files in binary form anyway, so it doesn’t seem possible that it could have been corrupted; yet something has clearly gone wrong.

What is the file extension you are using for these pickle files? Are you including it with the -n or the -e option to packp3d (or some other mechanism)? If you extract it from the p3d file with the multify command, can you unpickle the extracted file?

Edit: I just tried it myself, with a simple pickle file of my own devising. I found that the p3d file complained about lacking the ‘string_escape’ encoding, so I added the line:

import encodings.string_escape

to the top of my main.py, and that solved that particular problem; now I can read the pickle file just fine. But your problem seems somewhat different.

David