By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,772 Members | 906 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,772 IT Pros & Developers. It's quick & easy.

How to pickling VT_DATE values?

P: n/a
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)

jon N

Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.