[python-win32] How to set value with PyIPropertyStore

Tim Roberts timr at probo.com
Thu Nov 7 14:26:16 EST 2019


Peng Chen wrote:
> Hi Tim,
>  Thanks for the reply. Sorry for the late. I just found your email 
> today. Yes I tried with this code:
>
> from win32comext.propsys import propsys, pscon
> VIDEO_DATE_ENCODED = pscon.PKEY_Media_DateEncoded
> properties = propsys.SHGetPropertyStoreFromParsingName(file_name)
> mDate = properties.GetValue(VIDEO_DATE_ENCODED).GetValue() # got the 
> datetime object
> dateShifted = mDate + shift_time.timedelta_obj # shift date
> properties.SetValue(VIDEO_DATE_ENCODED, dateShifted) # set value
> properties.Commit()
>
> and I got error message when executing to
> properties.SetValue(VIDEO_DATE_ENCODED, dateShifted)

I found it.  Try

   dateShifted = propsys.PyPROPVARIANT(mData + shift_time.timedelta_obj, 
pythoncom.VT_DATE)

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3389 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-win32/attachments/20191107/88bac6f5/attachment.bin>


More information about the python-win32 mailing list