On 18/04/2013 12:09, Vernon D. Cole wrote:
> 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?

Depends on how you're doing what you're doing, but could you serialise &
unserialise before/after the Pyro call. eg generate to and from an iso
date or an ordinal? (Obviously you'd have to do some work around the
edges of Pyro to make it work, but for this datatype it should be feasible).

TJG

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to