我正在尝试使用dill
. 但我得到'NoneType' object is not callable
. 我不知道是什么物体导致了这个问题。那么有没有人有任何想法来调试和找到这个变量?
这是回溯:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-140-c41ad0030e13> in <module>()
1 import dill
----> 2 dill.dump_session('notebook_env.dill')
~/hands-on/lib/python3.5/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()
~/hands-on/lib/python3.5/pickle.py in dump(self, obj)
406 if self.proto >= 4:
407 self.framer.start_framing()
--> 408 self.save(obj)
409 self.write(STOP)
410 self.framer.end_framing()
~/hands-on/lib/python3.5/pickle.py in save(self, obj, save_persistent_id)
473 f = self.dispatch.get(t)
474 if f is not None:
--> 475 f(self, obj) # Call unbound method with explicit self
476 return
477
~/hands-on/lib/python3.5/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:
~/hands-on/lib/python3.5/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
~/hands-on/lib/python3.5/pickle.py in save(self, obj, save_persistent_id)
473 f = self.dispatch.get(t)
474 if f is not None:
--> 475 f(self, obj) # Call unbound method with explicit self
476 return
477
~/hands-on/lib/python3.5/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
~/hands-on/lib/python3.5/pickle.py in save_dict(self, obj)
812
813 self.memoize(obj)
--> 814 self._batch_setitems(obj.items())
815
816 dispatch[dict] = save_dict
~/hands-on/lib/python3.5/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:
~/hands-on/lib/python3.5/pickle.py in save(self, obj, save_persistent_id)
493 reduce = getattr(obj, "__reduce_ex__", None)
494 if reduce is not None:
--> 495 rv = reduce(self.proto)
496 else:
497 reduce = getattr(obj, "__reduce__", None)
TypeError: 'NoneType' object is not callable