Skip to content

Failure to dump_session after get_ipython #255

@dice89

Description

@dice89

Session to dump

 from IPython import get_ipython
    ipython = get_ipython()
    ipython.magic("matplotlib inline")

ERROR:

TypeError                                 Traceback (most recent call last)
<ipython-input-2-ec1dcb4604c0> in <module>()
      1 import dill
----> 2 dill.dump_session(filename="/tmp/pynb-cache-570030c2-session.dill")

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/dill/dill.py in dump_session(filename, main, byref)
    370         pickler._recurse = False # disable pickling recursion for globals
    371         pickler._session = True  # is best indicator of when pickling a session
--> 372         pickler.dump(main)
    373     finally:
    374         f.close()

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in dump(self, obj)
    410         if self.proto >= 4:
    411             self.framer.start_framing()
--> 412         self.save(obj)
    413         self.write(STOP)
    414         self.framer.end_framing()

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    477         f = self.dispatch.get(t)
    478         if f is not None:
--> 479             f(self, obj) # Call unbound method with explicit self
    480             return
    481 

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/dill/dill.py in save_module(pickler, obj)
   1236                 + ["__builtins__", "__loader__"]]
   1237             pickler.save_reduce(_import_module, (obj.__name__,), obj=obj,
-> 1238                                 state=_main_dict)
   1239             log.info("# M1")
   1240         else:

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
    625 
    626         if state is not None:
--> 627             save(state)
    628             write(BUILD)
    629 

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    477         f = self.dispatch.get(t)
    478         if f is not None:
--> 479             f(self, obj) # Call unbound method with explicit self
    480             return
    481 

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/dill/dill.py in save_module_dict(pickler, obj)
    869             # we only care about session the first pass thru
    870             pickler._session = False
--> 871         StockPickler.save_dict(pickler, obj)
    872         log.info("# D2")
    873     return

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_dict(self, obj)
    812 
    813         self.memoize(obj)
--> 814         self._batch_setitems(obj.items())
    815 
    816     dispatch[dict] = save_dict

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in _batch_setitems(self, items)
    838                 for k, v in tmp:
    839                     save(k)
--> 840                     save(v)
    841                 write(SETITEMS)
    842             elif n:

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    522 
    523         # Save the reduce() output and finally memoize the object
--> 524         self.save_reduce(obj=obj, *rv)
    525 
    526     def persistent_id(self, obj):

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
    625 
    626         if state is not None:
--> 627             save(state)
    628             write(BUILD)
    629 

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    477         f = self.dispatch.get(t)
    478         if f is not None:
--> 479             f(self, obj) # Call unbound method with explicit self
    480             return
    481 

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/dill/dill.py in save_module_dict(pickler, obj)
    869             # we only care about session the first pass thru
    870             pickler._session = False
--> 871         StockPickler.save_dict(pickler, obj)
    872         log.info("# D2")
    873     return

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_dict(self, obj)
    812 
    813         self.memoize(obj)
--> 814         self._batch_setitems(obj.items())
    815 
    816     dispatch[dict] = save_dict

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in _batch_setitems(self, items)
    838                 for k, v in tmp:
    839                     save(k)
--> 840                     save(v)
    841                 write(SETITEMS)
    842             elif n:

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    522 
    523         # Save the reduce() output and finally memoize the object
--> 524         self.save_reduce(obj=obj, *rv)
    525 
    526     def persistent_id(self, obj):

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
    625 
    626         if state is not None:
--> 627             save(state)
    628             write(BUILD)
    629 

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    477         f = self.dispatch.get(t)
    478         if f is not None:
--> 479             f(self, obj) # Call unbound method with explicit self
    480             return
    481 

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/dill/dill.py in save_module_dict(pickler, obj)
    869             # we only care about session the first pass thru
    870             pickler._session = False
--> 871         StockPickler.save_dict(pickler, obj)
    872         log.info("# D2")
    873     return

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_dict(self, obj)
    812 
    813         self.memoize(obj)
--> 814         self._batch_setitems(obj.items())
    815 
    816     dispatch[dict] = save_dict

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in _batch_setitems(self, items)
    838                 for k, v in tmp:
    839                     save(k)
--> 840                     save(v)
    841                 write(SETITEMS)
    842             elif n:

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    477         f = self.dispatch.get(t)
    478         if f is not None:
--> 479             f(self, obj) # Call unbound method with explicit self
    480             return
    481 

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/dill/dill.py in save_module_dict(pickler, obj)
    869             # we only care about session the first pass thru
    870             pickler._session = False
--> 871         StockPickler.save_dict(pickler, obj)
    872         log.info("# D2")
    873     return

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_dict(self, obj)
    812 
    813         self.memoize(obj)
--> 814         self._batch_setitems(obj.items())
    815 
    816     dispatch[dict] = save_dict

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in _batch_setitems(self, items)
    838                 for k, v in tmp:
    839                     save(k)
--> 840                     save(v)
    841                 write(SETITEMS)
    842             elif n:

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    522 
    523         # Save the reduce() output and finally memoize the object
--> 524         self.save_reduce(obj=obj, *rv)
    525 
    526     def persistent_id(self, obj):

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
    625 
    626         if state is not None:
--> 627             save(state)
    628             write(BUILD)
    629 

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    477         f = self.dispatch.get(t)
    478         if f is not None:
--> 479             f(self, obj) # Call unbound method with explicit self
    480             return
    481 

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/dill/dill.py in save_module_dict(pickler, obj)
    869             # we only care about session the first pass thru
    870             pickler._session = False
--> 871         StockPickler.save_dict(pickler, obj)
    872         log.info("# D2")
    873     return

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_dict(self, obj)
    812 
    813         self.memoize(obj)
--> 814         self._batch_setitems(obj.items())
    815 
    816     dispatch[dict] = save_dict

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in _batch_setitems(self, items)
    838                 for k, v in tmp:
    839                     save(k)
--> 840                     save(v)
    841                 write(SETITEMS)
    842             elif n:

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    477         f = self.dispatch.get(t)
    478         if f is not None:
--> 479             f(self, obj) # Call unbound method with explicit self
    480             return
    481 

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/dill/dill.py in save_module_dict(pickler, obj)
    869             # we only care about session the first pass thru
    870             pickler._session = False
--> 871         StockPickler.save_dict(pickler, obj)
    872         log.info("# D2")
    873     return

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_dict(self, obj)
    812 
    813         self.memoize(obj)
--> 814         self._batch_setitems(obj.items())
    815 
    816     dispatch[dict] = save_dict

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in _batch_setitems(self, items)
    838                 for k, v in tmp:
    839                     save(k)
--> 840                     save(v)
    841                 write(SETITEMS)
    842             elif n:

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    522 
    523         # Save the reduce() output and finally memoize the object
--> 524         self.save_reduce(obj=obj, *rv)
    525 
    526     def persistent_id(self, obj):

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
    625 
    626         if state is not None:
--> 627             save(state)
    628             write(BUILD)
    629 

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    477         f = self.dispatch.get(t)
    478         if f is not None:
--> 479             f(self, obj) # Call unbound method with explicit self
    480             return
    481 

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/dill/dill.py in save_module_dict(pickler, obj)
    869             # we only care about session the first pass thru
    870             pickler._session = False
--> 871         StockPickler.save_dict(pickler, obj)
    872         log.info("# D2")
    873     return

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save_dict(self, obj)
    812 
    813         self.memoize(obj)
--> 814         self._batch_setitems(obj.items())
    815 
    816     dispatch[dict] = save_dict

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in _batch_setitems(self, items)
    838                 for k, v in tmp:
    839                     save(k)
--> 840                     save(v)
    841                 write(SETITEMS)
    842             elif n:

~/.pyenv/versions/3.4.3/lib/python3.4/pickle.py in save(self, obj, save_persistent_id)
    497             reduce = getattr(obj, "__reduce_ex__", None)
    498             if reduce is not None:
--> 499                 rv = reduce(self.proto)
    500             else:
    501                 reduce = getattr(obj, "__reduce__", None)

~/.pyenv/versions/pynbexperiments/lib/python3.4/site-packages/zmq/backend/cython/socket.so in zmq.backend.cython.socket.Socket.__reduce_cython__()

TypeError: no default __reduce__ due to non-trivial __cinit__
TypeError: no default __reduce__ due to non-trivial __cinit__

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions