Pickle can't import class from __console__

Warren Postma embed at geocities.com
Wed Feb 9 15:53:18 CET 2000


I was playing with the posted samples of pickling interactively in IDLE, and
experienced this problem:
Is it not possible to use Pickle interactively!?

  # HERES WHERE I'M DUMPING THE CONTENTS OF THE PICKLE JAR OUT FOR ME TO
SEE:
>>> f1 = open('foo.pickle','r')
>>> x = f1.read()
>>> print x
(i__console__
foo
p0
(dp1
b.
>>> f1.close()


  # HERE I'M TRYING TO RELOAD THE PICKLED OBJECT INTERACTIVELY:

>>> zz = pickle.load(open('foo.pickle','r'))
Traceback (innermost last):
  File "<pyshell#38>", line 1, in ?
    zz = pickle.load(open('foo.pickle','r'))
  File "c:\Python\Lib\pickle.py", line 826, in load
    return Unpickler(file).load()
  File "c:\Python\Lib\pickle.py", line 495, in load
    dispatch[key](self)
  File "c:\Python\Lib\pickle.py", line 612, in load_inst
    klass = self.find_class(module, name)
  File "c:\Python\Lib\pickle.py", line 669, in find_class
    raise SystemError, \
SystemError: Failed to import class foo from module __console__
>>>


Warren Postma





More information about the Python-list mailing list