Date Time problem in the Win32 extensions

George Thom@s georgethomas at pspl.co.in
Tue Jan 25 04:13:36 EST 2000


Hi everyone,
I've managed to put together a rudimentary script that extracts all the
summary information from a storage object using the amazing support for COM
offered by Python. Part of the code was adapted from an example in the beta
chapter of 'Python Programming on Win32' by Mark Hammond & Andy Robinson. I
seem to have encountered a problem in PIDSI_EDITTIME(0x0000000a). Consider
the following code fragment.

import pythoncom
from win32com import storagecon # constants related to storage functions.

# These come from ObjIdl.h
FMTID_UserDefinedProperties = "{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"

#------------- Lots of other COM stuff that can be obtained from the online
beta chapter -------------------

ps = pss.Open(FMTID_UserDefinedProperties)  # pss is a handle to the
IPropertySetStorage interface

props = PIDSI_TITLE, PIDSI_SUBJECT, PIDSI_AUTHOR, PIDSI_KEYWORDS,
PIDSI_COMMENTS, PIDSI_TEMPLATE, PIDSI_LASTAUTHOR, PIDSI_REVNUMBER,
PIDSI_EDITTIME, PIDSI_LASTPRINTED, PIDSI_CREATE_DTM, PIDSI_LASTSAVE_DTM,
PIDSI_PAGECOUNT, PIDSI_WORDCOUNT, PIDSI_CHARCOUNT, PIDSI_THUMBNAIL,
PIDSI_APPNAME, PIDSI_DOC_SECURITY

data = ps.ReadMultiple( props )

On retrieval of the PIDSI_EDITTIME property, a PyTime object is obtained.
It, however, gives me 1601 as the year and consequently the Format() method
returns meaningless information. Although I initially thought this was a Y2K
issue, I later noticed that the other PyTime fields (PIDSI_LASTPRINTED for
instance) continued to return compliant date/time information. I would
really appreciate it if someone could help and let me know if I'm missing
something obvious here.

regards,
george
--------------------------------------------------------------------------
George Thomas
Resident,Planet Earth,Third Rock from the Sun
georgethomas at pspl.co.in


Flat No. FI-5, Fifth Floor,
Himagirinath Co-op. Hsg. Society,
486A Elphinstone Road,
Kirkee, Pune - 411003,
Maharashtra State,
India.
--------------------------------------------------------------------------
Faced with the choice between changing one's mind and proving
there is no need to do so, almost everybody gets busy on the proof.
                                                                 - John
Kenneth Galbraith
--------------------------------------------------------------------------






More information about the Python-list mailing list