[Pythonmac-SIG] Deepcopy failure. How to find what failed?
Lou Pecora
lou_boog2000 at yahoo.com
Thu Apr 28 17:44:11 CEST 2011
I am trying to make a Deepcopy of an object with several objects as data. I get
an error "instancemethod expected at least 2 arguments, got 0" (complete error
message below -- sorry, it's long one), but I have no idea what that refers to
or what is failing. Is there a way to tell what is failing to Deepcopy?
More info: I tried Deepcopy on some of the data objects in my original object
instance and they all got copied without errors. So it is something else in my
original object, but I cannot get very far given the error messages.
I also tried to use Pool and Pool.map on this object (I'm trying to use
multiprocess module, but let's keep things simple for now). The latter failed,
giving a pickle error. I suspect it's the same problem.
Any help appreciated.
Error Traceback:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/louispecora/calc/Well-Barrier_systems/VDWB2P/VDWB2P_1/drvrVDWB2P_1.py in
<module>()
121 Ei=Erangelist[i]; Ef=Erangelist[i+1];
nE=nElist[i+1]
122 # 0th item tells driverbem which function to
call in pool.map
--> 123
args.append([CP.deepcopy(dvrbem),Ei,Ef,nE,prnresF, figdir, prnresF, adaptF,
mindeldTdE, minStep, maxStep])
124 print '\nargs:\n',args
125 sys.exit()
/Applications/sage-4.6/local/lib/python/copy.pyc in deepcopy(x, memo, _nil)
187 raise Error(
188 "un(deep)copyable object of type %s" %
cls)
--> 189 y = _reconstruct(x, rv, 1, memo)
190
191 memo[d] = y
/Applications/sage-4.6/local/lib/python/copy.pyc in _reconstruct(x, info, deep,
memo)
336 if state:
337 if deep:
--> 338 state = deepcopy(state, memo)
339 if hasattr(y, '__setstate__'):
340 y.__setstate__(state)
/Applications/sage-4.6/local/lib/python/copy.pyc in deepcopy(x, memo, _nil)
160 copier = _deepcopy_dispatch.get(cls)
161 if copier:
--> 162 y = copier(x, memo)
163 else:
164 try:
/Applications/sage-4.6/local/lib/python/copy.pyc in _deepcopy_dict(x, memo)
253 memo[id(x)] = y
254 for key, value in x.iteritems():
--> 255 y[deepcopy(key, memo)] = deepcopy(value, memo)
256 return y
257 d[dict] = _deepcopy_dict
/Applications/sage-4.6/local/lib/python/copy.pyc in deepcopy(x, memo, _nil)
160 copier = _deepcopy_dispatch.get(cls)
161 if copier:
--> 162 y = copier(x, memo)
163 else:
164 try:
/Applications/sage-4.6/local/lib/python/copy.pyc in _deepcopy_dict(x, memo)
253 memo[id(x)] = y
254 for key, value in x.iteritems():
--> 255 y[deepcopy(key, memo)] = deepcopy(value, memo)
256 return y
257 d[dict] = _deepcopy_dict
/Applications/sage-4.6/local/lib/python/copy.pyc in deepcopy(x, memo, _nil)
187 raise Error(
188 "un(deep)copyable object of type %s" %
cls)
--> 189 y = _reconstruct(x, rv, 1, memo)
190
191 memo[d] = y
/Applications/sage-4.6/local/lib/python/copy.pyc in _reconstruct(x, info, deep,
memo)
321 if deep:
322 args = deepcopy(args, memo)
--> 323 y = callable(*args)
324 memo[id(x)] = y
325 if listiter is not None:
/Applications/sage-4.6/local/lib/python/copy_reg.pyc in __newobj__(cls, *args)
91
92 def __newobj__(cls, *args):
---> 93 return cls.__new__(cls, *args)
94
95 def _slotnames(cls):
TypeError: instancemethod expected at least 2 arguments, got 0
logout -- Lou Pecora, my views are my own.
More information about the Pythonmac-SIG
mailing list