Thread: Pickling Nodes
View Single Post
  #1  
Old 02-21-2006, 06:28 PM
Vygreif Vygreif is offline
Member
 
Join Date: Sep 2005
Posts: 21
Pickling Nodes

Hi,
I'm trying to save nodes as pickled objects, and then loading them later. Does Vizard suppord the pickling of those objects fully?

I currently have this problem:
When the user clicks s, I save the object with the following code:
In this example I'm only saving one object.
if key == 's':
male = viz.add('male.cfg')
objects = viz._GlobalNodeList.values()
f = file("test.sv", "w")
temp = objects[0]
pickle.dump(temp,f,1)
f.close()
When he clicks l I load the code
if key == 'l':
f = file("test.sv", "r")
u = pickle.Unpickler(f)
x = u.load()
viz.add(x)
f.close()

However, when I try this I get the following error:
Traceback (most recent call last):
File "fileinputoutput.py", line 38, in mykeyboard
viz.add(x)
File "C:\Program Files\Vizard25\viz.py", line 4877, in add
s = what.split('.')
AttributeError: VizAvatar instance has no attribute 'split'

Thanks,
YG
Reply With Quote