Hi ! I am using python ver 2.6.5 Trying to use shelve to save an object on the disc. ================================= In the code---- # There are 'Person' & 'Manager' classes. # I created instance objects a,b,c from these classes.
from person import Person, Manager a = Person('A A') b = Person('B B', job = 'clerk', pay=5000) c = Manager('C C', 15000) # instance objects a,b,c were created correctly. # then I store them on a shelve import shelve dbs = shelve.open('mydb') for x in (a, b, c): dbs[x.name] = x dbs.close() # On the disc, I can see the 3 files viz. mydb.dat, mydb.bak, mydb.dir # dbs.keys() is also giving me the correct list of keys. ================================== # NOW THE PROBLEM AREA --- # when I try to fetch an object by key--- a = dbs['A A'] # I get an error as-- # File "F:\Py26\lib\shelve.py", line 122, in __getitem__ # value = Unpickler(f).load() # ValueError: unsupported pickle protocol: 3 ============================= I couldn't locate the bug in this. Can anybody pl. point out? ---Thanks, Vineet. -- http://mail.python.org/mailman/listinfo/python-list