cPickle problems.

I’m using cPickle to save some navmeshes, which is basically a mesh that represents walkable area. To do this I created 3 classes which sort of ‘mimic’ blender mesh structure, I have Vertex, Edge and Face.

So I can convert the blender mesh into my custom classes fairly simply, then I go to pickle it and thats all fine as well. But as soon as I un pickle it (in the same module!) I get thrown an error saying the Edge class doesn’t exist which it quite obviously does because I am starting at it. Then I went on and re pickled excluding all Edge objects from the pickle, this time it said the Vertex wasn’t around. I assume its going to be the same for Face (by the way I tried “print locals().keys()” and they sure are there).

What I’m thinking is my ‘module’ object isn’t really what I think it is, when I alt+a is my script run exactly there? Or does blender do some freaky stuff to it?

I’ve tried to re create this outside of blender but I couldn’t do it (where the classes are obviously are in the module) so this makes me think its a blender issue.

Heres the error:

File "NavmeshConverter.py", line 113, in <module>
AttributeError: 'module' object has no attribute 'Edge'

I did some googling and found someone reported this bug on the python website but some dev dismissed it saying fixing it would break compatibility… nice.

Hope someone knows something.

Funny I’ve been working on something simaler but progress has stagneted recently, I’ve just had to much to do. Anyway the answer to your question is that when saving class instances it can’t rebuild the class when loading. To solve, in your loading script put in from your module import your class.
Seeing as I was working on a simaler thing I’m going to post my progress thusfar here. Let me know what you think and if you like I’l have a look at your one. If you like we could combine the projects.
It’s not particularly well documented (read at all) at the minute and the pathfind sometimes makes odd decisions never the less here it is. [edit] for some reason I can’t post here I’l post in game engine resources.
Used chasers mouse script.