onetera
06-03-2009, 08:50 PM
import pickle
class pcTest:
def __init__(self):
pass
def getItems(self):
theListFile = 'D:\\list.cfg'
theFile=open(theListFile)
theDic = pickle.load(theFile)
theFile.close()
return theDic
a=pcTest().getItems()
print a
I wrote above code.
D:\\list.cfg
This file was written for simple dictionary data below by pickel module :
{'chr':['Ogre','pin'] , 'res':['fk','ik','ct'] , 'sde':['lf','rf','ct']}
but when I ran that code, I got below error.
# Error: insecure string pickle
# Traceback (most recent call last):
# File "<maya console>", line 15, in
# File "<maya console>", line 11, in getItems
# File "C:\Program Files (x86)\Autodesk\Maya2009\bin\python25.zip\pickle.py", line 1370, in load
# return Unpickler(file).load()
# File "C:\Program Files (x86)\Autodesk\Maya2009\bin\python25.zip\pickle.py", line 858, in load
# dispatch[key](self)
# File "C:\Program Files (x86)\Autodesk\Maya2009\bin\python25.zip\pickle.py", line 966, in load_string
# raise ValueError, "insecure string pickle"
# ValueError: insecure string pickle #
How can I fix it?
class pcTest:
def __init__(self):
pass
def getItems(self):
theListFile = 'D:\\list.cfg'
theFile=open(theListFile)
theDic = pickle.load(theFile)
theFile.close()
return theDic
a=pcTest().getItems()
print a
I wrote above code.
D:\\list.cfg
This file was written for simple dictionary data below by pickel module :
{'chr':['Ogre','pin'] , 'res':['fk','ik','ct'] , 'sde':['lf','rf','ct']}
but when I ran that code, I got below error.
# Error: insecure string pickle
# Traceback (most recent call last):
# File "<maya console>", line 15, in
# File "<maya console>", line 11, in getItems
# File "C:\Program Files (x86)\Autodesk\Maya2009\bin\python25.zip\pickle.py", line 1370, in load
# return Unpickler(file).load()
# File "C:\Program Files (x86)\Autodesk\Maya2009\bin\python25.zip\pickle.py", line 858, in load
# dispatch[key](self)
# File "C:\Program Files (x86)\Autodesk\Maya2009\bin\python25.zip\pickle.py", line 966, in load_string
# raise ValueError, "insecure string pickle"
# ValueError: insecure string pickle #
How can I fix it?
