How to pickling VT_DATE values?

jkn jkn_gg at nicorp.f9.co.uk
Wed Mar 23 13:59:25 CET 2005


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




More information about the Python-list mailing list