From toreklars at gmail.com Sat Nov 2 20:53:19 2013 From: toreklars at gmail.com (Tore Klars) Date: Sat, 2 Nov 2013 12:53:19 -0700 Subject: [python-win32] LocalService, COM In-Reply-To: <78C91C6FD63DD04BB8812EE9288C1E8135576A8409@EXCHANGE01.office.directedge.net> References: <78C91C6FD63DD04BB8812EE9288C1E8135576A8409@EXCHANGE01.office.directedge.net> Message-ID: > Because both LocalService and NetworkService have minimal privileges on the > local computer, while LocalSystem, admin, and guest have more extensive > privileges. I'm unable to find documentation about any COM restrictions imposed on LocalService and NetworkService. Nonetheless, how can any such COM restrictions be avoided? For example, with CoInitializeSecurity(). On Thu, Oct 31, 2013 at 9:45 AM, Dahlstrom, Roger wrote: > Because both LocalService and NetworkService have minimal privileges on the > local computer, while LocalSystem, admin, and guest have more extensive > privileges. > > > > From: python-win32 > [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On Behalf > Of Tore Klars > Sent: Thursday, October 31, 2013 12:00 PM > To: python-win32 at python.org > Subject: [python-win32] LocalService, COM > > > > I'm debugging a COM issue with pythoncom: a Python program is unable > communicate > > with VirtualBox over COM when run under the LocalService or NetworkService > > Windows accounts. The same program can communicate with VirtualBox without > issue > > under the LocalSystem, administrator, and Guest accounts. > > > > Under LocalService and NetworkService, this line > > > > win32com.client.Dispatch('VirtualBox.VirtualBox') > > > > raises > > > > com_error(-2147024891, 'Access is denied.', None, None) > > > > Why are the LocalService and NetworkService accounts unable to communicate > with > > VirtualBox over COM? > > > > Thank you. > > > ________________________________ > DISCLAIMER: > This e-mail, and any attachments thereto, is intended only for use by the > addressee(s) named herein and may contain legally privileged and/or > confidential information. If you are not the intended recipient of this > e-mail, you are hereby notified that any dissemination, distribution or > copying of this e-mail is prohibited. If you have received this in error, > please immediately notify me and permanently delete the original and any > copy of any e-mail and any printout thereof. The sender therefore does not > accept liability for any errors or omissions in the contents of this message > which arise as a result of e-mail transmission. Direct Edge may, at its > discretion, monitor and review the content of all e-mail communications. From i.am.songoku at gmail.com Fri Nov 8 13:45:47 2013 From: i.am.songoku at gmail.com (Krishnan Shankar) Date: Fri, 8 Nov 2013 04:45:47 -0800 Subject: [python-win32] Automating Systray Icons Message-ID: Hi All, I am automating an application in windows using python. After installation i need to check if the applications icon has appeared in Taskbar or not. If yes i need to right click the application. I had been using pywinauto for the same but could not get the job done till now. I did the following, app=pywinauto.application.Application() hand=pywinauto.findwindows.find_windows(class='Shell_TrayWnd', title=u'') When i use the handler, get the window and do a right click i am able to click only in the taskbar and not icons. That maybe because i did not recognise the icon yet. Can you guide me how to do the same using pywinauto or pywin32? Regards, Krishnan -------------- next part -------------- An HTML attachment was scrubbed... URL: From 2281570025 at qq.com Fri Nov 8 16:25:14 2013 From: 2281570025 at qq.com (=?ISO-8859-1?B?aU1hdGg=?=) Date: Fri, 8 Nov 2013 23:25:14 +0800 Subject: [python-win32] pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf Message-ID: When running the following code on WinXP , all is fine , -------------------------------------------------------------- from win32com.shell import shell def launch_file_explorer(path, files): folder_pidl = shell.SHILCreateFromPath(path,0)[0] desktop = shell.SHGetDesktopFolder() shell_folder = desktop.BindToObject(folder_pidl, None,shell.IID_IShellFolder) name_to_item_mapping = dict([(desktop.GetDisplayNameOf(item, 0), item) for item in shell_folder]) to_show = [] for file in files: if file not in name_to_item_mapping: raise Exception('File: "{}" not found in "{}"'.format(file, path)) to_show.append(name_to_item_mapping[file]) shell.SHOpenFolderAndSelectItems(folder_pidl, to_show, 0) import os p=r'E:\aa' print(os.listdir(p)) launch_file_explorer(p, os.listdir(p)) -------------------------------------------------------------- however ,when tested on Win7,I got the following error -------------------------------------------------------------- ['b1', 'b2', 't.txt'] Traceback (most recent call last): File "D:\g.py", line 21, in launch_file_explorer(p, os.listdir(p)) File "D:\g.py", line 13, in launch_file_explorer raise Exception('File: "{}" not found in "{}"'.format(file, path)) Exception: File: "t.txt" not found in "E:\aa" -------------------------------------------------------------- I nearly have no experience on pywin32 programming ,the above code is googled,anyone can help me fix this error ?thanks in advance ! -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Fri Nov 8 22:53:07 2013 From: timr at probo.com (Tim Roberts) Date: Fri, 8 Nov 2013 13:53:07 -0800 Subject: [python-win32] pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf In-Reply-To: References: Message-ID: <527D5D43.90305@probo.com> iMath wrote: > When running the following code on WinXP , all is fine , > ... > however ,when tested on Win7,I got the following error > -------------------------------------------------------------- > > ['b1', 'b2', 't.txt'] > Traceback (most recent call last): > File "D:\g.py", line 21, in > launch_file_explorer(p, os.listdir(p)) > File "D:\g.py", line 13, in launch_file_explorer > raise Exception('File: "{}" not found in "{}"'.format(file, path)) > Exception: File: "t.txt" not found in "E:\aa" > -------------------------------------------------------------- > I nearly have no experience on pywin32 programming ,the above code is > googled,anyone can help me fix this error ?thanks in advance ! The issue here is not XP versus Win 7. The issue here is the Explorer folder settings. On your XP system, the user has selected the option to show the file extensions. On your Win 7 system, the user has NOT selected that option. You're using the GetDisplayNameOf API, which returns to you the file name exactly as it would be displayed in Explorer. When that option is off, the filename "t.txt" would be displayed as "t", so that's the key you are storing in name_to_item_mapping. The key "t.txt" is not found, as the error says. What you're doing here is a little bit dangerous, because "t.xls" and "t.txt" and "t.exe" will all return the same value from GetDisplayNameOf. You won't get a one-to-one assignment. Since you haven't explained what you actually expect this code to do, there's no way for us to make a suggestion on a better method. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tismer at stackless.com Sun Nov 10 23:34:58 2013 From: tismer at stackless.com (Christian Tismer) Date: Sun, 10 Nov 2013 23:34:58 +0100 Subject: [python-win32] pywin32 setup.py forgets win32/lib In-Reply-To: <4F406FD1.7080100@gmail.com> References: <4F406FD1.7080100@gmail.com> Message-ID: <52800A12.5050904@stackless.com> Hi Mark and friends, for a customer, I had to build pywin32 with VS2010, and when it finally worked after some changes from https://wiki.python.org/moin/VS2010, I still could not run import win32con I tried to find out why, to no success. I examined some older installation logs on my machine, and the installation of win32/lib was in fact done correctly. With the recent setuptools (tested with 1.2.1 and 1.3.2), the 'py_modules' entry of setup.py seems to be ignored. After pulling hair until I became almost bald, I ended up with the following patch to pywin32 version 217 (218 does not work for me, missing files): Here is the patch if it makes sense to submit it here: ------------------------------------------------------------ From aaea11c6b7560969255e4a1d5dd7d07fa08dae47 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Sun, 10 Nov 2013 22:30:05 +0100 Subject: [PATCH] add win32/lib files. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This seems to be an incompatibility with recent setuptools. (tested 1.1.6 and 1.3.2) Should be investigated further who has a bug here? --- pywin32-217/setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pywin32-217/setup.py b/pywin32-217/setup.py index f77eecf..4480d00 100644 --- a/pywin32-217/setup.py +++ b/pywin32-217/setup.py @@ -2372,6 +2372,11 @@ dist = setup(name="pywin32", 'pythonwin/pywin/Demos/app/*.py', 'pythonwin/pywin/Demos/ocx/*.py', 'pythonwin/license.txt', + # CT 20131110 BEGIN + # for some reason, the files in 'py_modules' are ignored. + # this may be a setuptools problem. + 'win32/lib/*.py', + # CT 20131110 END 'win32/license.txt', 'win32/scripts/*.py', 'win32/test/*.py', -- 1.7.11.1 ------------------------------------------------------------ cheers -- Chris -- Christian Tismer :^) Software Consulting : Have a break! Take a ride on Python's Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/ 14482 Potsdam : PGP key -> http://pgp.uni-mainz.de phone +49 173 24 18 776 fax +49 (30) 700143-0023 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/ From mhammond at skippinet.com.au Mon Nov 11 00:01:56 2013 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 11 Nov 2013 10:01:56 +1100 Subject: [python-win32] pywin32 setup.py forgets win32/lib In-Reply-To: <52800A12.5050904@stackless.com> References: <4F406FD1.7080100@gmail.com> <52800A12.5050904@stackless.com> Message-ID: <52801064.6020807@skippinet.com.au> Hi Christian, I'm a little reluctant to apply this patch as it stands - we rely on setuptools doing the right thing for *all* "library" modules - eg, if we need win32/lib/*.py, we presumably would need all other .py files not listed here - eg, the entire win32com package, etc. However, if you can't narrow this down any further, please upload it to sourceforge, and I'll see if I can reproduce it next time I make a build. Cheers, Mark On 11/11/2013 9:34 AM, Christian Tismer wrote: > Hi Mark and friends, > > for a customer, I had to build pywin32 with VS2010, and when it finally > worked after some changes from https://wiki.python.org/moin/VS2010, > I still could not run > > import win32con > > I tried to find out why, to no success. I examined some older > installation logs > on my machine, and the installation of win32/lib was in fact done > correctly. > > With the recent setuptools (tested with 1.2.1 and 1.3.2), the 'py_modules' > entry of setup.py seems to be ignored. > > After pulling hair until I became almost bald, I ended up with the > following > patch to pywin32 version 217 (218 does not work for me, missing files): > > Here is the patch if it makes sense to submit it here: > > ------------------------------------------------------------ > From aaea11c6b7560969255e4a1d5dd7d07fa08dae47 Mon Sep 17 00:00:00 2001 > From: Christian Tismer > Date: Sun, 10 Nov 2013 22:30:05 +0100 > Subject: [PATCH] add win32/lib files. > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > This seems to be an incompatibility with recent setuptools. (tested > 1.1.6 and 1.3.2) > Should be investigated further who has a bug here? > --- > pywin32-217/setup.py | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/pywin32-217/setup.py b/pywin32-217/setup.py > index f77eecf..4480d00 100644 > --- a/pywin32-217/setup.py > +++ b/pywin32-217/setup.py > @@ -2372,6 +2372,11 @@ dist = setup(name="pywin32", > 'pythonwin/pywin/Demos/app/*.py', > 'pythonwin/pywin/Demos/ocx/*.py', > 'pythonwin/license.txt', > + # CT 20131110 BEGIN > + # for some reason, the files in 'py_modules' are ignored. > + # this may be a setuptools problem. > + 'win32/lib/*.py', > + # CT 20131110 END > 'win32/license.txt', > 'win32/scripts/*.py', > 'win32/test/*.py', From tismer at stackless.com Mon Nov 11 00:23:18 2013 From: tismer at stackless.com (Christian Tismer) Date: Mon, 11 Nov 2013 00:23:18 +0100 Subject: [python-win32] pywin32 setup.py forgets win32/lib In-Reply-To: <52801064.6020807@skippinet.com.au> References: <4F406FD1.7080100@gmail.com> <52800A12.5050904@stackless.com> <52801064.6020807@skippinet.com.au> Message-ID: <52801566.3020006@stackless.com> Hi Mark, Yes, I understand very well, knowing the patching dance so much more than I'd like to... In fact, 'win32/lib' is a folder, actually the only one which is not also a package, and exactly this one does not show up in the install logs. I have the impression that setuptools changed policy about 'py_modules', if 'packages' is given, too. So I think 'win32/lib' is the only problem here, because it is the only thing that is not a package. Will try to narrow this down after I am out of my urgent pressure. What makes me nervous is that nobody else complained so far. Maybe it was never built again for a long time? There are the pre-built installers, but it happened to me that a VS2010 build was needed, and that caused all the grief ... thanks for your very quick answer -- later - Chris On 11.11.13 00:01, Mark Hammond wrote: > Hi Christian, > I'm a little reluctant to apply this patch as it stands - we rely on > setuptools doing the right thing for *all* "library" modules - eg, if > we need win32/lib/*.py, we presumably would need all other .py files > not listed here - eg, the entire win32com package, etc. > > However, if you can't narrow this down any further, please upload it > to sourceforge, and I'll see if I can reproduce it next time I make a > build. > > Cheers, > > Mark > > On 11/11/2013 9:34 AM, Christian Tismer wrote: >> Hi Mark and friends, >> >> for a customer, I had to build pywin32 with VS2010, and when it finally >> worked after some changes from https://wiki.python.org/moin/VS2010, >> I still could not run >> >> import win32con >> >> I tried to find out why, to no success. I examined some older >> installation logs >> on my machine, and the installation of win32/lib was in fact done >> correctly. >> >> With the recent setuptools (tested with 1.2.1 and 1.3.2), the >> 'py_modules' >> entry of setup.py seems to be ignored. >> >> After pulling hair until I became almost bald, I ended up with the >> following >> patch to pywin32 version 217 (218 does not work for me, missing files): >> >> Here is the patch if it makes sense to submit it here: >> >> ------------------------------------------------------------ >> From aaea11c6b7560969255e4a1d5dd7d07fa08dae47 Mon Sep 17 00:00:00 2001 >> From: Christian Tismer >> Date: Sun, 10 Nov 2013 22:30:05 +0100 >> Subject: [PATCH] add win32/lib files. >> MIME-Version: 1.0 >> Content-Type: text/plain; charset=UTF-8 >> Content-Transfer-Encoding: 8bit >> >> This seems to be an incompatibility with recent setuptools. (tested >> 1.1.6 and 1.3.2) >> Should be investigated further who has a bug here? >> --- >> pywin32-217/setup.py | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/pywin32-217/setup.py b/pywin32-217/setup.py >> index f77eecf..4480d00 100644 >> --- a/pywin32-217/setup.py >> +++ b/pywin32-217/setup.py >> @@ -2372,6 +2372,11 @@ dist = setup(name="pywin32", >> 'pythonwin/pywin/Demos/app/*.py', >> 'pythonwin/pywin/Demos/ocx/*.py', >> 'pythonwin/license.txt', >> + # CT 20131110 BEGIN >> + # for some reason, the files in 'py_modules' are >> ignored. >> + # this may be a setuptools problem. >> + 'win32/lib/*.py', >> + # CT 20131110 END >> 'win32/license.txt', >> 'win32/scripts/*.py', >> 'win32/test/*.py', > -- Christian Tismer :^) Software Consulting : Have a break! Take a ride on Python's Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/ 14482 Potsdam : PGP key -> http://pgp.uni-mainz.de phone +49 173 24 18 776 fax +49 (30) 700143-0023 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/ From mhammond at skippinet.com.au Mon Nov 11 08:51:40 2013 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 11 Nov 2013 18:51:40 +1100 Subject: [python-win32] pywin32 setup.py forgets win32/lib In-Reply-To: <52801566.3020006@stackless.com> References: <4F406FD1.7080100@gmail.com> <52800A12.5050904@stackless.com> <52801064.6020807@skippinet.com.au> <52801566.3020006@stackless.com> Message-ID: <52808C8C.4050602@skippinet.com.au> On 11/11/2013 10:23 AM, Christian Tismer wrote: > Hi Mark, > > Yes, I understand very well, knowing the patching dance so much more > than I'd like to... > > In fact, 'win32/lib' is a folder, actually the only one which is not also a > package, and exactly this one does not show up in the install logs. > > I have the impression that setuptools changed policy about 'py_modules', > if 'packages' is given, too. So I think 'win32/lib' is the only problem > here, because > it is the only thing that is not a package. That makes sense - although it probably also means that .pyc files etc may not generated. I wonder if it might be better to see if we can trick setuptools such that we add a dummy package so at least everything special it does for packages is also done for these files? Or maybe we should reach out to setuptools - it might simply be an accidentally introduced bug. Cheers, Mark From nmanu14387 at gmail.com Tue Nov 12 11:05:10 2013 From: nmanu14387 at gmail.com (manu agarwal) Date: Tue, 12 Nov 2013 15:35:10 +0530 Subject: [python-win32] Python Error:WindowsError: [Error 32] The process cannot access the file. Message-ID: Hi, I am getting the below error while executing the script on one of the application server. *WindowsError: [Error 32] The process cannot access the file because it is being used by another process* Script used to delete the files from the server. I had used os.remove(file) and tried with os.unlink(file). But it is giving me the same error. Is there any way i can skip the files which can not be deleted and script proceed further to delete other files or it delete the files forcely without giving this error. I know the process which was using the files but i cannot stop that service because it will impact the application. Please suggest. Thanks Manu Agarwal -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Nov 12 11:12:52 2013 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 12 Nov 2013 10:12:52 +0000 Subject: [python-win32] Python Error:WindowsError: [Error 32] The process cannot access the file. In-Reply-To: References: Message-ID: <5281FF24.7080809@timgolden.me.uk> On 12/11/2013 10:05, manu agarwal wrote: > I am getting the below error while executing the script on one of the > application server. > > *WindowsError: [Error 32] The process cannot access the file because it > is being used by another process* > * > * > Script used to delete the files from the server. > > I had used os.remove(file) and tried with os.unlink(file). But it is > giving me the same error. > > Is there any way i can skip the files which can not be deleted and > script proceed further to delete other files or it delete the files > forcely without giving this error. Certainly: just catch that particular exception within the loop and continue. (FYI os.remove & os.unlink are the same function under the covers) TJG From nmanu14387 at gmail.com Tue Nov 12 13:32:15 2013 From: nmanu14387 at gmail.com (manu agarwal) Date: Tue, 12 Nov 2013 18:02:15 +0530 Subject: [python-win32] Python Error:WindowsError: [Error 32] The process cannot access the file. In-Reply-To: <52821C68.9040804@timgolden.me.uk> References: <5281FF24.7080809@timgolden.me.uk> <52821C68.9040804@timgolden.me.uk> Message-ID: Hi , I caught the Exception using this code: try: print(file) os.remove(file) continue except WindowsError as e: print e But i am still not able to delete the files it only caught the exception in the file and then the script terminates. Please let me know how can i proceed with the rest of the file to delete. Thanks Manu On Tue, Nov 12, 2013 at 5:47 PM, Tim Golden wrote: > Please reply to the list, not to me personally. I'll answer you there > when I see it arrive. > > Thanks > > TJG > > On 12/11/2013 12:09, manu agarwal wrote: > > Hi Tim, > > > > Thanks for the Quick Reply. > > > > I caught the Exception using this code: > > > > try: > > print(file) > > os.remove(file) > > continue > > except WindowsError as e: > > print e > > But i am still not able to delete the files it only caught the exception > > in the file and then the script terminates. > > > > Please let me know how can i proceed with the rest of the file to delete. > > > > Thanks > > Manu Agarwal > > > > > > > > On Tue, Nov 12, 2013 at 3:42 PM, Tim Golden > > wrote: > > > > On 12/11/2013 10:05, manu agarwal wrote: > > > I am getting the below error while executing the script on one of > the > > > application server. > > > > > > *WindowsError: [Error 32] The process cannot access the file > > because it > > > is being used by another process* > > > * > > > * > > > Script used to delete the files from the server. > > > > > > I had used os.remove(file) and tried with os.unlink(file). But it > is > > > giving me the same error. > > > > > > Is there any way i can skip the files which can not be deleted and > > > script proceed further to delete other files or it delete the files > > > forcely without giving this error. > > > > Certainly: just catch that particular exception within the loop and > > continue. > > > > (FYI os.remove & os.unlink are the same function under the covers) > > > > TJG > > > > _______________________________________________ > > 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 mail at timgolden.me.uk Tue Nov 12 13:57:41 2013 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 12 Nov 2013 12:57:41 +0000 Subject: [python-win32] Python Error:WindowsError: [Error 32] The process cannot access the file. In-Reply-To: References: <5281FF24.7080809@timgolden.me.uk> <52821C68.9040804@timgolden.me.uk> Message-ID: <528225C5.3090707@timgolden.me.uk> [Manu: it would help if you were to follow the convention on this list and post your answer underneath or within the text to which you're replying.] [... description of removing files raising WindowsError 32 because the file is in use by another process ...] On 12/11/2013 12:32, manu agarwal wrote: > I caught the Exception using this code: > > try: > print(file) > os.remove(file) > continue > except WindowsError as e: > print e > But i am still not able to delete the files it only caught the exception > in the file and then the script terminates. > > Please let me know how can i proceed with the rest of the file to delete. If the file is in use, you won't be able to delete it. The best you can do is skip it, log it, perhaps retry or add it to a queue to revisit later. If some other process is holding it open, there's nothing you can do -- short of killing that process -- to delete the file out from under it. In your code above, the "continue" is doing nothing. If you were to put the "continue" inside your except handler, the loop could carry on, eg. import os, glob for file in glob.glob("c:/temp/*.txt"): try: os.remove(file) except WindowsError as exc: print("Could not delete %s because %s" % (file, exc)) continue else: print("Deleted %s" % file) TJG From tismer at stackless.com Tue Nov 12 20:51:27 2013 From: tismer at stackless.com (Christian Tismer) Date: Tue, 12 Nov 2013 20:51:27 +0100 Subject: [python-win32] pywin32 setup.py forgets win32/lib In-Reply-To: <52808C8C.4050602@skippinet.com.au> References: <4F406FD1.7080100@gmail.com> <52800A12.5050904@stackless.com> <52801064.6020807@skippinet.com.au> <52801566.3020006@stackless.com> <52808C8C.4050602@skippinet.com.au> Message-ID: <528286BF.7020508@stackless.com> On 11/11/13 08:51, Mark Hammond wrote: > On 11/11/2013 10:23 AM, Christian Tismer wrote: >> Hi Mark, >> >> Yes, I understand very well, knowing the patching dance so much more >> than I'd like to... >> >> In fact, 'win32/lib' is a folder, actually the only one which is not >> also a >> package, and exactly this one does not show up in the install logs. >> >> I have the impression that setuptools changed policy about 'py_modules', >> if 'packages' is given, too. So I think 'win32/lib' is the only problem >> here, because >> it is the only thing that is not a package. > > That makes sense - although it probably also means that .pyc files etc > may not generated. I wonder if it might be better to see if we can > trick setuptools such that we add a dummy package so at least > everything special it does for packages is also done for these files? > > Or maybe we should reach out to setuptools - it might simply be an > accidentally introduced bug. Yes, there can be a better patch. On the other hand, nowadays there is no need to precompile. If people use it in py2exe or pyinstaller, it will get compiled, anyway. It might be interesting for system-wide installs. But again, most people use virtualenv... Anyway, a minor point for me if you have a better way to trick setuptools. I agree that this should be discussed with the distutils people. Not sure if I should do that. They broke your project, but nobody cares because the builds are there :-) Please let me know how you will do it. Actually I have one or two other things to dicuss with you... cheers & thanks -- chris -- Christian Tismer :^) Software Consulting : Have a break! Take a ride on Python's Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/ 14482 Potsdam : PGP key -> http://pgp.uni-mainz.de phone +49 173 24 18 776 fax +49 (30) 700143-0023 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/ From cappy2112 at gmail.com Thu Nov 14 03:01:11 2013 From: cappy2112 at gmail.com (Tony Cappellini) Date: Wed, 13 Nov 2013 18:01:11 -0800 Subject: [python-win32] Understanding "Access Denied" when calling win32process.TerminateProcess() from Run As Administrator prompt Message-ID: >>Well, slightly oddly, this is the error message you receive when you try > >>to terminate a process which has already terminated! I don't know if > >>this behaviour is new to Win7 (and I'm reluctant to build a WinXP VM > >>just to test one line of code :) ). > > >>Could that be the answer? > > > Sorry for the delay in replying, had a few more important crises to solve. To summarize, I have a program running under Windows XP, which launches a process via os.spawnv(). When the user wants to exit the program they press Ctrl-C. The program terminates the process via win32process.TerminateProcess(). Everything is normal. Running under Windows 7, (using the same version of Python), an exception is raised when win32process.TerminateProcess() is called. I know know the reason why Yes Tim, you're right about this. The external process I was trying to terminate with win32process.TerminateProcess() has already been terminated (when running under Windows 7) I wrote a short program which duplicated my application and the external process, to investigate this issue. The application launches a process. The process does nothing but count from 0- infinity. The count is displayed on the screen 1 second apart. The application sits in a while loop waiting for Ctrl-C to be pressed. When I press Ctrl-C, using Windows 7 Task Manager I can see one of the two python processes terminate. Print statements in my code tells me it's the external process which is displaying a count every 1 second. The things I don't understand are: 1. Under Windows XP, the Ctrl-C does not terminate the process, and win32process.TerminateProcess() must be called. 2. Under Windows 7, Ctrl-C DOES terminate the process, and win32process. TerminateProcess() should not be called. 3. How (and why) does the Ctrl-C get propagated to the process, and why does it terminate the process, when the process is running in a separate address space? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Thu Nov 14 10:52:12 2013 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 14 Nov 2013 09:52:12 +0000 Subject: [python-win32] Understanding "Access Denied" when calling win32process.TerminateProcess() from Run As Administrator prompt In-Reply-To: References: Message-ID: <52849D4C.6040402@timgolden.me.uk> On 14/11/2013 02:01, Tony Cappellini wrote: > Sorry for the delay in replying, had a few more important crises to solve. > > To summarize, I have a program running under Windows XP, which launches > a process > via os.spawnv(). When the user wants to exit the program they press > Ctrl-C. The program terminates the process via > win32process.TerminateProcess(). Everything is normal. > > Running under Windows 7, (using the same version of Python), an > exception is raised when > win32process.TerminateProcess() is called. I know know the reason why > > Yes Tim, you're right about this. The external process I was trying to > terminate > with win32process.TerminateProcess() has already been terminated (when > running under Windows 7) [...] > The things I don't understand are: > > 1. Under Windows XP, the Ctrl-C does not terminate the process, and > win32process.TerminateProcess() must be called. > > 2. Under Windows 7, Ctrl-C DOES terminate the process, and > win32process.TerminateProcess() > should not be called. > > 3. How (and why) does the Ctrl-C get propagated to the process, and why > does it terminate the process, when the process is running in a separate > address space? This is a quick answer to say: unfortunately, Ctrl-C propagation on Windows within Python itself and between processes in general is a small nightmare! This is only complicated by the fact that you're using the CRT spawn which does things under-the-covers to attempt to simulate Posix semantics -- making it harder to reason about without pretty much stepping through the code. Hopefully someone else has (a) more time right now and/or (b) more knowledge at their fingertips to give you a better answer. If no-one else comes back I'll try to dig up more information. Ultimately, though, the answer might be: you'll just have to cope with it! TJG From stan at vtwireless.com Thu Nov 14 17:06:52 2013 From: stan at vtwireless.com (Stanley Brinkerhoff) Date: Thu, 14 Nov 2013 11:06:52 -0500 Subject: [python-win32] Logging Under Windows Message-ID: I have a rough service application template [1] that I am using for multiple projects. These projects all log to a directory using a date based logger that is running in a dedicated thread with a queue. This allows multithreaded services to properly log and not retain multiple file handles to the log file. Every couple days the log rollover fails. When the logging fails the current log file is no longer present, and no future log messages are retained. Is anyone using the date based logger with Python services in a model similar to this, or has figured out how to get around this issue? 1: https://github.com/sbrinkerhoff/pywinservicetemplate Stan -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Nov 14 19:09:33 2013 From: timr at probo.com (Tim Roberts) Date: Thu, 14 Nov 2013 10:09:33 -0800 Subject: [python-win32] Logging Under Windows In-Reply-To: References: Message-ID: <528511DD.4030104@probo.com> Stanley Brinkerhoff wrote: > I have a rough service application template [1] that I am using for > multiple projects. These projects all log to a directory using a date > based logger that is running in a dedicated thread with a queue. This > allows multithreaded services to properly log and not retain multiple > file handles to the log file. > > Every couple days the log rollover fails. When the logging fails the > current log file is no longer present, and no future log messages are > retained. How is the rollover done? Close, Rename, Reopen? Is the log stored on a network share? There can be unexpected latencies when doing file system operations across a network share. You might consider eliminating a rename, so that you just close the current log file and open a new one with the date embedded in the name. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From skippy.hammond at gmail.com Fri Nov 15 05:16:17 2013 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 15 Nov 2013 15:16:17 +1100 Subject: [python-win32] Understanding "Access Denied" when calling win32process.TerminateProcess() from Run As Administrator prompt In-Reply-To: <52849D4C.6040402@timgolden.me.uk> References: <52849D4C.6040402@timgolden.me.uk> Message-ID: <5285A011.40908@gmail.com> On 14/11/2013 8:52 PM, Tim Golden wrote: > Hopefully someone else has (a) more time right now and/or (b) more > knowledge at their fingertips to give you a better answer. If no-one I had a quick peek at the CRT spawn source code, and can't explain why it behaves differently on winxp vs 7. The only thing I can see that would explain it is if the second process isn't attached to the console, but I can't see why that would be different in the 2 environments either... Cheers, Mark From redstone-cold at 163.com Sat Nov 16 03:57:22 2013 From: redstone-cold at 163.com (redstone-cold) Date: Sat, 16 Nov 2013 10:57:22 +0800 (CST) Subject: [python-win32] pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf Message-ID: <7cd5b41c.13aab.1425ed761c0.Coremail.redstone-cold@163.com> I actually want to use SHOpenFolderAndSelectItems() here ,but encountered this error here ,anyone can help ? https://mail.python.org/pipermail/python-win32/2013-November/012915.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Sat Nov 16 13:51:27 2013 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 16 Nov 2013 23:51:27 +1100 Subject: [python-win32] pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf In-Reply-To: <7cd5b41c.13aab.1425ed761c0.Coremail.redstone-cold@163.com> References: <7cd5b41c.13aab.1425ed761c0.Coremail.redstone-cold@163.com> Message-ID: <52876A4F.3020105@gmail.com> The 3rd google result for "SHOpenFolderAndSelectItems" points back at an example from this mailing list - https://mail.python.org/pipermail/python-win32/2012-September/012531.html Mark On 16/11/2013 1:57 PM, redstone-cold wrote: > I actually want to use SHOpenFolderAndSelectItems() here ,but > encountered this error here ,anyone can help ? > > https://mail.python.org/pipermail/python-win32/2013-November/012915.html > > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > From jacob at blindza.co.za Tue Nov 19 22:49:23 2013 From: jacob at blindza.co.za (Jacob Kruger) Date: Tue, 19 Nov 2013 23:49:23 +0200 Subject: [python-win32] Simple little sound mixing app that reads timing/sound data from XML file Message-ID: As subject line says - current example .xml file is tracks.xml, and sound clips are in /sounds subdirectory, and it uses sound_lib to handle playback: https://dl.dropboxusercontent.com/u/13327195/soundMixing2Source.zip Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Wed Nov 20 02:03:36 2013 From: timr at probo.com (Tim Roberts) Date: Tue, 19 Nov 2013 17:03:36 -0800 Subject: [python-win32] Simple little sound mixing app that reads timing/sound data from XML file In-Reply-To: References: Message-ID: <528C0A68.6020307@probo.com> Jacob Kruger wrote: > As subject line says - current example .xml file is tracks.xml, and > sound clips are in /sounds subdirectory, and it uses sound_lib to > handle playback: Are you looking for critique? With the one exception of blStop in OnEvent, none of your "global" directives are necessary. As an overgeneralization, global variables are bad. That "lbc.py" module encourages you to think of your application in a rather non-Pythonic (non-wx) way, in my opinion. Usually, almost your whole app would be member functions within a class derived from wx.Dialog. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob at blindza.co.za Wed Nov 20 05:26:48 2013 From: jacob at blindza.co.za (Jacob Kruger) Date: Wed, 20 Nov 2013 06:26:48 +0200 Subject: [python-win32] Simple little sound mixing app that reads timing/sound data from XML file In-Reply-To: <528C0A68.6020307@probo.com> References: <528C0A68.6020307@probo.com> Message-ID: Critique is good, and will check out referral to global variable definitions, etc. Was actually using this initially as looking into processing XML file parsing, initially, and then just played with it, and, I generally just use the LBC module since it's the simplest/easiest way for me to generate layout quickly and easily, but, know should look into wx itself in more detail/depth. Stay well Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' ----- Original Message ----- From: Tim Roberts To: Python-Win32 List Sent: Wednesday, November 20, 2013 03:03 AM Subject: Re: [python-win32] Simple little sound mixing app that reads timing/sound data from XML file Jacob Kruger wrote: As subject line says - current example .xml file is tracks.xml, and sound clips are in /sounds subdirectory, and it uses sound_lib to handle playback: Are you looking for critique? With the one exception of blStop in OnEvent, none of your "global" directives are necessary. As an overgeneralization, global variables are bad. That "lbc.py" module encourages you to think of your application in a rather non-Pythonic (non-wx) way, in my opinion. Usually, almost your whole app would be member functions within a class derived from wx.Dialog. -- 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 jacob at blindza.co.za Wed Nov 20 06:40:00 2013 From: jacob at blindza.co.za (Jacob Kruger) Date: Wed, 20 Nov 2013 07:40:00 +0200 Subject: [python-win32] Simple little sound mixing app that reads timing/sound data from XML file In-Reply-To: <528C0A68.6020307@probo.com> References: <528C0A68.6020307@probo.com> Message-ID: Oh yes, and considered class implementation, but, haven't bothered as of yet, since, like said, this was actually more of a form of testing/trying out XML parsing to start off with. Also, presume with regards to global keyword usage, while it may not always be required/necessary, unless you want to be 100% sure referral to something like that blStop, sort of boolean switch variable is definitely referring to correct object/element, I was maybe also just being careful, but, will have a look around for a bit more documentation regarding this side of it - sorry, but, python is also sort of like my secondary platform, so am definitely not perfect in my workings with it as such......and, things like the blStop switch variable are generally the type of thing would try use if was running something like the playback routines in another, background thread process, or something, instead of how this one is currently operating. Stay well Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' ----- Original Message ----- From: Tim Roberts To: Python-Win32 List Sent: Wednesday, November 20, 2013 03:03 AM Subject: Re: [python-win32] Simple little sound mixing app that reads timing/sound data from XML file Jacob Kruger wrote: As subject line says - current example .xml file is tracks.xml, and sound clips are in /sounds subdirectory, and it uses sound_lib to handle playback: Are you looking for critique? With the one exception of blStop in OnEvent, none of your "global" directives are necessary. As an overgeneralization, global variables are bad. That "lbc.py" module encourages you to think of your application in a rather non-Pythonic (non-wx) way, in my opinion. Usually, almost your whole app would be member functions within a class derived from wx.Dialog. -- 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 leanncherry at bellsouth.net Fri Nov 29 17:11:06 2013 From: leanncherry at bellsouth.net (Leann) Date: Fri, 29 Nov 2013 10:11:06 -0600 Subject: [python-win32] pywin32 documentation wikis Message-ID: <100B2CFD-7554-497A-AE94-4F16C77BE4DD@bellsouth.net> Sent from my iPads Asps a