From yvan.manon at siveo.net Tue Nov 5 05:24:02 2019 From: yvan.manon at siveo.net (Yvan Manon) Date: Tue, 5 Nov 2019 11:24:02 +0100 Subject: [python-win32] NotifyAddrChange Message-ID: <8dc7a71f-52e0-948d-e8e8-8c2863dbc726@siveo.net> Hello I'm new with pywin32 I would be inform about network ip change, is pywin32 can access to NotifyAddrChange https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-notifyaddrchange or is it a way to handle this or any advise to manage it Thanks -- Tekmans From timr at probo.com Wed Nov 6 01:05:55 2019 From: timr at probo.com (Tim Roberts) Date: Tue, 5 Nov 2019 22:05:55 -0800 Subject: [python-win32] NotifyAddrChange In-Reply-To: <8dc7a71f-52e0-948d-e8e8-8c2863dbc726@siveo.net> References: <8dc7a71f-52e0-948d-e8e8-8c2863dbc726@siveo.net> Message-ID: <9F11E5B7-EA66-40AC-A3FA-CD56F840C354@probo.com> On Nov 5, 2019, at 2:24 AM, Yvan Manon wrote: > > I'm new with pywin32 > I would be inform about network ip change, is pywin32 can access to NotifyAddrChange > https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-notifyaddrchange > or is it a way to handle this or any advise to manage it Did you do any web searching at all for this? Google is way faster than this mailing list. The first two hits show you how to do this with ctypes, or try cab use this package: https://sourceforge.net/projects/iphelpers/files/ ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From capaneus at gmail.com Wed Nov 6 16:28:00 2019 From: capaneus at gmail.com (Peng Chen) Date: Wed, 6 Nov 2019 21:28:00 +0000 Subject: [python-win32] How to set value with PyIPropertyStore In-Reply-To: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> References: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> Message-ID: 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) it reports: Object must be a PyPROPVARIANT On Tue, Oct 15, 2019 at 1:25 AM Tim Roberts wrote: > Peng Chen wrote: > > > > I'm working on a script to shift video media creation time. > > .... > > I can see there is a function > > PyIPropertyStore.SetValue(key, value) and PyIPropertyStore.Commit() > > to write the date back, but I'm not sure how to construct the value > > because it requires PyPROPVARIANT type. > > I can't figure out any where to import this type and doesn't know how > > to construct it. > > PyPROPVARIANT is generally a return type. In a case like this, I would > expect that you would simply pass the datetime value, and the interface > code would convert it into a variant. Have you tried that? Did you get > an error? > > -- > 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: From timr at probo.com Thu Nov 7 14:26:16 2019 From: timr at probo.com (Tim Roberts) Date: Thu, 7 Nov 2019 11:26:16 -0800 Subject: [python-win32] How to set value with PyIPropertyStore In-Reply-To: References: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> Message-ID: <04c44450-c1fb-826d-a542-2665005b49c7@probo.com> 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: From capaneus at gmail.com Thu Nov 7 17:33:46 2019 From: capaneus at gmail.com (Peng Chen) Date: Thu, 7 Nov 2019 22:33:46 +0000 Subject: [python-win32] How to set value with PyIPropertyStore In-Reply-To: <04c44450-c1fb-826d-a542-2665005b49c7@probo.com> References: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> <04c44450-c1fb-826d-a542-2665005b49c7@probo.com> Message-ID: Thanks Tim, I tried: dateShifted = propsys.PyPROPVARIANT( mDate + shift_time.timedelta_obj, pythoncom.VT_DATE) and it reports: module 'win32comext.propsys.propsys' has no attribute 'PyPROPVARIANT' Should I import it from elsewhere? because the import I had is from win32comext.propsys import propsys, pscon On Thu, Nov 7, 2019 at 7:26 PM Tim Roberts wrote: > 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. > > > _______________________________________________ > 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: From timr at probo.com Fri Nov 8 00:22:25 2019 From: timr at probo.com (Tim Roberts) Date: Thu, 7 Nov 2019 21:22:25 -0800 Subject: [python-win32] How to set value with PyIPropertyStore In-Reply-To: References: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> <04c44450-c1fb-826d-a542-2665005b49c7@probo.com> Message-ID: <7148D8AF-9A30-4A53-A18E-E0E17170D1AE@probo.com> On Nov 7, 2019, at 2:33 PM, Peng Chen 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yvan.manon at siveo.net Fri Nov 8 02:59:46 2019 From: yvan.manon at siveo.net (Yvan Manon) Date: Fri, 8 Nov 2019 08:59:46 +0100 Subject: [python-win32] NotifyAddrChange In-Reply-To: <9F11E5B7-EA66-40AC-A3FA-CD56F840C354@probo.com> References: <8dc7a71f-52e0-948d-e8e8-8c2863dbc726@siveo.net> <9F11E5B7-EA66-40AC-A3FA-CD56F840C354@probo.com> Message-ID: Yes i found the same approch with ctypes with exemple https://programtalk.com/vs2/?source=python/3819/code-for-blog/eliben-code-for-blog-929642f/2008/wxpytris/lib/lib/eblib/win32/network.py https://programtalk.com/vs2/python/13271/WAPT/waptservice/network_manager.py/ thx -- *Yvan Manon* 36 rue decazes 13007 Marseille T?l?phone : 01 86 95 31 90 Web: http://www.siveo.net Le 06/11/2019 ? 07:05, Tim Roberts a ?crit?: > On Nov 5, 2019, at 2:24 AM, Yvan Manon > wrote: >> >> I'm new with pywin32 >> I would be inform about network ip change, is pywin32 can access to >> NotifyAddrChange >> https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-notifyaddrchange >> or is it a way to handle this or any advise to manage it > > Did you do any web searching at all for this? ?Google is way faster > than this mailing list. ?The first two hits show you how to do this > with ctypes, or try cab use this package: > > https://sourceforge.net/projects/iphelpers/files/ > ? > 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: From mhammond at skippinet.com.au Sun Nov 10 02:21:02 2019 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 10 Nov 2019 18:21:02 +1100 Subject: [python-win32] [ANN] pywin32 build 226 released Message-ID: <0a1e34f5-6fa7-73e6-71f5-3ce3f1fc8acf@skippinet.com.au> Hi all, I'm happy to announce the release of pywin32 build 226. Downloads are available at: https://github.com/mhammond/pywin32/releases/tag/b226 and via pypi. For initial support (eg, to ask questions about the release etc), please contact this mailing-list (python-win32 at python.org). If you want to report a bug, please do so at https://github.com/mhammond/pywin32/issues As always, thanks to everyone who contributed to this release, both in terms of code and reporting bugs. Cheers, Mark. Changes: * The directory with the pywin32 system DLLs is now added to the start of PATH for version 3.7 and earlier, and passed to os.add_dll_directory() on 3.8 and later. This will hopefully work around problems loading pywintypes.dll in various situations. * Conversions to and from COM VT_DATE types should no longer lose milliseconds. * Formatting eventlog messages should now handle larger messages and inserts (Ofek Lev via #1421) * Fixed that win32help was very broken everywhere except 32bit 2.7 (#1434) * A number of MAPI improvements from Nick Czeczulin. From capaneus at gmail.com Sun Nov 10 19:13:45 2019 From: capaneus at gmail.com (Peng Chen) Date: Mon, 11 Nov 2019 00:13:45 +0000 Subject: [python-win32] How to set value with PyIPropertyStore In-Reply-To: <7148D8AF-9A30-4A53-A18E-E0E17170D1AE@probo.com> References: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> <04c44450-c1fb-826d-a542-2665005b49c7@probo.com> <7148D8AF-9A30-4A53-A18E-E0E17170D1AE@probo.com> Message-ID: 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 wrote: > On Nov 7, 2019, at 2:33 PM, Peng Chen 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: From timr at probo.com Mon Nov 11 00:23:47 2019 From: timr at probo.com (Tim Roberts) Date: Sun, 10 Nov 2019 21:23:47 -0800 Subject: [python-win32] How to set value with PyIPropertyStore In-Reply-To: References: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> <04c44450-c1fb-826d-a542-2665005b49c7@probo.com> <7148D8AF-9A30-4A53-A18E-E0E17170D1AE@probo.com> Message-ID: On Nov 10, 2019, at 4:13 PM, Peng Chen wrote: > > then I tried > riid = "" > ctx = None > properties = propsys.SHGetPropertyStoreFromParsingName( > file_name, ctx, shellcon.GPS_READWRITE, riid) > it reported: > (-2147221005, 'Invalid Class String', None, None) That?s correct. ?? is not a valid class string. SHGetPropertyStoreFromParsingName returns a COM interface, and you have to tell it what interface you want. It is usually IPropertyStore. What are you trying to do here? Are you porting some C++ code you found into Python? ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From omega.centauri at gmail.com Mon Nov 11 05:51:38 2019 From: omega.centauri at gmail.com (NIcola Montecchiari) Date: Mon, 11 Nov 2019 11:51:38 +0100 Subject: [python-win32] How to get events from COM object? Message-ID: Dear all, I use a COM object and access normally its exposed properties and methods. The object itself may generate events, but I can't find anywhere the way to catch them in python. I googled around and I saw very complicated examples which made me more confused then confident. Is there any good soul out there that can provide me a code from where I can catch the way it works? Thanks a lot for your help Nicola -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Wed Nov 13 18:38:01 2019 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 14 Nov 2019 10:38:01 +1100 Subject: [python-win32] [ANN] pywin32 build 227 released Message-ID: Hi all, I'm happy to announce the release of pywin32 build 227 (although slightly sad it had to be made so quickly after 226 due to issues with that release and virtual environments - apologies for the inconvenience!) Downloads are available at: https://github.com/mhammond/pywin32/releases/tag/b227 and via pypi. For initial support (eg, to ask questions about the release etc), please contact this mailing-list (python-win32 at python.org). If you want to report a bug, please do so at https://github.com/mhammond/pywin32/issues As always, thanks to everyone who contributed to this release, both in terms of code and reporting bugs. Cheers, Mark. Changes: * This release should address problems in build 226 in virtual environments. * Added MAPI IMsgServiceAdmin2 interface (Nick Czeczulin, #1411) From capaneus at gmail.com Thu Nov 14 19:15:54 2019 From: capaneus at gmail.com (Peng Chen) Date: Fri, 15 Nov 2019 00:15:54 +0000 Subject: [python-win32] How to set value with PyIPropertyStore In-Reply-To: References: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> <04c44450-c1fb-826d-a542-2665005b49c7@probo.com> <7148D8AF-9A30-4A53-A18E-E0E17170D1AE@probo.com> Message-ID: Nah, thanks, the stuff I'm trying to do is actually quite simple. I try to read the "Encoded date" info from video file, apply a timeshift and write it back. I searched a few different libs, they are either works for image files only or it's read only and I can't write. So I thought of pywin32 and really didn't expect this coming... Thanks! On Mon, Nov 11, 2019 at 5:24 AM Tim Roberts wrote: > On Nov 10, 2019, at 4:13 PM, Peng Chen wrote: > > > then I tried > riid = "" > ctx = None > properties = propsys.SHGetPropertyStoreFromParsingName( > file_name, ctx, shellcon.GPS_READWRITE, riid) > it reported: > (-2147221005, 'Invalid Class String', None, None) > > > That?s correct. ?? is not a valid class string. > SHGetPropertyStoreFromParsingName returns a COM interface, and you have to > tell it what interface you want. It is usually IPropertyStore. > > What are you trying to do here? Are you porting some C++ code you found > into Python? > ? > 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: From timr at probo.com Fri Nov 15 01:50:19 2019 From: timr at probo.com (Tim Roberts) Date: Thu, 14 Nov 2019 22:50:19 -0800 Subject: [python-win32] How to set value with PyIPropertyStore In-Reply-To: References: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> <04c44450-c1fb-826d-a542-2665005b49c7@probo.com> <7148D8AF-9A30-4A53-A18E-E0E17170D1AE@probo.com> Message-ID: On Nov 14, 2019, at 4:15 PM, Peng Chen wrote: > > Nah, thanks, the stuff I'm trying to do is actually quite simple. > I try to read the "Encoded date" info from video file, apply a timeshift and write it back. > I searched a few different libs, they are either works for image files only or it's read only and I can't write. > So I thought of pywin32 and really didn't expect this coming? I?m pretty confident that the Windows property system will not be able to change the file itself. These APIs might have filters that let them READ items from the media files, but I seriously doubt they will be to MODIFY media files. ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From capaneus at gmail.com Fri Nov 15 07:55:34 2019 From: capaneus at gmail.com (Peng Chen) Date: Fri, 15 Nov 2019 12:55:34 +0000 Subject: [python-win32] How to set value with PyIPropertyStore In-Reply-To: References: <6f26b744-32a6-ac0c-f9df-de42c5b18f84@probo.com> <04c44450-c1fb-826d-a542-2665005b49c7@probo.com> <7148D8AF-9A30-4A53-A18E-E0E17170D1AE@probo.com> Message-ID: Ok, I see, thanks a lot for your help though. I probably need to find a different method. Thanks a lot for your patience! On Fri, Nov 15, 2019 at 6:51 AM Tim Roberts wrote: > On Nov 14, 2019, at 4:15 PM, Peng Chen wrote: > > > > Nah, thanks, the stuff I'm trying to do is actually quite simple. > > I try to read the "Encoded date" info from video file, apply a timeshift > and write it back. > > I searched a few different libs, they are either works for image files > only or it's read only and I can't write. > > So I thought of pywin32 and really didn't expect this coming? > > I?m pretty confident that the Windows property system will not be able to > change the file itself. These APIs might have filters that let them READ > items from the media files, but I seriously doubt they will be to MODIFY > media files. > ? > 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: From vernondcole at gmail.com Mon Nov 25 23:07:18 2019 From: vernondcole at gmail.com (Vernon D. Cole) Date: Mon, 25 Nov 2019 21:07:18 -0700 Subject: [python-win32] Announcement: adodbapi source code moved to pywin32/adodbapi Message-ID: (adodbapi is a pure-Python PEP-249 compliant SQL interface for Windows using Microsoft ADO. It can access numerous database engines using ADO providers or ODBC drivers, and features such leading-edge enhancements as named-column data retrieval and user-selected query parameter styles.) For anyone who cares: As of today, the definitive source code for the adodbapi project is now the adodbapi sub-directory in the pywin32 source repo. That should keep version creep and file inconsistencies from becoming a problem, which fouled up the installation of adodbapi which shipped with the last few releases of pywin32. The pypi and sourceforge distributions have been updated to version 2.6.2.0, which will be part of the next pywin32 release. My apologies for the long delay in making this happen. My day job is now centered in software QA for many Linux / PostgreSQL systems, so I don't get on Windows very often. A younger volunteer to take over regular maintenance of the adodbapi subsystem would be very welcome. -- Vernon Cole see: https://github.com/mhammond/pywin32 http://adodbapi.sourceforge.net/ quick_reference.md -------------- next part -------------- An HTML attachment was scrubbed... URL: