[Tutor] pickle broken for strings in 2.3?

R. Alan Monroe amonroe at columbus.rr.com
Wed Mar 24 16:02:30 EST 2004




Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> x={1:2, 'a':'b'}
>>> import pickle
>>> pickle.dump(x, 'test.pik')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "c:\python23\lib\pickle.py", line 1382, in dump
    Pickler(file, protocol, bin).dump(obj)
  File "c:\python23\lib\pickle.py", line 210, in __init__
    self.write = file.write
AttributeError: 'str' object has no attribute 'write'




More information about the Tutor mailing list