[python-win32] Python 3 --> Can't pickle <class 'pywintypes.datetime'>
Vernon D. Cole
vernondcole at gmail.com
Thu Apr 18 13:09:36 CEST 2013
Help me, Obiwan Kanobi...
I have been tracking this one down, for two days, and have cleaned by my
data conversion routines and the documentation for them as a result. but I
can't determine the "right" way to fix this.
This works fine in Python 2, but in Python 3, the class of a datetime
retrieved from COM is different. I can send them across a PyRO link in
Python 2, when I try it in Python 3 I get: the error:
adodbapi.apibase.DatabaseError: Can't pickle <class 'pywintypes.datetime'>:
attribute lookup pywintypes.datetime failed
The conversion code I use is:
def DateObjectFromCOMDate(self,comDate):
if isinstance(comDate,datetime.datetime):
return comDate.replace(tzinfo=None) # make non aware
Which returns a pywintypes.datetime, which, as you see, will not pickle.
Any suggestions?
--
Vernon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20130418/e0784d5e/attachment.html>
More information about the python-win32
mailing list