cPickle works in standard interpreter, but not in IPython
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IPython |
Confirmed
|
High
|
Unassigned |
Bug Description
for example:
In IPython:
>> class Mylist(list):
def __init_
>> from cPickle import dumps
>> w=Mylist([1,2,3])
>> dumps(w)
PicklingError: Can't pickle <class '__main__.Mylist'>: attribute
lookup __main__.Mylist failed
However, using the standard Python interpreter:
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from cPickle import dumps
>>> class Mylist(list):
... def __init_
... list.__
...
>>> w=Mylist([1,2,3])
>>> dumps(w)
'ccopy_
(lp4\nI1\
>>>
Changed in ipython: | |
importance: | Undecided → High |
status: | New → Confirmed |
Has nothing to do with pickle, but the FakeModule that is registered as __main__:
$ python __name_ _].foo = 1
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.modules[
>>> foo
1
>>>
a$ ipython
In [1]: import sys
In [2]: sys.modules[ __name_ _].foo = 1
In [3]: foo ------- ------- ------- ------- ------- ------- ------- ------- ------- -----
-------
NameError Traceback (most recent call last)
/home/avdd/<ipython console> in <module>()
NameError: name 'foo' is not defined
In [4]: