How to pickling VT_DATE values?

J

jkn

Hi all
this is my first go at pickling and I'm having trouble with
variables of type VT_DATE returned from a COM application.

I don't seem to be successfully pickling/depickling to the the same
value. I think this may be due to a strange return value. The VT_DATE
seems to be a floating point number 'days.(hours, seconds) since
midnight 30 December 1899'. in some cases I get a value (probably 0.0?)
which is printed as

'12/30/0/ 00:00:00'

and I wonder if this strange value is causing the depickling to fail.
Haven't yet followed this to ground...

Anyway, I'm sure someone out there has successfully pickled such values
and wondered how it was done. FWIW my current code is:


import pywintypes
import pythoncom

import copy_reg
def picklePyTime(o):
return unpicklePyTime, (float(o),)

def unpicklePyTime(po):
return pywintypes.Time(po)

copy_reg.pickle(pythoncom.PyTimeType, picklePyTime)



Thanks
jon N
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,222
Messages
2,571,142
Members
47,775
Latest member
MadgeMatti

Latest Threads

Top