[Zope] "can't pickle instancemethod objects" in testcase

Peter Bengtsson peter at fry-it.com
Mon Jan 7 13:29:50 EST 2008


My code works fine in normal running zope but not when run as a testcase 
(I'm not using bin/zopectl test if that matters) I get the following error.
I feel guilty since I've got this line in my code:
transaction.get().commit()  (Expense.py#4458)

I remember having come across this error before but can't remember what 
the solution was.

----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/home/peterbe/zope/zope285/lib/python/Testing/ZopeTestCase/profiler.py", 
line 98, in __call__
     testMethod()
   File "testExpenses2.py", line 81, in test_uploadPhotos
     eids = context.uploadExpenseFiles(files)
   File "/home/peterbe/zope/zope285/Products/MExpenses/Expense.py", line 
4458, in uploadExpenseFiles
     transaction.get().commit()
   File "lib/python/transaction/_transaction.py", line 381, in commit
   File "lib/python/transaction/_transaction.py", line 379, in commit
   File "lib/python/transaction/_transaction.py", line 424, in 
_commitResources
   File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line 
462, in commit
     self._commit(transaction)
   File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line 
503, in _commit
     self._store_objects(ObjectWriter(obj), transaction)
   File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line 
525, in _store_objects
     p = writer.serialize(obj)  # This calls __getstate__ of obj
   File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line 
330, in serialize
     return self._dump(meta, obj.__getstate__())
   File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line 
339, in _dump
     self._p.dump(state)
   File "copy_reg.py", line 69, in _reduce_ex
     raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle instancemethod objects

----------------------------------------------------------------------



-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list