The pickle module is looking at the name of the class, and verifying that there's a module.class that matches. However, our subclass of datetime.datetime is registered in pywintypes' dict as TimeType instead. As a workaround, try
pywintypes.datetime = pywintypes.TimeType Roger "Vernon D. Cole" <vernondc...@gmail.com> wrote in message news:cah-zgae7lot7ng1mvu4figk0obsbdrqqwtxupgz0cpg9wtb...@mail.gmail.com... > 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 > -------------------------------------------------------------------------------- > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32