Hi all,
There's a strange message error in sessionfilter.py,
Traceback (most recent call last):
File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py", line 111,
in _run
cherrypy.response.finalize()
File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py", line 404,
in finalize
content = self.collapse_body()
File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py", line 375,
in collapse_body
newbody = ''.join([chunk for chunk in self.body])
File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py", line 343,
in flattener
for x in input:
File "/var/lib/python-support/python2.4/cherrypy/filters/sessionfilter.py",
line 177, in saveData
sess.session_data, expiration_time)
File "/var/lib/python-support/python2.4/cherrypy/filters/sessionfilter.py",
line 280, in save
pickle.dump((data, expiration_time), f)
File "/usr/lib/python2.4/copy_reg.py", line 69, in _reduce_ex
raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle module objects
here the function in sessionfilter.py which raises: "TypeError: can't
pickle module objects".
def save(self, id, data, expiration_time):
file_path = self._get_file_path(id)
f = open(file_path, "wb")
pickle.dump((data, expiration_time), f) <<<<<<<<<<<<<<
f.close()
this message is misleading, because data doesn't contains a module
object, here the value of data:
print data
[(u'33', 2009, 1, 212, Decimal("2.000"), Decimal("24.000")), (u'33',
2009, 1, 6, Decimal("43.000"),Decimal("5289.000"))],f)
and now take a look at this:
pickle.dump((data, expiration_time), f)
*** TypeError: can't pickle module objects
pickle.dump(( [(u'33', 2009, 1, 212, Decimal("2.000"),
Decimal("24.000")), (u'33', 2009, 1, 6, Decimal("43.000"),
Decimal("5289.000"))], expiration_time),f)
*** NameError: name 'Decimal' is not defined
I'm confusing about this behavior. If I pass data to pickle.dump it
says: TypeError: can't pickle module objects
instead if I pass the value of data to pickle.dump it says: NameError:
name 'Decimal' is not defined
why this difference?
what can I do about Decimals and pickle?
j
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---