[python-win32] How to set value with PyIPropertyStore

Peng Chen capaneus at gmail.com
Sun Nov 10 19:13:45 EST 2019


Hi Tim,
Thanks, this works!
But now the set value part gives access denied.
I checked around, it seems the file needs to be opened in GPS_READWRITE mode
in order to write info to the file.
So I tried:
from win32comext.shell import shellcon
properties = propsys.SHGetPropertyStoreFromParsingName(
        file_name, Flags=shellcon.GPS_READWRITE)
it reported:
SHGetPropertyStoreFromParsingName() takes no keyword arguments

then I tried
    riid = ""
    ctx = None
    properties = propsys.SHGetPropertyStoreFromParsingName(
        file_name, ctx, shellcon.GPS_READWRITE, riid)
it reported:
(-2147221005, 'Invalid Class String', None, None)

sorry for the different issues, possible to take a look on this?

Thanks!

On Fri, Nov 8, 2019 at 5:22 AM Tim Roberts <timr at probo.com> wrote:

> On Nov 7, 2019, at 2:33 PM, Peng Chen <capaneus at gmail.com> wrote:
>
>
> I tried:
>     dateShifted = propsys.PyPROPVARIANT(
>         mDate + shift_time.timedelta_obj, pythoncom.VT_DATE)
> and it reports:
> module 'win32comext.propsys.propsys' has no attribute ‘PyPROPVARIANT'
>
>
> It is embarrassing that I had to figure this out twice today.
>     dateShifted = propsys.PROPVARIANTType(mDate+shift_time.timedelta_obj,
> pythoncom.VT_DATE)
>
> The PROPVARIANTType function returns a PyPROPVARIANT object.
>> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20191111/e837126a/attachment.html>


More information about the python-win32 mailing list