uqfoundation / dill

serialize all of Python
http://dill.rtfd.io
Other
2.28k stars 181 forks source link

Error on saving notebook containing Holoviews Panel objects #560

Open jj-github-jj opened 2 years ago

jj-github-jj commented 2 years ago

Get the following error on saving notebook session if notebook has aholoview panel object

File c:\Users\test\AppData\Local\Programs\Python\Python39\lib\site-packages\dill\_dill.py:503, in dump_session(filename, main, byref, **kwds)
    501     pickler._first_pass = True
    502     pickler._main_modified = main is not pickler._original_main
--> 503     pickler.dump(main)
    504 finally:
    505     if f is not filename:  # If newly opened file

File c:\Users\test\AppData\Local\Programs\Python\Python39\lib\site-packages\dill\_dill.py:620, in Pickler.dump(self, obj)
    618     raise PicklingError(msg)
    619 else:
--> 620     StockPickler.dump(self, obj)
    621 return

File c:\Users\test\AppData\Local\Programs\Python\Python39\lib\pickle.py:487, in _Pickler.dump(self, obj)
    485 if self.proto >= 4:
    486     self.framer.start_framing()
--> 487 self.save(obj)
    488 self.write(STOP)
    489 self.framer.end_framing()
...
    580     reduce = getattr(obj, "__reduce__", None)

File stringsource:2, in zmq.backend.cython.context.Context.__reduce_cython__()

TypeError: no default __reduce__ due to non-trivial __cinit__
mmckerns commented 2 years ago

I'm going to guess that a holoview panel object is not serializable, so you will have to remove it (either manually, or with something like #475).

jj-github-jj commented 2 years ago

Thank you for the quick response.

jj-github-jj commented 2 years ago

Is it possible to skip Un serializable objects and just not error out and save what can be saved for the session?

mmckerns commented 2 years ago

Yes... that's why I pointed you to the discussion in #475. Currently, you'll need to write a small filter yourself, as in #66. You can close this issue if you feel it's significantly been addressed.