I’m having some trouble importing packages, like pygame, when running my program after converting it to a p3d using pack3d. This sample code demonstrates the problem:
#!/usr/bin/env python
# these work
import sqlite3
import numpy
# these don't
import pygame
import httplib2
import PIL
def main(a = None):
print 'Hello, World!'
if __name__ == '__main__':
main()
If I run the program normally it works:
$ ./test.py
Hello, World!
But if I pack it up and run the p3d then some of the imports fail:
$ panda3d packp3d.p3d -m test.py -o test.p3d -r numpy -r pil -r pygame -r sqlite -r httplib2
:AppRunner: Total Panda3D disk space used: 191 MB
:AppRunner: Configured max usage is: 2048 MB
Rejecting package httplib2, version "cmu_1.7": depends on panda3d, version "cmu_1.7" instead of version "cmu_1.8"
:Packager(warning): No such file: /tmp/p3d_info.xml
Generating test.p3d
$ panda3d test.p3d
:AppRunner: Total Panda3D disk space used: 191 MB
:AppRunner: Configured max usage is: 2048 MB
Traceback (most recent call last):
File "/home/buildbot/slave/release_rtdist_linux_i386/build/panda3d/built_cmu/direct/showbase/Messenger.py", line 424, in __taskChainDispatch
File "/home/buildbot/slave/release_rtdist_linux_i386/build/panda3d/built_cmu/direct/showbase/Messenger.py", line 482, in __dispatch
File "/home/buildbot/slave/release_rtdist_linux_i386/build/panda3d/built_cmu/direct/p3d/AppRunner.py", line 748, in __startIfReady
File "VFSImporter", line 153, in load_module
File "/tmp/test.py", line 7, in <module>
import pygame
File "VFSImporter", line 446, in load_module
ImportError
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
File "/home/buildbot/slave/release_rtdist_linux_i386/build/panda3d/built_cmu/direct/p3d/AppRunner.py", line 638, in run
File "/home/buildbot/slave/release_rtdist_linux_i386/build/panda3d/built_cmu/direct/task/Task.py", line 502, in run
File "/home/buildbot/slave/release_rtdist_linux_i386/build/panda3d/built_cmu/direct/task/Task.py", line 460, in step
File "/home/buildbot/slave/release_rtdist_linux_i386/build/panda3d/built_cmu/direct/showbase/Messenger.py", line 424, in __taskChainDispatch
File "/home/buildbot/slave/release_rtdist_linux_i386/build/panda3d/built_cmu/direct/showbase/Messenger.py", line 482, in __dispatch
File "/home/buildbot/slave/release_rtdist_linux_i386/build/panda3d/built_cmu/direct/p3d/AppRunner.py", line 748, in __startIfReady
File "VFSImporter", line 153, in load_module
File "/tmp/test.py", line 7, in <module>
import pygame
File "VFSImporter", line 446, in load_module
ImportError
Successfully joined thread: 0
Failure on startup.
I’m a newb here so I’m sure I’m just missing something important, but I’ve scoured the manual for an hour and can’t see what I’m doing wrong. This is panda 1.8 on 32-bit linux mint 14, python 2.7.
Can anyone help?