python - dill: TypeError: 'module' object is not callable when dill.load() is run from different files -
i use dill
store python objects file like:
with open(filename, 'wb') output_: dill.dump(obj, output_)
and load stored objects test.dprj
file c:...\dys_project\testsread_write.py
import pprint mbd_system import read_and_write mbd_system.mbd_system import mbdsystem if __name__ == "__main__": mbd_file_abs_path = "c:\...\\test.dprj" mbd = read.read(mbd_file_abs_path) pprint(vars(mbd))
it works fine , object properties printed. if try load file within application dysmainwindow
in c:...\dys_project\dys.py
from mbd_system.mbd_system import mbdsystem mbd_system import read_and_write class dysmainwindow(qtgui.qmainwindow): def __init__(self): super(dysmainwindow, self).__init__() def showopenfiledialog(self): ... self.mbd_system = none self.mbd_system = read_and_write.read(filename) print self.mbd_system.__dict__ pprint(vars(self.mbd_system))
dictionary printed correctly, when use pprint(vars())
print object's properties raises:
file "c:/.../dys_project/dys.py", line 577, in showopenfiledialog pprint(vars(self.mbd_system)) typeerror: 'module' object not callable
any ideas wrong , how fix it?
i have solved problem bad hidden type. have changed code:
import pprint
to:
from pprint import pprint
Comments
Post a Comment