I’m having trouble pickling some Panda3d objects that never gave me trouble before, and I think the source of the issue is the objects’ “module” attribute not containing the full module string. I believe “pickle” uses module to find necessary information for serializing the object, so when it can’t find it, it errors. I’m using Ubuntu 14.04 (Trusty) 64, Panda3d from koudelka’s build in this post: Compile SDK (Ubuntu 14.04 Beta) , updated drivers etc. I also found a commit in the github repo from Oct 7 where the issue was not present. Unfortunately, I don’t have time to track down where the problem was introduced.
I ran the following commands on three recent builds, the first two showed the problem, the last (Oct 7) one did not and pickling worked OK:
- koudelka’s build in this post: Compile SDK (Ubuntu 14.04 Beta)
- a Feb 20 commit in the Github “incremental” repo (commit: efbf70a2931b5d94724d7b65f51d0e1c37fc148b)
- a Oct 7 commit in the Github repo (commit: 2a664131da7f732e95816104a53c83f6f63b2459)
import panda3d.core
print(panda3d.core.Vec3)
print(panda3d.core.Vec3.__module__)
print(panda3d.core.NodePath)
print(panda3d.core.NodePath.__module__)
koudelka’s build and the Feb 20 build printed:
<type 'core.LVector3f'>
core
<type 'core.NodePath'>
core
The Oct 7 build printed:
<type 'libpanda.LVector3f'>
libpanda
<type 'libpanda.NodePath'>
libpanda
Here’s the pickle error on koudelka’s build and Feb 20 build:
import panda3d.core
import pickle
pickle.dumps(panda3d.core.Vec3(1, 2, 3))
Error text:
PicklingError: Can't pickle <type 'core.LVector3f'>: it's not found as core.LVector3f