From bikash.sherchan at gmail.com Mon Jan 5 14:26:10 2009 From: bikash.sherchan at gmail.com (bikash.sherchan at gmail.com) Date: Mon, 5 Jan 2009 14:26:10 +0100 Subject: [python-win32] Multiple Extraction - ArcGIS9.2 Message-ID: <9a3229810901050526v128563abg86aa0ded967c7ce3@mail.gmail.com> I am very beginner and would like to customize ArcGIS using python scripting for my thesis. I have to iterate Extract by Mask tool to extract several raster layer using watershed boundary (vector) and tried to with the attacthed code. But I am unable to get the result and got the following error: Running script multiExtract... Error in script multiExtract. Error in executing: cmd.exe /C C:\EROSIO~1\MULTIE~1.PY "'C:\HfT Thesis_Bikash\thesis data\A2008257NDVI.tif';'C:\HfT Thesis_Bikash\thesis data\A2008273NDVI.tif'" "C:\HfT Thesis_Bikash\thesis data\exactbound_gcs.shp" "#" Failed to execute (multiExtract_4). End Time: Mon Jan 05 14:23:36 2009 (Elapsed Time: 1.00 seconds) I will pleased to hear any sugestion. Thanks -- Bikash Sherchan In der Au 16C/3102 70327 Untert?rkheim Germany Tel: +4971112164816 (Home Zone) +4917664081666 (Mobile Zone) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: MultiExtract.py URL: From timr at probo.com Mon Jan 5 20:27:12 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 05 Jan 2009 11:27:12 -0800 Subject: [python-win32] Multiple Extraction - ArcGIS9.2 In-Reply-To: <9a3229810901050526v128563abg86aa0ded967c7ce3@mail.gmail.com> References: <9a3229810901050526v128563abg86aa0ded967c7ce3@mail.gmail.com> Message-ID: <49625F10.1020003@probo.com> bikash.sherchan at gmail.com wrote: > I am very beginner and would like to customize ArcGIS using python > scripting for my thesis. I have to iterate Extract by Mask tool to > extract several raster layer using watershed boundary (vector) and > tried to with the attacthed code. But I am unable to get the result > and got the following error: > > > Running script multiExtract... > > Error in script multiExtract. > > Error in executing: cmd.exe /C C:\EROSIO~1\MULTIE~1.PY "'C:\HfT > Thesis_Bikash\thesis data\A2008257NDVI.tif';'C:\HfT > Thesis_Bikash\thesis data\A2008273NDVI.tif'" "C:\HfT > Thesis_Bikash\thesis data\exactbound_gcs.shp" "#" > > Failed to execute (multiExtract_4). > > End Time: Mon Jan 05 14:23:36 2009 (Elapsed Time: 1.00 seconds) > > I will pleased to hear any sugestion. Thanks Do you actually have Python installed? My guess from this is that the .py extension has not been registered. You can check this from a command line: C:\tmp>assoc .py .py=Python.File C:\tmp>ftype python.file python.file="C:\Apps\Python24\python.exe" "%1" %* C:\tmp> If those are missing, and you know that the Python interpreter exists on your disk, you can set it up yourself using commands like this, substituting your own path, of course: assoc .py=Python.File ftype Python.File="C:\Python24\python.exe" "%1" %* assoc .pyw=Python.NoConFile ftype Python.NoConFile="C:\Python24\pythonw.exe" "%1" %* -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From apocalypse2012 at yahoo.com Mon Jan 5 22:04:40 2009 From: apocalypse2012 at yahoo.com (Raymond Stewart) Date: Mon, 5 Jan 2009 13:04:40 -0800 (PST) Subject: [python-win32] building pywin32 for python 2.6... Message-ID: <51609.85965.qm@web56807.mail.re3.yahoo.com> I am having a hard time building Mark Hammond?s pywin32 extension with python 2.6.1. I followed the readme and used the setup.py. I have the latest Windows SDK installed, and the Direct X SDK installed as well. I am building on Vista. I have both Python 2.5 and 2.6 installed as well as VC2003, VC2005, and VC2008. I changes the path statement to point at \python26. Not sure what else I need to do. The docs are pretty thin on building configurations. ? Here is what I am getting? ? C:\Users\raymond.stewart\Desktop\pywin32-212>setup.py -q? build Building pywin32 2.5.212.0 PyACL.cpp C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\specstrings.h(9) : fatal error C1083: Cannot open include file: 'sal.h': No such file or directory error: command '"C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe"' failed with exit status 2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Jan 5 23:01:25 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 05 Jan 2009 14:01:25 -0800 Subject: [python-win32] building pywin32 for python 2.6... In-Reply-To: <51609.85965.qm@web56807.mail.re3.yahoo.com> References: <51609.85965.qm@web56807.mail.re3.yahoo.com> Message-ID: <49628335.4080506@probo.com> Raymond Stewart wrote: > > I am having a hard time building Mark Hammond?s pywin32 extension with > python 2.6.1. I followed the readme and used the setup.py. I have the > latest Windows SDK installed, and the Direct X SDK installed as well. > I am building on Vista. I have both Python 2.5 and 2.6 installed as > well as VC2003, VC2005, and VC2008. I changes the path statement to > point at \python26. Not sure what else I need to do. The docs are > pretty thin on building configurations. > > Here is what I am getting? > > C:\Users\raymond.stewart\Desktop\pywin32-212>setup.py -q build > > Building pywin32 2.5.212.0 > > PyACL.cpp > > C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\specstrings.h(9) > : fatal error C1083: Cannot open include file: 'sal.h': No such file > or directory error: command '"C:\Program Files (x86)\Microsoft Visual > Studio .NET 2003\Vc7\bin\cl.exe"' failed with exit status 2 > You are using the very latest SDK (6001) but an old compiler (Visual Studio 2003). If you read the release notes, you'll see that the 6001 SDK no longer supports Visual Studio 2003. You need to switch to VS2005 or VS2008. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From apocalypse2012 at yahoo.com Mon Jan 5 23:34:56 2009 From: apocalypse2012 at yahoo.com (Raymond Stewart) Date: Mon, 5 Jan 2009 14:34:56 -0800 (PST) Subject: [python-win32] building pywin32 for python 2.6... In-Reply-To: <49628335.4080506@probo.com> References: <51609.85965.qm@web56807.mail.re3.yahoo.com> <49628335.4080506@probo.com> Message-ID: <21300900.post@talk.nabble.com> I have VS2003, VS2005, and VS2008 installed. How do I make the setup file use the correct version? Tim Roberts wrote: > > Raymond Stewart wrote: >> >> I am having a hard time building Mark Hammond?s pywin32 extension with >> python 2.6.1. I followed the readme and used the setup.py. I have the >> latest Windows SDK installed, and the Direct X SDK installed as well. >> I am building on Vista. I have both Python 2.5 and 2.6 installed as >> well as VC2003, VC2005, and VC2008. I changes the path statement to >> point at \python26. Not sure what else I need to do. The docs are >> pretty thin on building configurations. >> >> Here is what I am getting? >> >> C:\Users\raymond.stewart\Desktop\pywin32-212>setup.py -q build >> >> Building pywin32 2.5.212.0 >> >> PyACL.cpp >> >> C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\specstrings.h(9) >> : fatal error C1083: Cannot open include file: 'sal.h': No such file >> or directory error: command '"C:\Program Files (x86)\Microsoft Visual >> Studio .NET 2003\Vc7\bin\cl.exe"' failed with exit status 2 >> > > You are using the very latest SDK (6001) but an old compiler (Visual > Studio 2003). If you read the release notes, you'll see that the 6001 > SDK no longer supports Visual Studio 2003. You need to switch to VS2005 > or VS2008. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- View this message in context: http://www.nabble.com/building-pywin32-for-python-2.6...-tp21299342p21300900.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From mcgooly at yahoo.com Tue Jan 6 14:46:16 2009 From: mcgooly at yahoo.com (Brad Posthumus) Date: Tue, 6 Jan 2009 05:46:16 -0800 (PST) Subject: [python-win32] Multiple Extraction - ArcGIS9.2 Message-ID: <134075.96860.qm@web50904.mail.re2.yahoo.com> Bikash, ESRI has a great user forum for any ArcGIS scripting questions you may have. Try posting your question here: http://forums.esri.com/forums.asp?c=93 in the "ArcGIS Desktop - Geoprocessing Scripting" forum topic. From a quick glance, your script requires three arguments: an input workspace, the mask dataset, and an output workspace. From your error message it appears you are providing four arguments which do not match with script requirements: two TIFF files, a shapefile, and a pound (#) sign which needs to be identified within the script as "use the default" (which it isn't). This will be the first cause of your error message, so try changing your arguments to workspaces (directories or geodatabases where contain your rasters) and the mask dataset you plan on using. Brad Posthumus From timr at probo.com Tue Jan 6 19:03:46 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 06 Jan 2009 10:03:46 -0800 Subject: [python-win32] Multiple Extraction - ArcGIS9.2 In-Reply-To: <9a3229810901060749h6b04f11cx13e6fc6413f73726@mail.gmail.com> References: <9a3229810901050526v128563abg86aa0ded967c7ce3@mail.gmail.com> <49625F10.1020003@probo.com> <9a3229810901060749h6b04f11cx13e6fc6413f73726@mail.gmail.com> Message-ID: <49639D02.70706@probo.com> bikash.sherchan at gmail.com wrote: > yes they are really missing and tried to set up as per your > suggestion. but I got the following errors: > > Access is denied. > Error occurred while processing: Python.File > > Access is denied. > Error occurred while processing: .pyw. > > Access is denied. > Error occurred while processing: Python.NoConFile > > For your information, my operating system is windows vista (32bit). > Does it make any difference? You must be running as an "unprivileged user". The "assoc" command has to write to the HKEY_LOCAL_MACHINE part of the registry, which cannot be done as an unprivileged user. Are you absolutely certain Python is installed? If so, you can change your script command line. Right now, it says: C:\EROSIO~1\MULTIE~1.PY 'C:\HfT Thesis_Bikash\thesis data\A2008257NDVI.tif';'C:\HfT Thesis_Bikash\thesis data\A2008273NDVI.tif'" "C:\HfT Thesis_Bikash\thesis data\exactbound_gcs.shp Just change that to invoke the Python interpreter directly, instead of getting it via the extension. Something like this: C:\Python24\Python.exe C:\EROSIO~1\MULTIE~1.PY 'C:\HfT Thesis_Bikash\thesis data\A2008257NDVI.tif';'C:\HfT Thesis_Bikash\thesis data\A2008273NDVI.tif' 'C:\HfT Thesis_Bikash\thesis data\exactbound_gcs.shp' I may have the quoting wrong. You'll have to see what is required by ArcGIS. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From jim.vickroy at noaa.gov Tue Jan 6 20:32:40 2009 From: jim.vickroy at noaa.gov (jim.vickroy at noaa.gov) Date: 6 Jan 2009 12:32:40 -0700 Subject: [python-win32] Windows Service and APPDATA for AUTO startup Message-ID: An HTML attachment was scrubbed... URL: From timr at probo.com Tue Jan 6 22:35:10 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 06 Jan 2009 13:35:10 -0800 Subject: [python-win32] Windows Service and APPDATA for AUTO startup In-Reply-To: References: Message-ID: <4963CE8E.1030103@probo.com> jim.vickroy at noaa.gov wrote: > Hello everyone, > *_ > Background > _* > > 1. I've created a Windows Service that looks for its configuration > data in a sub-folder of/ os.environ['APPDATA']/. > 2. The Service is configured to automatically start after host reboot. > 3. The Service runs successfully when manually started under its > custom (i,e,, not Local System) account. > 4. The Service fails with a /*KeyError: ('APPDATA',)*/ exception > when automatically starting after a host reboot. > > _*Questions*_ > > 1. Is there some configuration procedure I've overlooked for the > custom account the Service runs under? > Is this a custom account you created? Does it actually have a profile (C:\Documents and Settings\Custom User\Application Data)? > 1. Is this use of /os.environ['APPDATA']/ feasible for AUTO-start > Services? If not, what are preferred folders for > application-specific data; my preference is to avoid > /pythonxx\Lib\site-packages\.../ > APPDATA works if the account really does have a profile. If not, one common place is to use a folder in \Program Files. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From skippy.hammond at gmail.com Tue Jan 6 22:59:05 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 07 Jan 2009 08:59:05 +1100 Subject: [python-win32] building pywin32 for python 2.6... In-Reply-To: <51609.85965.qm@web56807.mail.re3.yahoo.com> References: <51609.85965.qm@web56807.mail.re3.yahoo.com> Message-ID: <4963D429.9010204@gmail.com> On 6/01/2009 8:04 AM, Raymond Stewart wrote: > C:\Users\raymond.stewart\Desktop\pywin32-212>setup.py -q build Try explicitly putting the full path to the python 2.6 python.exe on the command-line - I'm guessing '.py' is associated with Python 2.5 (and on Python 2.5 and earlier, you will need to manually install the most recent "Platform SDK"; the ones with the older compilers are too old) Mark From Jim.Vickroy at noaa.gov Tue Jan 6 23:26:24 2009 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue, 06 Jan 2009 15:26:24 -0700 Subject: [python-win32] Windows Service and APPDATA for AUTO startup In-Reply-To: <4963CE8E.1030103@probo.com> References: <4963CE8E.1030103@probo.com> Message-ID: <4963DA90.7030600@noaa.gov> Tim Roberts wrote: > jim.vickroy at noaa.gov wrote: > >> Hello everyone, >> *_ >> Background >> _* >> >> 1. I've created a Windows Service that looks for its configuration >> data in a sub-folder of/ os.environ['APPDATA']/. >> 2. The Service is configured to automatically start after host reboot. >> 3. The Service runs successfully when manually started under its >> custom (i,e,, not Local System) account. >> 4. The Service fails with a /*KeyError: ('APPDATA',)*/ exception >> when automatically starting after a host reboot. >> >> _*Questions*_ >> >> 1. Is there some configuration procedure I've overlooked for the >> custom account the Service runs under? >> >> > > Is this a custom account you created? Does it actually have a profile > (C:\Documents and Settings\Custom User\Application Data)? > Yes, that folder does exist. When started manually (with that account) the Service works; the Service fails, as noted above, when started automatically after reboot. > >> 1. Is this use of /os.environ['APPDATA']/ feasible for AUTO-start >> Services? If not, what are preferred folders for >> application-specific data; my preference is to avoid >> /pythonxx\Lib\site-packages\.../ >> >> > > APPDATA works if the account really does have a profile. If not, one > common place is to use a folder in \Program Files. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From apocalypse2012 at yahoo.com Tue Jan 6 23:36:18 2009 From: apocalypse2012 at yahoo.com (Raymond Stewart) Date: Tue, 6 Jan 2009 14:36:18 -0800 (PST) Subject: [python-win32] building pywin32 for python 2.6... In-Reply-To: <4963D429.9010204@gmail.com> Message-ID: <820100.65660.qm@web56808.mail.re3.yahoo.com> Yes, that's it. I was not actually typing "python" before setup.py.... As a result, instead of resolving to python 2.6 though the PATH assignment, it was resolved with through the windows file association. Does the setup file automatically choose the compiler based on the version of python? It seems so as now the compile is running through VS2008 Express. Next question. The build fails trying to include afxres.h. This is a MFC head. Neither VS2008 or the Windows Platform SDK include MFC library files any more. Is this a deal killer? Do I now need the Full VS2008 Package? Or is something else wrong? Raymond --- On Tue, 1/6/09, Mark Hammond wrote: From: Mark Hammond Subject: Re: [python-win32] building pywin32 for python 2.6... To: apocalypse2012 at yahoo.com Cc: python-win32 at python.org Date: Tuesday, January 6, 2009, 3:59 PM On 6/01/2009 8:04 AM, Raymond Stewart wrote: > C:\Users\raymond.stewart\Desktop\pywin32-212>setup.py -q build Try explicitly putting the full path to the python 2.6 python.exe on the command-line - I'm guessing '.py' is associated with Python 2.5 (and on Python 2.5 and earlier, you will need to manually install the most recent "Platform SDK"; the ones with the older compilers are too old) Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Tue Jan 6 23:52:48 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 7 Jan 2009 09:52:48 +1100 Subject: [python-win32] building pywin32 for python 2.6... In-Reply-To: <820100.65660.qm@web56808.mail.re3.yahoo.com> References: <4963D429.9010204@gmail.com> <820100.65660.qm@web56808.mail.re3.yahoo.com> Message-ID: <022a01c97051$81957f50$84c07df0$@com.au> > Does the setup file automatically choose the compiler based on the > version of python? It seems so as now the compile is running through > VS2008 Express. Yes - you don't need to set a compiler environment - it should "just work". > Next question. The build fails trying to include afxres.h. This is a MFC head. > Neither VS2008 or the Windows Platform SDK include MFC library files any more. > Is this a deal killer? Do I now need the Full VS2008 Package? Or is something > else wrong? It means that pythonwin will not be able to be built, but that's not really a deal-killer - although it might be for the build process! It will probably be necessary to comment that project out from setup.py to allow the rest of the projects to build. MFC and ATL only come with the full version IIUC. Mark --- On Tue, 1/6/09, Mark Hammond wrote: From: Mark Hammond Subject: Re: [python-win32] building pywin32 for python 2.6... To: apocalypse2012 at yahoo.com Cc: python-win32 at python.org Date: Tuesday, January 6, 2009, 3:59 PM On 6/01/2009 8:04 AM, Raymond Stewart wrote: > C:\Users\raymond.stewart\Desktop\pywin32-212>setup.py -q build Try explicitly putting the full path to the python 2.6 python.exe on the command-line - I'm guessing '.py' is associated with Python 2.5 (and on Python 2.5 and earlier, you will need to manually install the most recent "Platform SDK"; the ones with the older compilers are too old) Mark From timr at probo.com Wed Jan 7 00:03:26 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 06 Jan 2009 15:03:26 -0800 Subject: [python-win32] Windows Service and APPDATA for AUTO startup In-Reply-To: <4963DA90.7030600@noaa.gov> References: <4963CE8E.1030103@probo.com> <4963DA90.7030600@noaa.gov> Message-ID: <4963E33E.6040102@probo.com> Jim Vickroy wrote: > Tim Roberts wrote: >> Is this a custom account you created? Does it actually have a profile >> (C:\Documents and Settings\Custom User\Application Data)? >> > Yes, that folder does exist. When started manually (with that > account) the Service works; the Service fails, as noted above, when > started automatically after reboot. Right. Boot-start services do not get environment variables. Those aren't set until session manager runs, which (I believe) doesn't happen until login. You might consider creating an HKEY_LOCAL_MACHINE registry entry to hold the path, then shove the proper value into the registry when the service is installed. Installation should happen during a session. Don't use HKEY_CURRENT_USER, because that doesn't exist until after login, either. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From Jim.Vickroy at noaa.gov Wed Jan 7 03:22:48 2009 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue, 06 Jan 2009 19:22:48 -0700 Subject: [python-win32] Windows Service and APPDATA for AUTO startup In-Reply-To: <4963E33E.6040102@probo.com> References: <4963CE8E.1030103@probo.com> <4963DA90.7030600@noaa.gov> <4963E33E.6040102@probo.com> Message-ID: <496411F8.2040507@noaa.gov> Tim Roberts wrote: > Jim Vickroy wrote: > >> Tim Roberts wrote: >> >>> Is this a custom account you created? Does it actually have a profile >>> (C:\Documents and Settings\Custom User\Application Data)? >>> >>> >> Yes, that folder does exist. When started manually (with that >> account) the Service works; the Service fails, as noted above, when >> started automatically after reboot. >> > > Right. Boot-start services do not get environment variables. Those > aren't set until session manager runs, which (I believe) doesn't happen > until login. > > You might consider creating an HKEY_LOCAL_MACHINE registry entry to hold > the path, then shove the proper value into the registry when the service > is installed. Installation should happen during a session. Don't use > HKEY_CURRENT_USER, because that doesn't exist until after login, either. > > OK, that explains it. Thank-you very much for your assistance. -- jv -------------- next part -------------- An HTML attachment was scrubbed... URL: From romain.gilles at gmail.com Wed Jan 7 15:43:27 2009 From: romain.gilles at gmail.com (Romain Gilles) Date: Wed, 7 Jan 2009 15:43:27 +0100 Subject: [python-win32] frame state test ? Message-ID: Hi, I would like to test the state of a frame because when I try to access the document within the frame I get this error: File "C:\projects\python\webstress\src\webstress.py", line 124, in wait_browser self.ie.poll_while_not_complete() File "c:\projects\python\webstress\src\IEC.py", line 161, in poll_while_not_complete self.poll_while_not_read(frame.document) File "c:\projects\python\webstress\src\IEC.py", line 165, in poll_while_not_read while element.readyState != 'complete' : File "C:\programs\Python26\Lib\site-packages\win32com\client\dynamic.py", line 495, in __getattr__ raise pythoncom.com_error, details com_error: (-2147024891, 'Access is denied.', None, None) 2009-01-07 15:31:42,905,905,(MainThread),webstress,[DEBUG],END :) But I have tried with the readyState property and I think this property does not exist in the IHTMLFrameElement interface... As follow: File "c:\projects\python\webstress\src\IEC.py", line 138, in wait_ready self.poll_while_not_complete(ie_) File "c:\projects\python\webstress\src\IEC.py", line 160, in poll_while_not_complete self.poll_while_not_read(frame) File "c:\projects\python\webstress\src\IEC.py", line 165, in poll_while_not_read while element.readyState != 'complete' : File "C:\programs\Python26\Lib\site-packages\win32com\client\dynamic.py", line 500, in __getattr__ raise AttributeError, "%s.%s" % (self._username_, attr) AttributeError: .readyState If you have any Idea ... Thanks, Romain. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nalli.dinesh at gmail.com Wed Jan 7 23:13:30 2009 From: nalli.dinesh at gmail.com (Nalli Dinesh) Date: Wed, 7 Jan 2009 14:13:30 -0800 Subject: [python-win32] python print statements Message-ID: Hi, python print statements are extensively used in my application for debugging purpose. My application is ready, but I do not want to remove the print statements and at the same time I do not want python interpreter to execute/run the print statements. How can I accomplish this scenario. Thanks in Advance, -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jim.Vickroy at noaa.gov Wed Jan 7 23:27:45 2009 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed, 07 Jan 2009 15:27:45 -0700 Subject: [python-win32] python print statements In-Reply-To: References: Message-ID: <49652C61.7030600@noaa.gov> Nalli Dinesh wrote: > Hi, > > python print statements are extensively used in my application for > debugging purpose. My application is ready, but I do not want to > remove the print statements and at the same time I do not want python > interpreter to execute/run the print statements. How can I accomplish > this scenario. I do not believe this is feasible with *print* statements. This is, however, easily doable using the standard Python /*logging*/ package where you would replace the print statements with calls to the logging function. I use the logging package almost exclusively; I almost never use print statements in my code. As an aside, this is a general Python question (comp.lang.python) not a Python-Windows specific question > > Thanks in Advance, > > > ------------------------------------------------------------------------ > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Thu Jan 8 07:30:22 2009 From: mc at mclaveau.com (Michel Claveau) Date: Thu, 8 Jan 2009 07:30:22 +0100 Subject: [python-win32] python print statements In-Reply-To: References: Message-ID: Hi! 1) Define your print function. Example: def mprint(*par): for i in par: print i, print 2) in your code, replace all 'print' by 'mprint' 3) when you want cancel the print, modify only the mprint function. @-salutations -- Michel Claveau From stevecody at gmail.com Thu Jan 8 08:37:41 2009 From: stevecody at gmail.com (Steve Cody) Date: Thu, 8 Jan 2009 18:37:41 +1100 Subject: [python-win32] Serial port permissions Message-ID: <93beb5450901072337n1421ebfeq60cea82bbb32e3c7@mail.gmail.com> I have an application monitoring and decoding data that arrives at a serial port. I'm using pyserial and everything works fine under Linux. When I attempt to run it on Windows, however, I am denied access to the serial port. The Windows machine is on a corporate domain with all the usual paranoid profile restrictions. I haven't yet tried it on a Windows PC running as admin, or not on a domain (I suspect that there will not be a problem). The serial port works just fine with Hyperterminal and other installed applications. Has anyone come across this before? Are there any alternative serial port libraries that would work? Where should I start in an effort to identify and overcome the root problem? I recognise that it is a bit difficult to diagnose much without the exact error messages. This installation is on a remote island with very little IT support and limited communications and NO, I can't take you there to help me sort it out :) Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From madhubalav at infotechsw.com Thu Jan 8 09:47:24 2009 From: madhubalav at infotechsw.com (Madhubala) Date: Thu, 8 Jan 2009 14:17:24 +0530 Subject: [python-win32] problem in getting handle to submenu of a window's menu Message-ID: <004a01c9716d$ba472b10$2ed58130$@com> Hi, I am trying to access submenu of a menu of a window using win32api .I even tried using win32api in 'c' programming. In both attempts I was not successful. The details are - There is an application which starts three processes when we create process with the main application(*.exe). All the three processes have three main windows. Through program I am trying to access one of the three windows using findwindow (window title) and I am able to get that window handle. Through this window handle I am able to get menu handle. But after this I am not able to get submenu count /item. This is happening to only one window(of one process). The main menu count is coming correct in both python program and 'c' program. But submenu count/items are coming as 0 in both programs though the main menu items are having submenu's. This is not happening with other two windows of processes which are opened simultaneously. All these processes are MDI applications. I am wondering is this menu is of different type ? If so how I can find this type using win32api and how can I access submenu? If the menu is different how it is attached to the main window where in the Microsoft spy tool is giving exactly the same menu handle for this window as what I am getting through program. If we open the application manually and access the menu and submenu it behaves same as any other window applications. I am sending here the c code for review and because of size limit I am not able to send python code . Any help in this regard is highly is appreciated. --------------------------------------------------C program-------------------------------------- #include #include #include void main() { STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); char* p = "C:\\Program Files\\Citect\\CitectSCADA\\Bin\\CTEXPLOR.EXE"; // Start the child process. if( !CreateProcess(p, // No module name (use command line) NULL, // Command line NULL, // Process handle not inheritable NULL, // Thread handle not inheritable FALSE, // Set handle inheritance to FALSE 0, // No creation flags NULL, // Use parent's environment block NULL, // Use parent's starting directory &si, // Pointer to STARTUPINFO structure &pi ) // Pointer to PROCESS_INFORMATION structure ) { printf( "CreateProcess failed (%d)\n", GetLastError() ); return; } Sleep(1000); HWND hWnd; hWnd = FindWindow(NULL,"Citect Graphics Builder"); HMENU hMenu = GetMenu(hWnd); int menuItems = GetMenuItemCount(hMenu); /*GetSystemMenu */ MENUITEMINFO mi; ZeroMemory( &mi, sizeof(mi) ); mi.cbSize = sizeof(mi); mi.fMask = MIIM_SUBMENU|MIIM_DATA|MIIM_TYPE; mi.fType = MFT_STRING ; /*printf("MenuItems: %d", menuItems);*/ GetMenuItemInfo(hMenu,0,TRUE,&mi); for (int i=0;i From vernondcole at gmail.com Thu Jan 8 17:02:07 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 8 Jan 2009 09:02:07 -0700 Subject: [python-win32] python print statements In-Reply-To: References: Message-ID: How about -- if debug: print x or, in a more complex setting, have a "verbose" attribute in each module and -- if self.verbose > 2: print x # so you can have levels of debug printouts ?? -- Vernon Cole On Wed, Jan 7, 2009 at 11:30 PM, Michel Claveau wrote: > Hi! > > 1) Define your print function. Example: > def mprint(*par): > for i in par: > print i, > print > > 2) in your code, replace all 'print' by 'mprint' > > 3) when you want cancel the print, modify only the mprint function. > > @-salutations > -- > Michel Claveau > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From nalli.dinesh at gmail.com Thu Jan 8 19:12:37 2009 From: nalli.dinesh at gmail.com (Nalli Dinesh) Date: Thu, 8 Jan 2009 10:12:37 -0800 Subject: [python-win32] python print statements In-Reply-To: References: Message-ID: Thanks Vernon, Jim, Micheal. I kind of knew the different ways of modelling any python application as you guys have described in your email. I appreciate your inputs though. But I am looking for a different solution. Here is what I am looking at - I do not want to remodel my application at this stage. I have print statements all over the place. I looking at a solution where, without touching the print statements at all, I want to tell the python interpreter to not execute print statements inside my application, when the application is running. Like, is there a way to tell the Python interpreter do not bother to execute print lines in my application. Or is there a way to just define a python builtin variable which dictates executing print statements or not. Hope I am able to describe clearly what solution I am looking for. To my understanding, I do not think any language supports stuff like this. If I am right about it, then we all know to what level of growth all the s/w languages must grow too!!!! On Thu, Jan 8, 2009 at 8:02 AM, Vernon Cole wrote: > How about -- > if debug: print x > or, in a more complex setting, have a "verbose" attribute in each module > and -- > if self.verbose > 2: print x # so you can have levels of debug printouts > ?? > -- > Vernon Cole > > On Wed, Jan 7, 2009 at 11:30 PM, Michel Claveau wrote: > > Hi! > > > > 1) Define your print function. Example: > > def mprint(*par): > > for i in par: > > print i, > > print > > > > 2) in your code, replace all 'print' by 'mprint' > > > > 3) when you want cancel the print, modify only the mprint function. > > > > @-salutations > > -- > > Michel Claveau > > _______________________________________________ > > python-win32 mailing list > > python-win32 at python.org > > http://mail.python.org/mailman/listinfo/python-win32 > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.king at motorola.com Thu Jan 8 20:03:51 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Thu, 8 Jan 2009 19:03:51 -0000 Subject: [python-win32] python print statements In-Reply-To: Message-ID: <8D20BBB55F590E42AADF592A815E861703D257C3@zuk35exm65.ds.mot.com> I don't think anyone's mentioned the python logging package, which is good for general purpose logging. However, since you want to do this without changing all your print statements: In Python 2.x, you can probably reassign sys.stdout. As long as you aren't outputting anything else to stdout, this should probably work (lightly tested): --------------------------------------- import sys class DummyStdout(object): def write(self, text): pass print "sys.stdout is not redirected" sys.stdout = DummyStdout() print "This should not appear" print "Nor should this" # Restore the original stdout again sys.stdout = sys.__stdout__ print "This should appear again now" ---------------------------------------- Instead of the DummyStdout class, you could also try: sys.stdout = open('NUL', 'w') I believe NUL is the Windows equivalent of /dev/null, but I'm not an expert. In Python 3.0, 'print' is a normal function instead of a keyword, so I assume you can replace it like this (untested): ---------------------------------------- import __builtin__ def my_print(*args, **kwargs): pass __builtin__.print = my_print ---------------------------------------- Hope that helps, Simon > -----Original Message----- > From: python-win32-bounces+simon.king=motorola.com at python.org > [mailto:python-win32-bounces+simon.king=motorola.com at python.or > g] On Behalf Of Nalli Dinesh > Sent: 08 January 2009 18:13 > To: Vernon Cole; Jim.Vickroy at noaa.gov > Cc: python-win32 at python.org > Subject: Re: [python-win32] python print statements > > Thanks Vernon, Jim, Micheal. > > I kind of knew the different ways of modelling any python > application as you guys have described in your email. I > appreciate your inputs though. But I am looking for a > different solution. > > Here is what I am looking at - > > I do not want to remodel my application at this stage. I have > print statements all over the place. I looking at a solution > where, without touching the print statements at all, I want > to tell the python interpreter to not execute print > statements inside my application, when the application is > running. Like, is there a way to tell the Python interpreter > do not bother to execute print lines in my application. Or is > there a way to just define a python builtin variable which > dictates executing print statements or not. > > Hope I am able to describe clearly what solution I am looking for. > > To my understanding, I do not think any language supports > stuff like this. If I am right about it, then we all know to > what level of growth all the s/w languages must grow too!!!! > > > On Thu, Jan 8, 2009 at 8:02 AM, Vernon Cole > wrote: > > > How about -- > if debug: print x > or, in a more complex setting, have a "verbose" > attribute in each module and -- > if self.verbose > 2: print x # so you can have > levels of debug printouts > ?? > -- > Vernon Cole > > > On Wed, Jan 7, 2009 at 11:30 PM, Michel Claveau > wrote: > > Hi! > > > > 1) Define your print function. Example: > > def mprint(*par): > > for i in par: > > print i, > > print > > > > 2) in your code, replace all 'print' by 'mprint' > > > > 3) when you want cancel the print, modify only the > mprint function. > > > > @-salutations > > -- > > Michel Claveau > > _______________________________________________ > > python-win32 mailing list > > python-win32 at python.org > > http://mail.python.org/mailman/listinfo/python-win32 > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > > From drobinow at gmail.com Thu Jan 8 20:36:11 2009 From: drobinow at gmail.com (David Robinow) Date: Thu, 8 Jan 2009 14:36:11 -0500 Subject: [python-win32] python print statements In-Reply-To: References: Message-ID: <4eb0089f0901081136l378691fekced4474388738d4a@mail.gmail.com> On Thu, Jan 8, 2009 at 1:12 PM, Nalli Dinesh wrote: > I do not want to remodel my application at this stage. I have print > statements all over the place. I looking at a solution where, without > touching the print statements at all, I want to tell the python interpreter > to not execute print statements inside my application, when the application > is running. Like, is there a way to tell the Python interpreter do not > bother to execute print lines in my application. Or is there a way to just > define a python builtin variable which dictates executing print statements > or not. 1) If you find eliminating or modifying all your print statements to be onerous, you really need to look at the tools you are using. This should not take more than a few minutes of your time. 2) You can redirect all your output by redirecting to the null device. If you run from a command line or a batch file, just add "> NL:" to the end of your command. If you run from a shortcut, add it to your Target: box. From vernondcole at gmail.com Thu Jan 8 21:35:53 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 8 Jan 2009 13:35:53 -0700 Subject: [python-win32] python print statements In-Reply-To: References: Message-ID: Well, you can't keep Python from _executing_ the print statements, but you can keep it from displaying the results. Any python object which has a "write" method can be used as target for the "print" statement, so... def test(n): for i in range(n): print 'I is =', i class blackHole(object): def write(self,*args): pass import sys test(3) sys.stdout = blackHole() test(100) print >> sys.stderr, 'It worked!' -- Error messages (which are send to sys.stderr rather than sys.stdout) will still display normally. Vernon Cole On Thu, Jan 8, 2009 at 11:12 AM, Nalli Dinesh wrote: > Thanks Vernon, Jim, Micheal. > > I kind of knew the different ways of modelling any python application as you > guys have described in your email. I appreciate your inputs though. But I am > looking for a different solution. > > Here is what I am looking at - > > I do not want to remodel my application at this stage. I have print > statements all over the place. I looking at a solution where, without > touching the print statements at all, I want to tell the python interpreter > to not execute print statements inside my application, when the application > is running. Like, is there a way to tell the Python interpreter do not > bother to execute print lines in my application. Or is there a way to just > define a python builtin variable which dictates executing print statements > or not. > > Hope I am able to describe clearly what solution I am looking for. > > To my understanding, I do not think any language supports stuff like this. > If I am right about it, then we all know to what level of growth all the s/w > languages must grow too!!!! > > On Thu, Jan 8, 2009 at 8:02 AM, Vernon Cole wrote: >> >> How about -- >> if debug: print x >> or, in a more complex setting, have a "verbose" attribute in each module >> and -- >> if self.verbose > 2: print x # so you can have levels of debug >> printouts >> ?? >> -- >> Vernon Cole >> >> On Wed, Jan 7, 2009 at 11:30 PM, Michel Claveau wrote: >> > Hi! >> > >> > 1) Define your print function. Example: >> > def mprint(*par): >> > for i in par: >> > print i, >> > print >> > >> > 2) in your code, replace all 'print' by 'mprint' >> > >> > 3) when you want cancel the print, modify only the mprint function. >> > >> > @-salutations >> > -- >> > Michel Claveau >> > _______________________________________________ >> > python-win32 mailing list >> > python-win32 at python.org >> > http://mail.python.org/mailman/listinfo/python-win32 >> > >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 > > From adam.pletcher at gmail.com Thu Jan 8 21:46:33 2009 From: adam.pletcher at gmail.com (Adam Pletcher) Date: Thu, 8 Jan 2009 14:46:33 -0600 Subject: [python-win32] imp.load_module problem Message-ID: We've created a Windows app with an embedded Python interpreter (2.6.1). The deployment includes the files for pywin32 on both x86 Release and Debug builds. Since pywin32 isn't formally installed, I found it necessary to manually import a couple modules at startup before others would import correctly. Specifically the code I have to do that: import imp, sys for suffixes in imp.get_suffixes(): if (suffixes[0] == '_d.pyd'): dllSuffix = '_d' # it's Debug break else: dllSuffix = '' # it's Release manualImportModules = ['pywintypes', 'pythoncom'] for modName in manualImportModules: modulePath = r'D:\projects\tool\Python\packages\pywin32_system32\%s%d%d%s.dll' % (modName, sys.version_info[0], sys.version_info[1], dllSuffix) imp.load_module(modName, None, modulePath, ('.dll', 'rb', imp.C_EXTENSION)) I took the meat of that from pywin32_postinstall.py, and it works great in Release builds. However, in Debug build I get the following error on pywintypes: imp.load_module(modName, None, modulePath, ('.dll', 'rb', imp.C_EXTENSION)) ImportError: DLL load failed: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. If it's relevant, the Python DLLs and pywin32 files were built with VS2008 on both configurations. I've searched around for this with no luck. Any suggestions? - Adam From riklaunim at gmail.com Thu Jan 8 22:50:52 2009 From: riklaunim at gmail.com (=?ISO-8859-2?Q?piotr_mali=F1ski?=) Date: Thu, 8 Jan 2009 22:50:52 +0100 Subject: [python-win32] Get file MIME and suggested apps Message-ID: <1f7f7cf70901081350s2764a08avb4ef522e2f041de9@mail.gmail.com> Hi I have to get a file MIME type (better than python contentypes module), and get a list of applications that can open given file (or the default one). I've looked at few win32 modules, and I didn't found anything that could help me (GetBinaryType. GetFileAttributes, GetFileType). Can this be done with pywin32? From skippy.hammond at gmail.com Fri Jan 9 00:44:35 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 09 Jan 2009 10:44:35 +1100 Subject: [python-win32] imp.load_module problem In-Reply-To: References: Message-ID: <49668FE3.4030004@gmail.com> On 9/01/2009 7:46 AM, Adam Pletcher wrote: > imp.load_module(modName, None, modulePath, ('.dll', 'rb', imp.C_EXTENSION)) > ImportError: DLL load failed: The application has failed to start > because its side-by-side configuration is incorrect. Please see the > application event log for more detail. > > If it's relevant, the Python DLLs and pywin32 files were built with > VS2008 on both configurations. > > I've searched around for this with no luck. Any suggestions? You need the full assembly for the debug DLLs installed globally or next to your app. Simply having the .DLLs without the .assembly file and without every DLL referenced in the assembly (there are 3 IIRC) isn't good enough. Cheers, Mark From dbg1000 at gmail.com Fri Jan 9 14:27:59 2009 From: dbg1000 at gmail.com (Ben Gordon) Date: Fri, 09 Jan 2009 08:27:59 -0500 Subject: [python-win32] Casting to interface from different typelib? Message-ID: <496750DF.7090703@gmail.com> Any help here would be appreciated. But I hope I don't kill my odds by having redacting the names of all the (proprietary) libraries involved. (Or by the fact that I'm new to COM.) Anyhow, as part of a collaboration, I'm building a win32 application that uses COM to interact with several proprietary libs, and I do not have access to the sources. I have VBA code (that works) that I am trying to port to python. VBA: ------------------------ Dim pA as TypelibA.InterfaceA Dim pB as TypelibB.InterfaceB Dim othermodule as OtherModule 'After this line, pA points to a new "thingA" Set othermodule as New OtherModule othermodule.generator "thingA", pA 'Cast Set pB = pA msgbox pB.Count() ------------------------ The above code works just fine. The cast ("Set pB = pA") is what seems to be giving me problems when converting to Python: Python: ------------------------ pA = othermodule.generator("thingA") print pA #output: #Now, the "cast" mod = gencache.GetModuleForTypelib(typelibB_CLSID,0x0,1,0) pB = mod.InterfaceB(pA) #Check cast print pB #output: #Looks good? #Test print pB.Count() #Output: pywintypes.com_error: (-2147319765, 'Element not found.', None, None) I have also tried different methods for casting. Most of the others (say, by using the IID directly) give me __repr__'s with nonsensical mixtures, such as "TypelibA.interfaceB", even though interfaceB is only defined in TypelibB. "CastTo" fails because "The interface does not appear in the same library as the object." All casting approaches result in the same "Element not found" error. All I know about InterfaceB is that it is probably a Collection or derived from a Collection. I've read somewhere about issues with "dependent typelibs." Is this what I'm coming up against? Any ideas? Many thanks, -Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.pletcher at gmail.com Fri Jan 9 18:59:17 2009 From: adam.pletcher at gmail.com (Adam Pletcher) Date: Fri, 9 Jan 2009 11:59:17 -0600 Subject: [python-win32] imp.load_module problem In-Reply-To: <49668FE3.4030004@gmail.com> References: <49668FE3.4030004@gmail.com> Message-ID: We don't appear to have any .assembly files, even after building Python or pywin32, so I think I'm missing something. Could you elaborate a bit, Mark? Thanks in advance. - Adam On Thu, Jan 8, 2009 at 5:44 PM, Mark Hammond wrote: > On 9/01/2009 7:46 AM, Adam Pletcher wrote: >> >> imp.load_module(modName, None, modulePath, ('.dll', 'rb', >> imp.C_EXTENSION)) >> ImportError: DLL load failed: The application has failed to start >> because its side-by-side configuration is incorrect. Please see the >> application event log for more detail. >> >> If it's relevant, the Python DLLs and pywin32 files were built with >> VS2008 on both configurations. >> >> I've searched around for this with no luck. Any suggestions? > > You need the full assembly for the debug DLLs installed globally or next to > your app. Simply having the .DLLs without the .assembly file and without > every DLL referenced in the assembly (there are 3 IIRC) isn't good enough. > > Cheers, > > Mark > From skippy.hammond at gmail.com Fri Jan 9 23:49:03 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 10 Jan 2009 09:49:03 +1100 Subject: [python-win32] Casting to interface from different typelib? In-Reply-To: <496750DF.7090703@gmail.com> References: <496750DF.7090703@gmail.com> Message-ID: <4967D45F.2040005@gmail.com> On 10/01/2009 12:27 AM, Ben Gordon wrote: Try something like: > #Now, the "cast" > mod = gencache.GetModuleForTypelib(typelibB_CLSID,0x0,1,0) > pB = mod.InterfaceB(pA) > pB = mod.InterfaceB(pA.QueryInterface(IID_B, pythoncom.IID_IDispatch)) > "CastTo" fails because "The interface does not > appear in the same library as the object." It might also be worth seeing if we can fix that somehow - eg, maybe an optional param allowing the interface and the object itself to be in those different typelibs. Cheers, Mark From skippy.hammond at gmail.com Fri Jan 9 23:51:23 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 10 Jan 2009 09:51:23 +1100 Subject: [python-win32] imp.load_module problem In-Reply-To: References: <49668FE3.4030004@gmail.com> Message-ID: <4967D4EB.6020302@gmail.com> On 10/01/2009 4:59 AM, Adam Pletcher wrote: > We don't appear to have any .assembly files, even after building > Python or pywin32, so I think I'm missing something. Could you > elaborate a bit, Mark? Oops - I misspoke - you are looking for a .assembly file - but it comes with VS rather then being built by the Python build process. Eg, the release version of the manifest looks like: 06/11/2007 09:24 PM 524 Microsoft.VC90.CRT.manifest 06/11/2007 09:23 PM 224,768 msvcm90.dll 07/11/2007 02:19 AM 568,832 msvcp90.dll 07/11/2007 02:19 AM 655,872 msvcr90.dll Cheers, Mark From jeffrey.g.lewis at lmco.com Fri Jan 9 23:56:56 2009 From: jeffrey.g.lewis at lmco.com (Lewis, Jeffrey G) Date: Fri, 09 Jan 2009 17:56:56 -0500 Subject: [python-win32] Quiet Install Available? Message-ID: <22C1715934D00D418D6AA8BD049928EC054DE0A8@emss04m21.us.lmco.com> I am working with Python 2.5.2 and pywin32-212.win32-py2.5.exe. I figured out how to install Python 2.5.2 so that no user interaction is required. Are there command line options available for pywin32-212.win32-py2.5.exe so that it will just go ahead and do the install using all the defaults without any user interaction required? Thanks in advance, Jeff Lewis P.S. Thanks for pywin. It is great stuff. Allowed us to code up Windows services in python! -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Sat Jan 10 10:15:44 2009 From: mc at mclaveau.com (Michel Claveau) Date: Sat, 10 Jan 2009 10:15:44 +0100 Subject: [python-win32] Quiet Install Available? In-Reply-To: <22C1715934D00D418D6AA8BD049928EC054DE0A8@emss04m21.us.lmco.com> References: <22C1715934D00D418D6AA8BD049928EC054DE0A8@emss04m21.us.lmco.com> Message-ID: Hi! Look ActivePython, from Active-State. @-salutations -- Michel Claveau From skippy.hammond at gmail.com Sat Jan 10 23:29:35 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sun, 11 Jan 2009 09:29:35 +1100 Subject: [python-win32] Quiet Install Available? In-Reply-To: <22C1715934D00D418D6AA8BD049928EC054DE0A8@emss04m21.us.lmco.com> References: <22C1715934D00D418D6AA8BD049928EC054DE0A8@emss04m21.us.lmco.com> Message-ID: <4969214F.7050006@gmail.com> On 10/01/2009 9:56 AM, Lewis, Jeffrey G wrote: > I am working with Python 2.5.2 and pywin32-212.win32-py2.5.exe. > > I figured out how to install Python 2.5.2 so that no user interaction is > required. > > Are there command line options available for pywin32-212.win32-py2.5.exe > so that it will just go ahead and do the install using all the defaults > without any user interaction required? The installer is based on the distutils 'bdist_wininst' command which doesn't support such options. However, what should work is to simply unzip the pywin32 directory structure (the .exe should even be readable as a .zip file!) then run "pywin32_postinstall.py -install" to configure everything. Cheers, Mark From dbg1000 at gmail.com Sun Jan 11 07:34:44 2009 From: dbg1000 at gmail.com (Ben Gordon) Date: Sun, 11 Jan 2009 01:34:44 -0500 Subject: [python-win32] Casting to interface from different typelib? In-Reply-To: <4967D45F.2040005@gmail.com> References: <496750DF.7090703@gmail.com> <4967D45F.2040005@gmail.com> Message-ID: <49699304.3020105@gmail.com> Mark, MH> pB = mod.InterfaceB(pA.QueryInterface(IID_B, pythoncom.IID_IDispatch)) Thanks so much for the suggestion. I tried it, but it appears that pA does not provide a QueryInterface method. File "c:\Python25\lib\site-packages\win32com\client\__init__.py", line 454, in __getattr__ raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) AttributeError: '' object has no attribute 'QueryInterface' Does this mean I'm out of luck? MH> It might also be worth seeing if we can fix that somehow - eg, maybe an optional param allowing the interface and the object itself to be in those different typelibs. I'm not sure what magic is involved behind the scenes, but this type of cast seems to be comparatively convenient and nearly transparent in VBA/VB (VB requires an explicit CType call), without the need to lookup CLSIDs/IIDs. Thanks again, -Ben From teekaysoh at gmail.com Sun Jan 11 10:09:21 2009 From: teekaysoh at gmail.com (TK Soh) Date: Sun, 11 Jan 2009 09:09:21 +0000 Subject: [python-win32] incorrect timezone on Windows XP Message-ID: <58b84f8e0901110109g31ee8970j3860d32e433c2f55@mail.gmail.com> Greeting! I am using ActivePython 2.5 on Windows XP SP2 in timezone GMT+0800. Somehow the time.localtime() always gives a timezone value of zero, and same thing on time.timezone. Appreciate if anyone can tell me what I'm missing. TIA. From skippy.hammond at gmail.com Sun Jan 11 23:27:57 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 12 Jan 2009 09:27:57 +1100 Subject: [python-win32] Casting to interface from different typelib? In-Reply-To: <49699304.3020105@gmail.com> References: <496750DF.7090703@gmail.com> <4967D45F.2040005@gmail.com> <49699304.3020105@gmail.com> Message-ID: <496A726D.3010408@gmail.com> On 11/01/2009 5:34 PM, Ben Gordon wrote: > Mark, > > MH> pB = mod.InterfaceB(pA.QueryInterface(IID_B, pythoncom.IID_IDispatch)) > > Thanks so much for the suggestion. I tried it, but it appears that pA > does not provide a QueryInterface method. oops - try pA._oleobj_.QueryInterface(...) > I'm not sure what magic is involved behind the scenes, but this type of > cast seems to be comparatively convenient and nearly transparent in > VBA/VB (VB requires an explicit CType call), without the need to lookup > CLSIDs/IIDs. Yeah - its a little tricky to make it seamless in Python, but the code to CastTo isn't *that* long or hairy, so it should be possible to see what is happening and why. Cheers, Mark From dbg1000 at gmail.com Sun Jan 11 23:37:50 2009 From: dbg1000 at gmail.com (Ben Gordon) Date: Sun, 11 Jan 2009 17:37:50 -0500 Subject: [python-win32] Casting to interface from different typelib? In-Reply-To: <496A726D.3010408@gmail.com> References: <496750DF.7090703@gmail.com> <4967D45F.2040005@gmail.com> <49699304.3020105@gmail.com> <496A726D.3010408@gmail.com> Message-ID: <496A74BE.5050807@gmail.com> Mark, MH> oops - try pA._oleobj_.QueryInterface(...) I just tried that too. Now, the cast "succeeds" as before (according to "print pB"), but the method call ["Count()"] still fails in the same way as before too. I appreciate the help, though! Even if we can't work out a fix, do you have any idea of what could be going wrong? -Ben From skippy.hammond at gmail.com Mon Jan 12 09:17:09 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 12 Jan 2009 19:17:09 +1100 Subject: [python-win32] Casting to interface from different typelib? In-Reply-To: <496A74BE.5050807@gmail.com> References: <496750DF.7090703@gmail.com> <4967D45F.2040005@gmail.com> <49699304.3020105@gmail.com> <496A726D.3010408@gmail.com> <496A74BE.5050807@gmail.com> Message-ID: <496AFC85.8010204@gmail.com> On 12/01/2009 9:37 AM, Ben Gordon wrote: > Mark, > > MH> oops - try pA._oleobj_.QueryInterface(...) > > I just tried that too. Now, the cast "succeeds" as before (according to > "print pB"), but the method call ["Count()"] still fails in the same way > as before too. > > I appreciate the help, though! Even if we can't work out a fix, do you > have any idea of what could be going wrong? Not really :( VB is probably doing everything directly via vtables and skipping IDispatch completely - so maybe comtypes (based on vtypes) will have better luck? Cheers, Mark From vernondcole at gmail.com Mon Jan 12 17:38:54 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 12 Jan 2009 09:38:54 -0700 Subject: [python-win32] Support for ProgresSQL in adodbapi? Message-ID: Dear group: I just got an inkling that it may be of benefit to actively support and test a ProgresSQL interface using adodbapi. (It would aid in getting STORM ported to Python 3.0.) I now test using JET, SQL server, and MySQL. I am seeking input from the group about whether anyone has strong opinions either way whether or not I should do this. Whaddaya think? -- Vernon Cole From cappy2112 at gmail.com Tue Jan 13 01:03:06 2009 From: cappy2112 at gmail.com (Tony Cappellini) Date: Mon, 12 Jan 2009 16:03:06 -0800 Subject: [python-win32] Reading Task Manager-Performance tab values Message-ID: <8249c4ac0901121603j555cb473l9b0fe8723e4e6ab8@mail.gmail.com> Is there an API for reading the values on the Performance Tab in Task Manager on XP? The other option would be to send keystrokes to bring up Taks Manager and take periodic screenshots, then save the images to file. This is not very desireable though. There are times when Task manager doesn't appear for minutes after invoking. From mhammond at skippinet.com.au Tue Jan 13 02:31:19 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 13 Jan 2009 12:31:19 +1100 Subject: [python-win32] how to best use datetime objects in pywin32? Message-ID: <036901c9751e$a6f6f180$f4e4d480$@com.au> Hi all, As we've discussed before, the pywintypes Time object is fairly fundamentally broken. While the next pywin32 build for Python 2.x will still use the old time objects, I think it makes sense for the py3k build to make that switch unconditional from the very first release (its getting much closer now!). I hope to offer a transition plan for 2.x, but not in the next release. I've had some discussions with Jason Coombs, the author of the win32timezone module, about some of this and particularly how win32timezone can help, but we think it worth throwing out here for further discussion: SYSTEMTIME, FILETIME and timezones ---------------------------------- * Windows documents a SYSTEMTIME as explicitly being UTC. It therefore makes sense to me that whenever the win32 API is providing a SYSTEMTIME directly, we will create a datetime object with an explicit UTC timezone. * FILETIMEs are a little less clear; Windows documents that FILETIMEs are sometimes *stored* as UTC and sometimes stored as local time - but experimentation shows that assuming the time was converted to a SYSTEMTIME via FileTimeToSystemTime(), it will always some back as UTC. This is true for NTFS and FAT32 in my experiments, but anyone with direct experience here is urged to speak now! If things were indeed ambiguous, then we may be forced to return a timezone na?ve object here, but that would suck somewhat. For some reason I can't articulate, it makes sense to me that when the API provides a FILETIME object, we return the time with the *local* timezone specified (eg, someone printing a FILETIME may expect to see localtime rather than UTC). On the other hand, I can't see a good reason to *not* simply convert to a SYSTEMTIME and return UTC in all cases, as printing the objects directly isn't really that common. Thoughts? Timezone na?ve objects ---------------------- As described above, pywin32 will always return a "timezone aware" time when we started with a FILETIME or SYSTEMTIME structure. However, we still need to support creating such objects from "time module" compatible integers. When given this "time_t", pywin32 will create a timezone na?ve object. Further, "casual" use of the datetime module almost encourages timezone na?ve objects - datetime.now() and datetime.nowutc() both return timezone na?ve objects. So, my question is: Assuming we want to set a time object into a SYSTEMTIME or FILETIME structure, what should pywin32 do when faced with a timezone na?ve object? I see only 2 options: * Given the SYSTEMTIME assumes UTC and the object is timezone na?ve, the code could fail, refusing the temptation to guess. * Assume that the user knows that they are doing, and just copy the time elements to the structures. In effect, this would be assuming a timezone na?ve object is already in UTC (FILETIMES again may be more complex - if the target was a FILETIME I think we would want to assume whatever timezone we *return* FILETIME objects in - which may be another argument for returning FILETIMEs in UTC) The first seems more attractive (ie, the user may *not* know what they are doing, so forcing them to be explicit actually helps them), but may make life painful (and already is painful for the test suite). Eg, the below would work: >>> t1, t2, t3 = win32api.GetFileTimes("foo") # t1, t2, and t3 all 'tz aware' >>> win32api.SetFileTimes("foo", t1, t2, t2) # works. But this would fail: >>> now = datetime.datetime.now() >>> win32api.SetFileTimes("foo", now, now, now) # fail - now is tz na?ve. instead we would be forcing the user to do something like: >>> import win32timezone >>> now = datetime.datetime.now(tzinfo=win32timezone.GetLocalTimeZone()) # now tz aware... >>> win32api.SetFileTimes("foo", now, now, now) # should work I think the above is more than enough to kick start a discussion, so I'd welcome all thoughts on the above. FYI, I expect to mark the next pywin32 release as experimental/unstable/scary - particularly py3k support - and part of that will be reserving the right to make changes to the datetime support delivered in that first build, which should give us some time to experiment without fully committing to the details. Cheers, Mark From p.f.moore at gmail.com Tue Jan 13 10:37:01 2009 From: p.f.moore at gmail.com (Paul Moore) Date: Tue, 13 Jan 2009 09:37:01 +0000 Subject: [python-win32] how to best use datetime objects in pywin32? In-Reply-To: <036901c9751e$a6f6f180$f4e4d480$@com.au> References: <036901c9751e$a6f6f180$f4e4d480$@com.au> Message-ID: <79990c6b0901130137se004594pa45f3e4626a6b01d@mail.gmail.com> 2009/1/13 Mark Hammond : > So, my question is: Assuming we want to set a time object into a SYSTEMTIME > or FILETIME structure, what should pywin32 do when faced with a timezone > na?ve object? I see only 2 options: > > * Given the SYSTEMTIME assumes UTC and the object is timezone na?ve, the > code could fail, refusing the temptation to guess. > > * Assume that the user knows that they are doing, and just copy the time > elements to the structures. In effect, this would be assuming a timezone > na?ve object is already in UTC (FILETIMES again may be more complex - if the > target was a FILETIME I think we would want to assume whatever timezone we > *return* FILETIME objects in - which may be another argument for returning > FILETIMEs in UTC) Is there a reason you don't see assuming a timezone of win32timezone.GetLocalTimeZone() as a reasonable option? It seems like the right thing to do to me. (If the user is using timzone-naive objects, they are probably naive about timezones, and hence likely to be assuming that the "local" timezone applies). This can be as simple as val = val.replace(tzinfo=win32timezone.GetLocalTimeZone()) I'm not keen on giving an error - your example of using SetTimes to set one or more file times to now is a good example, as a user I'd find an error both confusing and (once I understood it) somewhat annoying (as I'd probably still forget every time!). On the other hand, UTC seems a bad default - probably worse for people like me in the UK, who would write programs that looked correct all winter, and would then have to fix them all in March :-) > The first seems more attractive (ie, the user may *not* know what they are > doing, so forcing them to be explicit actually helps them), but may make > life painful (and already is painful for the test suite). If my 3rd option above isn't reasonable for some reason, I'd vote for the first option, simply because the bugs caused by the second would be so subtle and easily missed. Paul. From mail at timgolden.me.uk Tue Jan 13 10:56:23 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 13 Jan 2009 09:56:23 +0000 Subject: [python-win32] Reading Task Manager-Performance tab values In-Reply-To: <8249c4ac0901121603j555cb473l9b0fe8723e4e6ab8@mail.gmail.com> References: <8249c4ac0901121603j555cb473l9b0fe8723e4e6ab8@mail.gmail.com> Message-ID: <496C6547.9070904@timgolden.me.uk> Tony Cappellini wrote: > Is there an API for reading the values on the Performance Tab in Task > Manager on XP? Without being 100% sure, I would imagine that WMI could pull them out for you. However, there isn't -- afaik -- a "Task Manager API" where you could be guaranteed of getting the selfsame figures which are showing in the Performance tab: you'd simply have to work out what those numbers / graphs represent and find the equivalent WMI classes. The functions in the win32pdh module are, I think, what the WMI Win32_Perf... classes use under the covers, so you could go that way if you wanted to. This chaps' been blogging on what seems to be a related subject recently; maybe that helps: http://coreygoldberg.blogspot.com/2008/12/python-windows-remote-metrics-script.html TJG From vernondcole at gmail.com Tue Jan 13 18:18:35 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 13 Jan 2009 10:18:35 -0700 Subject: [python-win32] how to best use datetime objects in pywin32? In-Reply-To: <79990c6b0901130137se004594pa45f3e4626a6b01d@mail.gmail.com> References: <036901c9751e$a6f6f180$f4e4d480$@com.au> <79990c6b0901130137se004594pa45f3e4626a6b01d@mail.gmail.com> Message-ID: Great work, Jason! Maybe this would be a good time for a feature request. I am a fanatic about operating system independent code, which is weird because all of my open source code contributions are Windows specific. Go figure. First, let me say that I like Paul's third option the best. When I am using time in a "casual" manner, my mental framework is always local. If the time says "noon" I would expect to look out the window and find that the sun was somewhere near the middle of the sky. Similarly, I would expect my naive file times to be in local terms. Second, I am frustrated with the fact that Python's datetime implementation is incomplete, since it lacks any standard way of getting a time-zone-aware local time. It it truely mind boggling that even datetime.datetime.utcnow() is time zone naive! If I specifically ask for "utc" am I not specifying a time zone?! Mark said that "the datetime module almost encourages timezone na?ve objects." I would say that it almost _forces_ it, since tzinfo objects are difficult to construct. The only way I found to approximate my local timezone was to go back to the old "time" module like "delta = datetime.timedelta(seconds=time.timezone)". So, I am delighted that I am now able to say: now = datetime.datetime.now(win32timezone.GetLocalTimeZone()) [note: "tzinfo=" is superfluous] My suggestion is this: Let's make a module with a non-Windows-specific name (and provide for a posix version of it also) so that I can write system independent code. Also, it would be nice if the name were not quite so verbose. In my ideal world, little typing should be required to do common things. I would like to see something like: >>>herenow = datetime.datetime.now(timezone.local) >>>gmt = datetime.datetime.now(timezone.utc) so, using Paul's suggestion: >>>now = datetime.datetime.now() >>>win32api.SetFileTimes("foo", now, now, now) and: >>>.win32api.SetFileTimes("foo", herenow, herenow, herenow) and: >>>win32api.SetFileTimes("foo", gmt, gmt, gmt) would give the (approximately) same result. -- Vernon Cole On Tue, Jan 13, 2009 at 2:37 AM, Paul Moore wrote: > 2009/1/13 Mark Hammond : >> So, my question is: Assuming we want to set a time object into a SYSTEMTIME >> or FILETIME structure, what should pywin32 do when faced with a timezone >> na?ve object? I see only 2 options: >> >> * Given the SYSTEMTIME assumes UTC and the object is timezone na?ve, the >> code could fail, refusing the temptation to guess. >> >> * Assume that the user knows that they are doing, and just copy the time >> elements to the structures. In effect, this would be assuming a timezone >> na?ve object is already in UTC (FILETIMES again may be more complex - if the >> target was a FILETIME I think we would want to assume whatever timezone we >> *return* FILETIME objects in - which may be another argument for returning >> FILETIMEs in UTC) > > Is there a reason you don't see assuming a timezone of > win32timezone.GetLocalTimeZone() as a reasonable option? It seems like > the right thing to do to me. (If the user is using timzone-naive > objects, they are probably naive about timezones, and hence likely to > be assuming that the "local" timezone applies). This can be as simple > as > > val = val.replace(tzinfo=win32timezone.GetLocalTimeZone()) > > I'm not keen on giving an error - your example of using SetTimes to > set one or more file times to now is a good example, as a user I'd > find an error both confusing and (once I understood it) somewhat > annoying (as I'd probably still forget every time!). On the other > hand, UTC seems a bad default - probably worse for people like me in > the UK, who would write programs that looked correct all winter, and > would then have to fix them all in March :-) > >> The first seems more attractive (ie, the user may *not* know what they are >> doing, so forcing them to be explicit actually helps them), but may make >> life painful (and already is painful for the test suite). > > If my 3rd option above isn't reasonable for some reason, I'd vote for > the first option, simply because the bugs caused by the second would > be so subtle and easily missed. > > Paul. > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From jaraco at jaraco.com Tue Jan 13 19:57:49 2009 From: jaraco at jaraco.com (Jason R. Coombs) Date: Tue, 13 Jan 2009 11:57:49 -0700 Subject: [python-win32] how to best use datetime objects in pywin32? In-Reply-To: References: <036901c9751e$a6f6f180$f4e4d480$@com.au> <79990c6b0901130137se004594pa45f3e4626a6b01d@mail.gmail.com> Message-ID: <750B64C66078B34D918257A1AC004DB20547CA@messiah.jaraco.com> Thanks for the words of encouragement. > -----Original Message----- > From: Vernon Cole [mailto:vernondcole at gmail.com] > Sent: Tuesday, 13 January, 2009 12:19 > > Second, I am frustrated with the fact that Python's datetime > implementation is incomplete, since it lacks any standard way of > getting a time-zone-aware local time. It it truely mind boggling that > even datetime.datetime.utcnow() is time zone naive! If I specifically > ask for "utc" am I not specifying a time zone?! Mark said that "the > datetime module almost encourages timezone na?ve objects." I would say > that it almost _forces_ it, since tzinfo objects are difficult to > construct. The only way I found to approximate my local timezone was > to go back to the old "time" module like "delta = > datetime.timedelta(seconds=time.timezone)". The reason datetime doesn't provide timezone aware calls is because it explicitly refuses to provide a tz implementation. I was a little surprised by this decision at first, but I realized later why this was a good idea. Because there is no authoritative database of timezone data, they would be hard pressed to provide a "best of breed" solution for a default timezone implementation. By leaving the spec open, they left functionality lacking, but also drove others like us to implement various implementations with their various strengths and weaknesses. > > So, I am delighted that I am now able to say: > now = datetime.datetime.now(win32timezone.GetLocalTimeZone()) > [note: "tzinfo=" is superfluous] Please note that the current implementation of GetLocalTimeZone is fairly costly, parsing through the entire registry of time zones to find the correct one. A future implementation will drastically limit this cost. > My suggestion is this: > Let's make a module with a non-Windows-specific name (and provide for > a posix version of it also) so that I can write system independent > code. I've heard this request before, but the library is build on the assumption that the win32apis are available. I would say it's out of scope for this library to determine the local time zone for other platforms. That said, I find cross-platform compatibility very attractive. I did some looking into it, and I think the problem would be quite challenging. That is, the logic for getting the local time on Linux is different from Mac, and both are quite different from Windows. Separate libraries would be necessary to handle the various cases. I'm happy to provide a compatible interface such that one could opt to use win32timezone if the OS is Windows and choose the compatible library otherwise, but I feel the effort to include Linux and Mac support would be as much effort as the original library. Still, I may consider it at some point. > Also, it would be nice if the name were not quite so verbose. In > my ideal world, little typing should be required to do common things. > I would like to see something like: > > >>>herenow = datetime.datetime.now(timezone.local) > >>>gmt = datetime.datetime.now(timezone.utc) I assume you meant "gmt = datetime.datetime.utcnow(timezone.utc)" What about instead >>> timezone.now() And >>> timezone.utcnow() Both of which call the respective functions in datetime.datetime and attach the appropriate timezone? Jason -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 6998 bytes Desc: not available URL: From mhammond at skippinet.com.au Wed Jan 14 04:07:43 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 14 Jan 2009 14:07:43 +1100 Subject: [python-win32] how to best use datetime objects in pywin32? In-Reply-To: <79990c6b0901130137se004594pa45f3e4626a6b01d@mail.gmail.com> References: <036901c9751e$a6f6f180$f4e4d480$@com.au> <79990c6b0901130137se004594pa45f3e4626a6b01d@mail.gmail.com> Message-ID: <03ac01c975f5$49a97750$dcfc65f0$@com.au> Thanks for the comments Paul. > Is there a reason you don't see assuming a timezone of > win32timezone.GetLocalTimeZone() as a reasonable option? Not really - I think I was just looking at it from the POV of the win32 structures. You make a good case for using the local time, but there may still be some rough edges... > It seems like > the right thing to do to me. (If the user is using timzone-naive > objects, they are probably naive about timezones, and hence likely to > be assuming that the "local" timezone applies). My proposal was to always *return* tz-aware datetime objects in a UTC time-zone. In some cases this will force such people to become tz-aware, but such people are still likely to be surprised to see the times printed in UTC - some may even conclude that a UTC na?ve time is indeed required - eg: >>> win32file.GetFileTime(handle) >> now = datetime.datetime.utcnow() On the other hand, as I've mentioned to Jason, I'm reluctant to cache the result value of GetLocalTimeZone() in sight of long-running processes running during a transition - although Jason has recently made the implementation more light-weight, there is still *some* registry work which I'd like to avoid for each and every time object we return. Caching UTC appears to be reasonable though. Maybe I'm just doing too much premature optimization? Or maybe concerned over nothing and always returning tz-aware UTC while assuming "local time" for non-tzaware objects wouldn't cause confusion (or at least only short-term confusion gaining knowledge they ultimately need anyway)? A final option is worth throwing out even though I don't think I like it much: return objects in either UTC or local time depending on how performance critical it is likely to be. eg, COM and ODBC would probably want the fast UTC, while GetFileTime(), which operates on a single file, probably isn't really that critical - but win32api.FindFiles probably *is* (eg, listing a huge directory) - mqking things somewhat arbitrary in practice. Responding to Jason's other idea: I think it makes perfect sense for win32timezone to expose now and utcnow functions. Cheers, Mark From mdriscoll at co.marshall.ia.us Fri Jan 16 16:34:15 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Fri, 16 Jan 2009 09:34:15 -0600 Subject: [python-win32] SetWindowTheme for Vista Message-ID: <4970A8F7.2060004@co.marshall.ia.us> Hi, There has been a discussion on the wxPython user's group about how the new QT licensing will affect wx's viability. They got slightly off-topic and pointed out that the wx treectrl isn't wrapping Vista's theme like it should. They pointed to this article on setting the window theme: http://www.danielmoth.com/Blog/2007/01/treeviewvista.html Is there a way to call SetWindowTheme in pywin32? I'm not sure if this would affect wx anyway, but I don't mind trying it out if I knew how to call it. Thanks. Mike From simon.king at motorola.com Fri Jan 16 16:52:57 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 16 Jan 2009 15:52:57 -0000 Subject: [python-win32] SetWindowTheme for Vista In-Reply-To: <4970A8F7.2060004@co.marshall.ia.us> Message-ID: <8D20BBB55F590E42AADF592A815E861703D766F2@zuk35exm65.ds.mot.com> > -----Original Message----- > From: python-win32-bounces+simon.king=motorola.com at python.org > [mailto:python-win32-bounces+simon.king=motorola.com at python.or > g] On Behalf Of Mike Driscoll > Sent: 16 January 2009 15:34 > To: Python-Win32 List > Subject: [python-win32] SetWindowTheme for Vista > > Hi, > > There has been a discussion on the wxPython user's group > about how the > new QT licensing will affect wx's viability. They got slightly > off-topic and pointed out that the wx treectrl isn't wrapping Vista's > theme like it should. They pointed to this article on setting > the window > theme: http://www.danielmoth.com/Blog/2007/01/treeviewvista.html > > Is there a way to call SetWindowTheme in pywin32? I'm not > sure if this > would affect wx anyway, but I don't mind trying it out if I > knew how to > call it. > > Thanks. > > Mike I don't know about pywin32, but it looks like you can at least access the function via ctypes: >>> import ctypes >>> ctypes.windll.UxTheme.SetWindowTheme <_FuncPtr object at 0x00C96198> Simon From ricozinn at gmail.com Sat Jan 17 02:35:50 2009 From: ricozinn at gmail.com (Richard Zinn) Date: Fri, 16 Jan 2009 17:35:50 -0800 Subject: [python-win32] Python Service error 1053: the service did not respond to the start or control request in a timely fashion Message-ID: <496eec030901161735t74e71de4r6f92cbb7d0e10ee4@mail.gmail.com> Hi, I've implemented the MyService.py example from the py2exe samples directory using Python2.6, on my Windows XP SP2, and I get the error 1052...did not respond in a timely fashion immediately when I run the MyService.py, or the MyService.exe, or if I install it as a service using an NSIS installer script I wrote, and start it using the windows service manager. Any ideas? Here is the code reduced to just the essentials: import win32serviceutil import win32service import win32event import win32evtlogutil class MyService(win32serviceutil.ServiceFramework): _svc_name_ = "MyService" _svc_display_name_ = "My Service" _svc_deps_ = ["EventLog"] def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) def SvcDoRun(self): import servicemanager log("running") win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) log("stopped") if __name__ == '__main__': win32serviceutil.HandleCommandLine(MyService) I've seen other posters with similar problems, but with theirs it doesn't work in the .exe, but in my case it doesn't work when I run the .py either. The traceback in python says: > python MyService.py Collecting Python Trace Output... Traceback (most recent call last): File "C:\Python26\Lib\site-packages\win32\lib\win32serviceutil.py", line 399, in StartService win32service.StartService(hs, args) pywintypes.error: (1053, 'StartService', 'The service did not respond to the sta rt or control request in a timely fashion.') Thanks in advance, Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: From evilgordita at cox.net Sat Jan 17 03:31:50 2009 From: evilgordita at cox.net (Robert O'Connor) Date: Fri, 16 Jan 2009 21:31:50 -0500 Subject: [python-win32] Python Service error 1053: the service did notrespond to the start or control request in a timely fashion References: <496eec030901161735t74e71de4r6f92cbb7d0e10ee4@mail.gmail.com> Message-ID: <611DF063A0B14A5694AC73BB9006C3F1@Jerry> From: "Richard Zinn" > Hi, I've implemented the MyService.py example from the py2exe samples > directory using Python2.6, on my Windows XP SP2, and I get the error > 1052...did not respond in a timely fashion immediately when I run the > MyService.py, or the MyService.exe, or if I install it as a service using > an > NSIS installer script I wrote, and start it using the windows service > manager. > Any ideas? Here is the code reduced to just the essentials: > > import win32serviceutil > import win32service > import win32event > import win32evtlogutil > > class MyService(win32serviceutil.ServiceFramework): > _svc_name_ = "MyService" > _svc_display_name_ = "My Service" > _svc_deps_ = ["EventLog"] > def __init__(self, args): > win32serviceutil.ServiceFramework.__init__(self, args) > self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) > > def SvcStop(self): > self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) > win32event.SetEvent(self.hWaitStop) > > def SvcDoRun(self): > import servicemanager > log("running") > > win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) > log("stopped") > > if __name__ == '__main__': > win32serviceutil.HandleCommandLine(MyService) > > I've seen other posters with similar problems, but with theirs it doesn't > work in the .exe, but in my case it doesn't work when I run the .py > either. > The traceback in python says: >> python MyService.py > > Collecting Python Trace Output... > Traceback (most recent call last): > File "C:\Python26\Lib\site-packages\win32\lib\win32serviceutil.py", line > 399, > in StartService > win32service.StartService(hs, args) > pywintypes.error: (1053, 'StartService', 'The service did not respond to > the > sta > rt or control request in a timely fashion.') > > > Thanks in advance, > Richard If SvcDoRun is run in it's own thread, then I suspect the import residing inside that function. If I remember correctly, Python's import mechanism causes the thread where the import takes place to deadlock, so you should always perform an import inside your main thread. Try importing servicemanager from the top of your script, instead of inside of SvcDoRun. Then your example should start throwing exceptions because it can't find 'log.' :-) From mhammond at skippinet.com.au Sun Jan 18 03:41:30 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 18 Jan 2009 13:41:30 +1100 Subject: [python-win32] Python Service error 1053: the service did not respond to the start or control request in a timely fashion In-Reply-To: <496eec030901161735t74e71de4r6f92cbb7d0e10ee4@mail.gmail.com> References: <496eec030901161735t74e71de4r6f92cbb7d0e10ee4@mail.gmail.com> Message-ID: Don't execute the service without args. You generally want: MyService install MyService start ... MyService stop Although the 'start' and 'stop' is *normally* done simply by setting the 'auto-start' properties of the service. Cheers, Mark On Sat, Jan 17, 2009 at 12:35 PM, Richard Zinn wrote: > > Hi, I've implemented the MyService.py example from the py2exe samples directory using Python2.6, on my Windows XP SP2, and I get the error 1052...did not respond in a timely fashion immediately when I run the MyService.py, or the MyService.exe, or if I install it as a service using an NSIS installer script I wrote, and start it using the windows service manager. > Any ideas? Here is the code reduced to just the essentials: > import win32serviceutil > import win32service > import win32event > import win32evtlogutil > class MyService(win32serviceutil.ServiceFramework): > _svc_name_ = "MyService" > _svc_display_name_ = "My Service" > _svc_deps_ = ["EventLog"] > def __init__(self, args): > win32serviceutil.ServiceFramework.__init__(self, args) > self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) > def SvcStop(self): > self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) > win32event.SetEvent(self.hWaitStop) > def SvcDoRun(self): > import servicemanager > log("running") > win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) > log("stopped") > > if __name__ == '__main__': > win32serviceutil.HandleCommandLine(MyService) > > I've seen other posters with similar problems, but with theirs it doesn't work in the .exe, but in my case it doesn't work when I run the .py either. The traceback in python says: > > python MyService.py > Collecting Python Trace Output... > Traceback (most recent call last): > File "C:\Python26\Lib\site-packages\win32\lib\win32serviceutil.py", line 399, > in StartService > win32service.StartService(hs, args) > pywintypes.error: (1053, 'StartService', 'The service did not respond to the sta > rt or control request in a timely fashion.') > > Thanks in advance, > Richard > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From yaron.charka at gmail.com Sun Jan 18 12:26:05 2009 From: yaron.charka at gmail.com (Yaron Charka) Date: Sun, 18 Jan 2009 13:26:05 +0200 Subject: [python-win32] Problems installing pywin32 Message-ID: <865deba20901180326y100e3913oe98f21d8a4ebf2f@mail.gmail.com> Hi, I'm trying to install pywin32 on an XP machine. I was first requested to install vs2003 which I couldn't find. Installing vs2008 didn't solve the problem either. I tried another way and installed mingw32. That seemed to take me a bit further, but not so much... When I run setup.py with build -c migw32 I get a long list of error messages starting with: Building pywin32 2.5.212.0 running build running build_py running build_ext Found version 0x600 in C:\Program Files\\Microsoft SDKs\Windows\v6.0A\include\SDKDDKVER.H Skipping pywintypes: No library 'advapi32' Skipping perfmondata: No library 'advapi32' building 'dbi' extension gcc.exe -mno-cygwin -mdll -O -Wall -DDISTUTILS_BUILD -Icom/win32com/src/include -Iwin32/src -IC:\Python25\include -IC:\Python25\PC "-IC:\Program Files\\Microsoft SDKs\Windows\v6.0A\include" -c win32\src\dbi.cpp -o build\temp.win32-2.5\Release\win32\src\dbi.o In file included from win32\src\dbi.cpp:14: win32\src\pywintypes.h:16: warning: ignoring #pragma warning In file included from C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:28, from C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/windef.h:177, from /mingw/lib/gcc/mingw32/3.4.5/../../../../include/excpt.h:20, from C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/windows.h:151, from win32\src\pywintypes.h:21, from win32\src\dbi.cpp:14: C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/specstrings.h:9:19: sal.h: No such file or directory In file included from C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/specstrings.h:267, from C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:28, from C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/windef.h:177, from /mingw/lib/gcc/mingw32/3.4.5/../../../../include/excpt.h:20, from C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/windows.h:151, from win32\src\pywintypes.h:21, from win32\src\dbi.cpp:14: C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/specstrings_adt.h:16: error: expected initializer before "char" C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/specstrings_adt.h:17: error: expected initializer before "unsigned" C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/specstrings_adt.h:18: error: expected initializer before "const" C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/specstrings_adt.h:19: error: expected initializer before "char" C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/specstrings_adt.h:20: error: expected initializer before "const" In file included from C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/windef.h:177, from /mingw/lib/gcc/mingw32/3.4.5/../../../../include/excpt.h:20, from C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/windows.h:151, from win32\src\pywintypes.h:21, from win32\src\dbi.cpp:14: C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:297: error: `__nullterminated' does not name a type C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:298: error: `__nullterminated' does not name a type C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:299: error: expected initializer before "const" C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:300: error: `__nullterminated' does not name a type C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:301: error: expected initializer before "const" C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:302: error: `__nullterminated' does not name a type C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:303: error: expected initializer before "const" C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:356: error: `__nullterminated' does not name a type C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:357: error: `__nullterminated' does not name a type C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:358: error: expected initializer before "const" C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:359: error: expected initializer before "const" C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:360: error: `__nullterminated' does not name a type C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:390: error: `LPSTR' does not name a type C:/Program Files//Microsoft SDKs/Windows/v6.0A/include/winnt.h:391: error: `LPCSTR' does not name a type There's much much more of these, but I hope it would be enough for you to give me that right direction. Thanks in advance, Yaron -------------- next part -------------- An HTML attachment was scrubbed... URL: From sjmachin at lexicon.net Sun Jan 18 13:53:54 2009 From: sjmachin at lexicon.net (John Machin) Date: Sun, 18 Jan 2009 23:53:54 +1100 Subject: [python-win32] [Fwd: Re: Problems installing pywin32] Message-ID: <49732662.8040309@lexicon.net> my reply to the OP went him alone, not the list ... sorry. -------------- next part -------------- An embedded message was scrubbed... From: Yaron Charka Subject: Re: [python-win32] Problems installing pywin32 Date: Sun, 18 Jan 2009 14:46:16 +0200 Size: 5259 URL: From mhammond at skippinet.com.au Mon Jan 19 00:20:49 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 19 Jan 2009 10:20:49 +1100 Subject: [python-win32] Problems installing pywin32 In-Reply-To: <865deba20901180326y100e3913oe98f21d8a4ebf2f@mail.gmail.com> References: <865deba20901180326y100e3913oe98f21d8a4ebf2f@mail.gmail.com> Message-ID: On Sun, Jan 18, 2009 at 10:26 PM, Yaron Charka wrote: > I'm trying to install pywin32 on an XP machine. In that case you should just grab a binary from sourceforge. > I was first requested to install vs2003 which I couldn't find. Installing > vs2008 didn't solve the problem either. pywin32 is only supported using the same compiler used by Python itself. mingw is not supported, VS2008 isn't supported for anything other than Python 2.6, vs2003 for Python 2.4/2.5, etc. The free editions of those compilers can generally be used, but IIUC pythonwin will not be able to be built... Cheers, Mark From le.dahut at laposte.net Mon Jan 19 15:35:13 2009 From: le.dahut at laposte.net (le dahut) Date: Mon, 19 Jan 2009 15:35:13 +0100 Subject: [python-win32] User transparent authentication with PDC Message-ID: <49748FA1.10303@laposte.net> Hello, I've written a python network app in which the server runs on a Samba-PDC (NT Domain controler) and the client on the windows NTdomain clients. I want to authenticate the connexions to the python server using a transparent method. Is there a way to get a user NTdomain authentication token and give it back to the python-server so that it can validate it against the PDC ? Thanks. From jeffrey.g.lewis at lmco.com Mon Jan 19 21:23:22 2009 From: jeffrey.g.lewis at lmco.com (Lewis, Jeffrey G) Date: Mon, 19 Jan 2009 15:23:22 -0500 Subject: [python-win32] Quiet Install Available? In-Reply-To: <4969214F.7050006@gmail.com> References: <22C1715934D00D418D6AA8BD049928EC054DE0A8@emss04m21.us.lmco.com> <4969214F.7050006@gmail.com> Message-ID: <22C1715934D00D418D6AA8BD049928EC057B108A@emss04m21.us.lmco.com> Mark, Thanks for the quick reply to my original post. I ran into some gotchas trying your suggested approach, but at this point we've found a completely different way to install the python-windows extensions without user interaction (using a program available from Microsoft called scriptit). I thought I would just pass on the problems I ran into in case anybody else heads down this path. I was able to work around WinZip not accepting the .exe file as a zip file (I renamed the .exe to .zip) - I wrote a little bit of python script to unzip it. But there was no Removepywin32.exe after unzipping, and when I tried to run the pywin32_postinstall.py I got an error pop-up saying: The application or DLL C:\h\PYTHON\Lib\site-packages\pywin32_system32\pywintypes25.dll is not a valid Windows image. Please check this against your installation diskette. Thanks again for your quick response, and thank you very much for the extensions! Jeff > -----Original Message----- > From: Mark Hammond [mailto:skippy.hammond at gmail.com] > Sent: Saturday, January 10, 2009 5:30 PM > To: Lewis, Jeffrey G > Cc: python-win32 at python.org > Subject: Re: [python-win32] Quiet Install Available? > > On 10/01/2009 9:56 AM, Lewis, Jeffrey G wrote: > > I am working with Python 2.5.2 and pywin32-212.win32-py2.5.exe. > > > > I figured out how to install Python 2.5.2 so that no user interaction > is > > required. > > > > Are there command line options available for pywin32-212.win32- > py2.5.exe > > so that it will just go ahead and do the install using all the > defaults > > without any user interaction required? > > The installer is based on the distutils 'bdist_wininst' command which > doesn't support such options. However, what should work is to simply > unzip the pywin32 directory structure (the .exe should even be readable > as a .zip file!) then run "pywin32_postinstall.py -install" to > configure > everything. > > Cheers, > > Mark From skippy.hammond at gmail.com Mon Jan 19 23:33:33 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 20 Jan 2009 09:33:33 +1100 Subject: [python-win32] User transparent authentication with PDC In-Reply-To: <49748FA1.10303@laposte.net> References: <49748FA1.10303@laposte.net> Message-ID: <4974FFBD.3000703@gmail.com> On 20/01/2009 1:35 AM, le dahut wrote: > Hello, > I've written a python network app in which the server runs on a > Samba-PDC (NT Domain controler) and the client on the windows NTdomain > clients. > > I want to authenticate the connexions to the python server using a > transparent method. > > Is there a way to get a user NTdomain authentication token and give it > back to the python-server so that it can validate it against the PDC ? Look for the 'sspi' functions and demos, particularly the win32\demos\security\sspi directory. Cheers, Mark From ricozinn at gmail.com Tue Jan 20 00:26:05 2009 From: ricozinn at gmail.com (Richard Zinn) Date: Mon, 19 Jan 2009 15:26:05 -0800 Subject: [python-win32] Dispatching a win32com from within a win32service Message-ID: <496eec030901191526p1b520a6jf12ca02b667123f6@mail.gmail.com> Hi, I've got an python app that I'm trying to access the iTunes com API with, and this app runs as a Windows service. When I run it I get these GetGoodDispatchAndUserName errors. I think it ends up being related to the service not having security access to the Com interface? I've tried setting the --username --password params when I start the service like so: python MyService.py --username abc --password xyz start The instance's SvcRun() method failed File "C:\Python26\Lib\site-packages\win32\lib\win32serviceutil.py", line 805, in SvcRun self.SvcDoRun() File "C:\MyService\MyService.py", line 54, in SvcDoRun itnes = win32com.client.Dispatch("iTunes.Application") File "C:\Python26\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python26\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python26\lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) : (-2146959355, 'Server execution failed', None, None) Here is the slimmed down source code: import win32com.client import win32serviceutil import win32service import time import win32event import win32evtlogutil import win32api import win32traceutil import servicemanager logger = file("C:\log.txt","a+") def log(txt): txt = txt+"\n" logger.write(txt) log("\n\nService attempting to start") logger.flush() class MyService(win32serviceutil.ServiceFramework): _svc_name_ = "MyService" _svc_display_name_ = "MyService" def __init__(self, args): log("in _init_") logger.flush() win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) def SvcStop(self): log("in _stop") logger.flush() self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) logger.close() def SvcDoRun(self): log("in _start") itnes = win32com.client.Dispatch("iTunes.Application") log("numTracks: ") logger.flush() # wait for beeing stopped... while 1: res = win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) if res == win32event.WAIT_OBJECT_0: break # Must be terminating log("in _start waiting") logger.flush() if __name__ == '__main__': win32serviceutil.HandleCommandLine(MyService) -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Jan 20 00:45:14 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 19 Jan 2009 15:45:14 -0800 Subject: [python-win32] Dispatching a win32com from within a win32service In-Reply-To: <496eec030901191526p1b520a6jf12ca02b667123f6@mail.gmail.com> References: <496eec030901191526p1b520a6jf12ca02b667123f6@mail.gmail.com> Message-ID: <4975108A.9040203@probo.com> Richard Zinn wrote: > > I've got an python app that I'm trying to access the iTunes com API > with, and this app runs as a Windows service. When I run it I get > these GetGoodDispatchAndUserName errors. I think it ends up being > related to the service not having security access to the Com > interface? I've tried setting the --username --password params when I > start the service like so: This error, 80080005, can be caused by a timeout when starting an external COM server.. iTunes happens to take a long time to start up. Are you trying to run this before login? There's an issue here, in that iTunes needs to display a user interface, which it can't really do until someone has logged in, -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From ricozinn at gmail.com Tue Jan 20 01:33:01 2009 From: ricozinn at gmail.com (Richard Zinn) Date: Mon, 19 Jan 2009 16:33:01 -0800 Subject: [python-win32] Dispatching a win32com from within a win32service In-Reply-To: <4975108A.9040203@probo.com> References: <496eec030901191526p1b520a6jf12ca02b667123f6@mail.gmail.com> <4975108A.9040203@probo.com> Message-ID: <496eec030901191633y698d3416lec68215ba5da3c99@mail.gmail.com> Is there any way to attach to an existing itunes instance then? Or can I extend the 30 second delay period out to give it more time to launch the app? Actually, if you are saying that calling win32com.client.dispatch is going to launch that app as a separate process, then that isn't really what I'm looking for, ideally I would be able to attach to a running itunes process and interface with the COM objects. And I have a sample script written in JScript that does just that, so I am convinced it is possible, just not sure of the how yet. On Mon, Jan 19, 2009 at 3:45 PM, Tim Roberts wrote: > Richard Zinn wrote: > > > > I've got an python app that I'm trying to access the iTunes com API > > with, and this app runs as a Windows service. When I run it I get > > these GetGoodDispatchAndUserName errors. I think it ends up being > > related to the service not having security access to the Com > > interface? I've tried setting the --username --password params when I > > start the service like so: > > This error, 80080005, can be caused by a timeout when starting an > external COM server.. iTunes happens to take a long time to start up. > > Are you trying to run this before login? There's an issue here, in that > iTunes needs to display a user interface, which it can't really do until > someone has logged in, > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From le.dahut at laposte.net Tue Jan 20 17:35:02 2009 From: le.dahut at laposte.net (le dahut) Date: Tue, 20 Jan 2009 17:35:02 +0100 Subject: [python-win32] User transparent authentication with PDC In-Reply-To: <4974FFBD.3000703@gmail.com> References: <49748FA1.10303@laposte.net> <4974FFBD.3000703@gmail.com> Message-ID: <4975FD36.2090109@laposte.net> Thank you, it looks like something good. But I was not precise enough in my first post, my PDC is a Linux/Samba system. The client/server app I've written uses twisted-perspective broker. I don't trust the client side, so it should send to the server some informations it can check against the PDC. I thought using some sort of NTLM like in squid. Your example deals with NTLM but reading "Lib/site-packages/win32/lib/sspi.py" I don't understand everything. Can you enlight me ? Mark Hammond wrote : > > On 20/01/2009 1:35 AM, le dahut wrote: >> Hello, >> I've written a python network app in which the server runs on a >> Samba-PDC (NT Domain controler) and the client on the windows NTdomain >> clients. >> >> I want to authenticate the connexions to the python server using a >> transparent method. >> >> Is there a way to get a user NTdomain authentication token and give it >> back to the python-server so that it can validate it against the PDC ? > > Look for the 'sspi' functions and demos, particularly the > win32\demos\security\sspi directory. > > Cheers, > > Mark > > From mail at timgolden.me.uk Tue Jan 20 18:25:45 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 20 Jan 2009 17:25:45 +0000 Subject: [python-win32] User transparent authentication with PDC In-Reply-To: <4975FD36.2090109@laposte.net> References: <49748FA1.10303@laposte.net> <4974FFBD.3000703@gmail.com> <4975FD36.2090109@laposte.net> Message-ID: <49760919.2040403@timgolden.me.uk> le dahut wrote: > Thank you, it looks like something good. But I was not precise enough in > my first post, my PDC is a Linux/Samba system. > > The client/server app I've written uses twisted-perspective broker. I > don't trust the client side, so it should send to the server some > informations it can check against the PDC. > I thought using some sort of NTLM like in squid. This was announced recently: http://groups.google.com/group/comp.lang.python.announce/msg/679090ede5ab645c Might help? (Haven't looked closely; might not ;) ) TJG From Gary.Scorby at harlandfs.com Tue Jan 20 19:36:04 2009 From: Gary.Scorby at harlandfs.com (Gary Scorby) Date: Tue, 20 Jan 2009 10:36:04 -0800 Subject: [python-win32] Releasing a Com object Message-ID: <35060D8B9453294F98923B7F6FAA2DAD05504D8C@pdx-srv-ex1.harlandfs.com> I'm having trouble releasing a com object. In the past I've always set the instance to None and life is good, as in the example below. I'm currently working with an object I can't release with this method. Anybody have a different/better way to handle this? Thanks Gary # example xxx = win32com.client.Dispatch('abcd.XXX') # to release xxx = None -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgailer at gmail.com Tue Jan 20 20:04:37 2009 From: bgailer at gmail.com (bob gailer) Date: Tue, 20 Jan 2009 14:04:37 -0500 Subject: [python-win32] Releasing a Com object In-Reply-To: <35060D8B9453294F98923B7F6FAA2DAD05504D8C@pdx-srv-ex1.harlandfs.com> References: <35060D8B9453294F98923B7F6FAA2DAD05504D8C@pdx-srv-ex1.harlandfs.com> Message-ID: <49762045.40001@gmail.com> An HTML attachment was scrubbed... URL: From bgailer at gmail.com Tue Jan 20 20:27:32 2009 From: bgailer at gmail.com (bob gailer) Date: Tue, 20 Jan 2009 14:27:32 -0500 Subject: [python-win32] Releasing a Com object In-Reply-To: <35060D8B9453294F98923B7F6FAA2DAD05504D92@pdx-srv-ex1.harlandfs.com> References: <35060D8B9453294F98923B7F6FAA2DAD05504D8C@pdx-srv-ex1.harlandfs.com> <49762045.40001@gmail.com> <35060D8B9453294F98923B7F6FAA2DAD05504D92@pdx-srv-ex1.harlandfs.com> Message-ID: <497625A4.5070506@gmail.com> An HTML attachment was scrubbed... URL: From Gary.Scorby at harlandfs.com Tue Jan 20 20:13:10 2009 From: Gary.Scorby at harlandfs.com (Gary Scorby) Date: Tue, 20 Jan 2009 11:13:10 -0800 Subject: [python-win32] Releasing a Com object In-Reply-To: <49762045.40001@gmail.com> References: <35060D8B9453294F98923B7F6FAA2DAD05504D8C@pdx-srv-ex1.harlandfs.com> <49762045.40001@gmail.com> Message-ID: <35060D8B9453294F98923B7F6FAA2DAD05504D92@pdx-srv-ex1.harlandfs.com> You are correct, it no longer refers to the object. I should have added a few more details. Windows still believes the object is in use, in this case it's a dll. Nothing else can be done with the dll until Python is completely shut down. None of the other dll com objects I have used in the past have had this problem. Thanks Gary From: bob gailer [mailto:bgailer at gmail.com] Sent: Tuesday, January 20, 2009 11:05 AM To: Gary Scorby Cc: python-win32 at python.org Subject: Re: [python-win32] Releasing a Com object Gary Scorby wrote: I'm having trouble releasing a com object. In the past I've always set the instance to None and life is good, as in the example below. I'm currently working with an object I can't release with this method. Anybody have a different/better way to handle this? "can't release" - what does that mean? Certainly xxx no longer refers to the object. Thanks Gary # example xxx = win32com.client.Dispatch('abcd.XXX') # to release xxx = None -- Bob Gailer Chapel Hill NC 919-636-4239 -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.antal at ata-e.com Tue Jan 20 21:58:39 2009 From: greg.antal at ata-e.com (Greg Antal) Date: Tue, 20 Jan 2009 12:58:39 -0800 Subject: [python-win32] Releasing a Com object In-Reply-To: <497625A4.5070506@gmail.com> References: <35060D8B9453294F98923B7F6FAA2DAD05504D8C@pdx-srv-ex1.harlandfs.com> <49762045.40001@gmail.com> <35060D8B9453294F98923B7F6FAA2DAD05504D92@pdx-srv-ex1.harlandfs.com> <497625A4.5070506@gmail.com> Message-ID: <49763AFF.8070602@ata-e.com> An HTML attachment was scrubbed... URL: From Gary.Scorby at harlandfs.com Tue Jan 20 23:37:07 2009 From: Gary.Scorby at harlandfs.com (Gary Scorby) Date: Tue, 20 Jan 2009 14:37:07 -0800 Subject: [python-win32] Releasing a Com object In-Reply-To: <49763AFF.8070602@ata-e.com> References: <35060D8B9453294F98923B7F6FAA2DAD05504D8C@pdx-srv-ex1.harlandfs.com> <49762045.40001@gmail.com> <35060D8B9453294F98923B7F6FAA2DAD05504D92@pdx-srv-ex1.harlandfs.com><497625A4.5070506@gmail.com> <49763AFF.8070602@ata-e.com> Message-ID: <35060D8B9453294F98923B7F6FAA2DAD05504DA0@pdx-srv-ex1.harlandfs.com> That was my original attempt. No luck with that either. This sucker has nine lives. Thanks for your response. Gary From: python-win32-bounces+gary.scorby=harlandfs.com at python.org [mailto:python-win32-bounces+gary.scorby=harlandfs.com at python.org] On Behalf Of Greg Antal Sent: Tuesday, January 20, 2009 12:59 PM To: python-win32 at python.org Subject: Re: [python-win32] Releasing a Com object Try del xxx Even when you invoke whatever "stop" or "close" methods that object offers, you sometimes still have to delete the object to make the application shut down. - Greg Antal Gregory W. Antal Senior Technical Advisor ATA Engineering, Inc. 11995 El Camino Real, Suite 200 San Diego, CA 92130 www.ata-e.com greg.antal at ata-e.com 858-480-2072 (Phone) 858-792-8932 (Fax) bob gailer wrote, On 1/20/2009 11:27 AM: Gary Scorby wrote: You are correct, it no longer refers to the object. I should have added a few more details. Windows still believes the object is in use, in this case it's a dll. Nothing else can be done with the dll until Python is completely shut down. None of the other dll com objects I have used in the past have had this problem. Excel behaves that way also. One must explicitly tell Excel to quit, as in excelObj.quit(). Does your dll have an equivalent? Or take a look at psTools for ways to kill processes. -- Bob Gailer Chapel Hill NC 919-636-4239 ________________________________ _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From rdahlstrom at directedge.com Tue Jan 20 23:39:15 2009 From: rdahlstrom at directedge.com (Dahlstrom, Roger) Date: Tue, 20 Jan 2009 17:39:15 -0500 Subject: [python-win32] Releasing a Com object In-Reply-To: <35060D8B9453294F98923B7F6FAA2DAD05504DA0@pdx-srv-ex1.harlandfs.com> References: <35060D8B9453294F98923B7F6FAA2DAD05504D8C@pdx-srv-ex1.harlandfs.com><49762045.40001@gmail.com><35060D8B9453294F98923B7F6FAA2DAD05504D92@pdx-srv-ex1.harlandfs.com><497625A4.5070506@gmail.com><49763AFF.8070602@ata-e.com> <35060D8B9453294F98923B7F6FAA2DAD05504DA0@pdx-srv-ex1.harlandfs.com> Message-ID: <70D9B06B9E99EE4E98E4893703ADA1411199A3E939@EXCHANGE1.global.knight.com> If you open it in another thread, will it die upon the thread dying? ________________________________ From: python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On Behalf Of Gary Scorby Sent: Tuesday, January 20, 2009 5:37 PM To: Greg Antal; python-win32 at python.org Subject: Re: [python-win32] Releasing a Com object That was my original attempt. No luck with that either. This sucker has nine lives. Thanks for your response. Gary From: python-win32-bounces+gary.scorby=harlandfs.com at python.org [mailto:python-win32-bounces+gary.scorby=harlandfs.com at python.org] On Behalf Of Greg Antal Sent: Tuesday, January 20, 2009 12:59 PM To: python-win32 at python.org Subject: Re: [python-win32] Releasing a Com object Try del xxx Even when you invoke whatever "stop" or "close" methods that object offers, you sometimes still have to delete the object to make the application shut down. - Greg Antal Gregory W. Antal Senior Technical Advisor ATA Engineering, Inc. 11995 El Camino Real, Suite 200 San Diego, CA 92130 www.ata-e.com greg.antal at ata-e.com 858-480-2072 (Phone) 858-792-8932 (Fax) bob gailer wrote, On 1/20/2009 11:27 AM: Gary Scorby wrote: You are correct, it no longer refers to the object. I should have added a few more details. Windows still believes the object is in use, in this case it's a dll. Nothing else can be done with the dll until Python is completely shut down. None of the other dll com objects I have used in the past have had this problem. Excel behaves that way also. One must explicitly tell Excel to quit, as in excelObj.quit(). Does your dll have an equivalent? Or take a look at psTools for ways to kill processes. -- Bob Gailer Chapel Hill NC 919-636-4239 ________________________________ _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 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, and any attachments thereto, is strictly 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. E-mail transmission cannot be guaranteed to be secure or error-free. 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. NOTICE REGARDING PRIVACY AND CONFIDENTIALITY Direct Edge ECN LLC may, at its discretion, monitor and review the content of all e-mail communications. www.directedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Wed Jan 21 00:04:47 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 21 Jan 2009 10:04:47 +1100 Subject: [python-win32] User transparent authentication with PDC In-Reply-To: <4975FD36.2090109@laposte.net> References: <49748FA1.10303@laposte.net> <4974FFBD.3000703@gmail.com> <4975FD36.2090109@laposte.net> Message-ID: <4976588F.4050200@gmail.com> On 21/01/2009 3:35 AM, le dahut wrote: > I thought using some sort of NTLM like in squid. Your example deals with > NTLM but reading "Lib/site-packages/win32/lib/sspi.py" I don't > understand everything. > > Can you enlight me ? > In general, NTLM auth is tricky, but enlightenment can probably only come from reading the MSDN articles on the various functions used. But in summary, the auth-process is multi-step - generate a request token, get a response token, generate another request token from that response, then get a final response with the final auth token. At the end if this, all you get is a token which identifies the user, and depending on a number of things, the ability to impersonate that user. Cheers, Mark > > Mark Hammond wrote : >> >> On 20/01/2009 1:35 AM, le dahut wrote: >>> Hello, >>> I've written a python network app in which the server runs on a >>> Samba-PDC (NT Domain controler) and the client on the windows NTdomain >>> clients. >>> >>> I want to authenticate the connexions to the python server using a >>> transparent method. >>> >>> Is there a way to get a user NTdomain authentication token and give it >>> back to the python-server so that it can validate it against the PDC ? >> >> Look for the 'sspi' functions and demos, particularly the >> win32\demos\security\sspi directory. >> >> Cheers, >> >> Mark >> >> > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From skippy.hammond at gmail.com Wed Jan 21 00:08:11 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 21 Jan 2009 10:08:11 +1100 Subject: [python-win32] Releasing a Com object In-Reply-To: <35060D8B9453294F98923B7F6FAA2DAD05504D92@pdx-srv-ex1.harlandfs.com> References: <35060D8B9453294F98923B7F6FAA2DAD05504D8C@pdx-srv-ex1.harlandfs.com> <49762045.40001@gmail.com> <35060D8B9453294F98923B7F6FAA2DAD05504D92@pdx-srv-ex1.harlandfs.com> Message-ID: <4976595B.60502@gmail.com> On 21/01/2009 6:13 AM, Gary Scorby wrote: > You are correct, it no longer refers to the object. I should have added > a few more details. Windows still believes the object is in use, in this > case it?s a dll. Nothing else can be done with the dll until Python is > completely shut down. None of the other dll com objects I have used in > the past have had this problem. The DLL has been loaded into the Python process? Freeing an object doesn't guarantee the DLL will be unloaded - you could try pythoncom.CoFreeUnusedLibraries(). Alternatively, try and use an out-of-process version of the object... Mark > > Thanks > > Gary > > *From:* bob gailer [mailto:bgailer at gmail.com] > *Sent:* Tuesday, January 20, 2009 11:05 AM > *To:* Gary Scorby > *Cc:* python-win32 at python.org > *Subject:* Re: [python-win32] Releasing a Com object > > Gary Scorby wrote: > > I?m having trouble releasing a com object. In the past I?ve always set > the instance to None and life is good, as in the example below. I?m > currently working with an object I can?t release with this method. > Anybody have a different/better way to handle this? > > > "can?t release" - what does that mean? Certainly xxx no longer refers to > the object. > > Thanks > > Gary > > # example > > xxx = win32com.client.Dispatch('abcd.XXX') > > # to release > > xxx = None > > -- > Bob Gailer > Chapel Hill NC > 919-636-4239 > > > ------------------------------------------------------------------------ > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From Brad.Johnson at ballardtech.com Wed Jan 21 17:33:34 2009 From: Brad.Johnson at ballardtech.com (Brad Johnson) Date: Wed, 21 Jan 2009 16:33:34 +0000 (UTC) Subject: [python-win32] The GIL and COM Message-ID: I have embedded the Python interpreter into a COM application. In this application, I create worker threads that execute Python code. I marshal some COM objects that live in the UI thread of the application over to the worker thread and wrap them with EnsureDispatch() for use in the new thread. Meanwhile, the UI thread sometimes has work to do with Python. It attempts to acquire the GIL and releases it when done. However, while it is waiting for the GIL in the UI thread (when the worker thread has it), it is locked into a WaitForSingleObject call (some layers below PyGILState_Ensure). Anyone that uses COM knows that this is not a COM-safe wait, and message pumping will not continue. In other words, if my worker thread ever wants to marshal a call back into the UI thread, it will deadlock. I need some way to use a COM-safe wait for the GIL, such as CoWaitForMultipleHandles. Has anyone run into this problem or have a solution? From skippy.hammond at gmail.com Wed Jan 21 22:59:40 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 22 Jan 2009 08:59:40 +1100 Subject: [python-win32] The GIL and COM In-Reply-To: References: Message-ID: <49779ACC.5050503@gmail.com> On 22/01/2009 3:33 AM, Brad Johnson wrote: > I have embedded the Python interpreter into a COM application. In this > application, I create worker threads that execute Python code. > > I marshal some COM objects that live in the UI thread of the application over to > the worker thread and wrap them with EnsureDispatch() for use in the new thread. > > Meanwhile, the UI thread sometimes has work to do with Python. It attempts to > acquire the GIL and releases it when done. How is the UI thread written and how does it attempt to use the GIL? > However, while it is waiting for the > GIL in the UI thread (when the worker thread has it), it is locked into a > WaitForSingleObject call (some layers below PyGILState_Ensure). Obviously the GIL can only be held by one thread at a time. The question then is why your worker thread isn't periodically releasing the GIL so the UI thread can grab it. > Anyone that uses COM knows that this is not a COM-safe wait, and message pumping > will not continue. In other words, if my worker thread ever wants to marshal a > call back into the UI thread, it will deadlock. That is not true - it is very easy to demonstrate a multi-threaded program in Python that marshals COM objects between threads and doesn't deadlock. Similarly, it is very easy to write a multi-threaded GUI app (assuming you follow the windows threading GUI rules) which face an almost identical problem (one thread must be in a message loop while the others are not) The GIL handles this situation just fine, so long as all C code does the right thing. I don't think we understand you problem well enough to give you any answers yet though. Cheers, Mark From Brad.Johnson at ballardtech.com Wed Jan 21 23:38:02 2009 From: Brad.Johnson at ballardtech.com (Brad Johnson) Date: Wed, 21 Jan 2009 22:38:02 +0000 (UTC) Subject: [python-win32] The GIL and COM References: <49779ACC.5050503@gmail.com> Message-ID: > > However, while it is waiting for the > > GIL in the UI thread (when the worker thread has it), it is locked into a > > WaitForSingleObject call (some layers below PyGILState_Ensure). > > Obviously the GIL can only be held by one thread at a time. The > question then is why your worker thread isn't periodically releasing the > GIL so the UI thread can grab it. I think this is the key. Since my application embeds Python, I call PyGILState_Ensure in the worker thread to acquire the GIL before doing anything related to Python. I understand Python releases the GIL periodically, but could my call be overriding that? If so, how can I run any Python code and hope to allow other threads to take a stab at getting the GIL? > The GIL handles this situation just fine, so long as all C code does the > right thing. I don't think we understand you problem well enough to > give you any answers yet though. I understand. I wanted to eliminate as much noise from my post as possible. Thanks for your help. ~Brad From skippy.hammond at gmail.com Thu Jan 22 00:32:13 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 22 Jan 2009 10:32:13 +1100 Subject: [python-win32] The GIL and COM In-Reply-To: References: <49779ACC.5050503@gmail.com> Message-ID: <4977B07D.3030301@gmail.com> On 22/01/2009 9:38 AM, Brad Johnson wrote: >>> However, while it is waiting for the >>> GIL in the UI thread (when the worker thread has it), it is locked into a >>> WaitForSingleObject call (some layers below PyGILState_Ensure). >> Obviously the GIL can only be held by one thread at a time. The >> question then is why your worker thread isn't periodically releasing the >> GIL so the UI thread can grab it. > I think this is the key. Since my application embeds Python, I call > PyGILState_Ensure in the worker thread to acquire the GIL before doing anything > related to Python. And you release it at the end, correct? > I understand Python releases the GIL periodically, but could > my call be overriding that? If so, how can I run any Python code and hope to > allow other threads to take a stab at getting the GIL? So one your thread has acquired the GIL, one of 3 things happens: * It returns quickly and the GIL is released. * It executes many many instructions: every 'n' instructions Python will temporarily release the GIL for you. * It calls some other blocking function. This other blocking function must release the GIL before blocking, then re-aquire it when it needs to re-enter Python. Each of those 3 scenarios allows the other thread to run. You need to identify which of the 3 your thread falls into - I suspect it will end up being the final one, and the blocking functions do *not* release the GIL (note that all COM calls you make on any thread *will* release the GIL before making the actual call - it is more likely to be some function *you* expose to Python in a module or similar? Cheers, Mark From nickle at gmail.com Thu Jan 22 14:07:27 2009 From: nickle at gmail.com (Nick Leaton) Date: Thu, 22 Jan 2009 13:07:27 +0000 Subject: [python-win32] Multiple Windows Services Message-ID: <8797930d0901220507h57323c57je8cb3f6b5d93a194@mail.gmail.com> I have a need to write a service that can take multiple guises. So I would like one set of code, and to be able to install a dev service, a uat service, a test service etc. so something like python NickService.py -environment=DEV -config=c:\config\NickService.config for the install. This would then install a NickServiceDEV service. I can then install a second instance of the same service. Now, I'm having problems getting the 'DEV' information and the config information when each service is running The idea being that given the DEV and the config file, I can look up the other parameters I need to use in the SvcDoRun etc 2 questions. 1. Is this the right approach? I would prefer not to go near the registry if possible. 2. If not, what is the right way? Thanks -- Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: From haraldarminmassa at gmail.com Thu Jan 22 14:47:35 2009 From: haraldarminmassa at gmail.com (Harald Armin Massa) Date: Thu, 22 Jan 2009 14:47:35 +0100 Subject: [python-win32] Multiple Windows Services In-Reply-To: <8797930d0901220507h57323c57je8cb3f6b5d93a194@mail.gmail.com> References: <8797930d0901220507h57323c57je8cb3f6b5d93a194@mail.gmail.com> Message-ID: <7be3f35d0901220547h3ee0a688jd6fb1a355a558893@mail.gmail.com> Nick, guess I had a similar problem. My solution was: [....] cnf=oboxparm.readini() class oboxservice(win32serviceutil.ServiceFramework): _svc_name_=cnf.get("system","_svc_name_") _svc_display_name_ = cnf.get("system","_svc_display_name_") _svc_description_ = cnf.get("system","_svc_description_") _svc_deps_ = ["EventLog",cnf.get("system","dbservice")] def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) [....] "oboxparm.readini()" is reading a config file in the directory of the service.exe, and within that config file I store the name of the service within the parameters. That reading is done by from ConfigParser import SafeConfigParser giving back a configuration structure. Hope that helps, Harald On Thu, Jan 22, 2009 at 14:07, Nick Leaton wrote: > I have a need to write a service that can take multiple guises. > > So I would like one set of code, and to be able to install a dev service, a > uat service, a test service etc. > > so something like > > python NickService.py -environment=DEV -config=c:\config\NickService.config > > for the install. > > This would then install a NickServiceDEV service. I can then install a > second instance of the same service. > > Now, I'm having problems getting the 'DEV' information and the config > information when each service is running > > The idea being that given the DEV and the config file, I can look up the > other parameters I need to use in the SvcDoRun etc > > 2 questions. > > 1. Is this the right approach? I would prefer not to go near the registry if > possible. > 2. If not, what is the right way? > > > Thanks > > -- > Nick > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Spielberger Stra?e 49 70435 Stuttgart 0173/9409607 no fx, no carrier pigeon - EuroPython 2009 will take place in Birmingham - Stay tuned! From Brad.Johnson at ballardtech.com Thu Jan 22 18:49:10 2009 From: Brad.Johnson at ballardtech.com (Brad Johnson) Date: Thu, 22 Jan 2009 17:49:10 +0000 (UTC) Subject: [python-win32] The GIL and COM References: <49779ACC.5050503@gmail.com> <4977B07D.3030301@gmail.com> Message-ID: > So one your thread has acquired the GIL, one of 3 things happens: > > * It returns quickly and the GIL is released. > * It executes many many instructions: every 'n' instructions Python will > temporarily release the GIL for you. > * It calls some other blocking function. This other blocking function > must release the GIL before blocking, then re-aquire it when it needs to > re-enter Python. You're gonna love this one, Mark. It's number 3, and it's *pywin32* May I present exhibit A: PyObject *PyITypeInfo::GetContainingTypeLib() { ITypeInfo *pMyTypeInfo = GetI(this); if (pMyTypeInfo==NULL) return NULL; ITypeLib *ptlib; unsigned index; SCODE sc = pMyTypeInfo->GetContainingTypeLib(&ptlib, &index); if (FAILED(sc)) return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo); PyObject *ret = PyTuple_New(2); PyTuple_SetItem(ret, 0, PyCom_PyObjectFromIUnknown(ptlib, IID_ITypeLib)); PyTuple_SetItem(ret, 1, PyInt_FromLong(index)); return ret; } Unremarkable until you notice the call into GetContainingTypeLib is not wrapped in PY_INTERFACE_PRECALL and PY_INTERFACE_POSTCALL. I'll add those lines in and make sure my problem is fixed. I think we have a bug. From dan at shragmir.com Thu Jan 22 19:33:54 2009 From: dan at shragmir.com (dan at shragmir.com) Date: Thu, 22 Jan 2009 13:33:54 -0500 (EST) Subject: [python-win32] (no subject) Message-ID: <26259.38.100.17.149.1232649234.squirrel@webmail1.pair.com> I am writing a simple client and server that communicate using a duplex-mode named pipe on Windows. For my initial effort, the server used the Windows API calls to set up the pipe and communicate with it, but the client used the regular Python file methods. This works for exactly one transaction. That is --The client writes a message to the pipe --The server reads it --The server writes its response --The client reads the response. But the second time around, I receive ?IOError: [Errno 0] Error? when the client attempts to write the message. This is not the end of the world, because I can write the client application to use win32 API calls instead of the Python calls. But does anyone have any notion of why this is happening? I am hoping the answer may help me write clients in other applications (where I don?t have access to the win32 API). This code demonstrates the behavior: import win32file import win32pipe import threading import time class Server( threading.Thread ): def run( self ): self.pipeHandle = win32pipe.CreateNamedPipe( '\\\\.\\pipe\\testpipe', win32pipe.PIPE_ACCESS_DUPLEX, win32pipe.PIPE_TYPE_BYTE | win32pipe.PIPE_READMODE_BYTE | win32pipe.PIPE_WAIT, 50, 4096, 4096, 10000, None) if self.pipeHandle == win32file.INVALID_HANDLE_VALUE: print 'Failed to create named pipe!' print 'Exiting...' sys.exit(1) win32pipe.ConnectNamedPipe( self.pipeHandle ) while True: e, v = win32file.ReadFile( self.pipeHandle, 1, None ) if v == 'A': print 'SERVER: Received request "%s"--answering' %v err, j = win32file.WriteFile( self.pipeHandle, 'B' ) win32file.FlushFileBuffers( self.pipeHandle ) else: print 'SERVER: Received request "%s"--exiting' %v break print "SERVER: Exiting server" SERVER = Server() SERVER.start() time.sleep(0.1) CLIENT_PIPE = open( '\\\\.\\pipe\\testpipe', 'a+b' ) for i in range( 10 ): CLIENT_PIPE.write( 'A' ) CLIENT_PIPE.flush() reply = CLIENT_PIPE.read( 1 ) print 'CLIENT: answer %d received: "%s"'%(i, reply) CLIENT_PIPE.WRITE( 'C' ) CLIENT_PIPE.flush() And the results: SERVER: Received request "A"--answering CLIENT: answer 0 received: "B" Traceback (most recent call last): File "C:\Python25\Lib\site-packages\pywin32-210.0001_s-py2.5-win32.egg\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript exec codeObject in __main__.__dict__ File "C:\Python25\Lib\site-packages\pyccf\simple_server_test.py", line 42, in CLIENT_PIPE.write( 'A' ) IOError: [Errno 0] Error --Dan Menes From timr at probo.com Thu Jan 22 20:34:05 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 22 Jan 2009 11:34:05 -0800 Subject: [python-win32] (no subject) In-Reply-To: <26259.38.100.17.149.1232649234.squirrel@webmail1.pair.com> References: <26259.38.100.17.149.1232649234.squirrel@webmail1.pair.com> Message-ID: <4978CA2D.6010100@probo.com> dan at shragmir.com wrote: > This is not the end of the world, because I can write the client > application to use win32 API calls instead of the Python calls. But does > anyone have any notion of why this is happening? I am hoping the answer > may help me write clients in other applications (where I don?t have access > to the win32 API). > > This code demonstrates the behavior: > > import win32file > import win32pipe > import threading > import time > class Server( threading.Thread ): > def run( self ): > self.pipeHandle = win32pipe.CreateNamedPipe( > '\\\\.\\pipe\\testpipe', > win32pipe.PIPE_ACCESS_DUPLEX, > win32pipe.PIPE_TYPE_BYTE | > win32pipe.PIPE_READMODE_BYTE | > win32pipe.PIPE_WAIT, > 50, > 4096, > 4096, > 10000, > None) > > if self.pipeHandle == win32file.INVALID_HANDLE_VALUE: > print 'Failed to create named pipe!' > print 'Exiting...' > sys.exit(1) > > win32pipe.ConnectNamedPipe( self.pipeHandle ) > while True: > e, v = win32file.ReadFile( self.pipeHandle, 1, None ) > if v == 'A': > print 'SERVER: Received request "%s"--answering' %v > err, j = win32file.WriteFile( self.pipeHandle, 'B' ) > win32file.FlushFileBuffers( self.pipeHandle ) > else: > print 'SERVER: Received request "%s"--exiting' %v > break > > print "SERVER: Exiting server" > > SERVER = Server() > SERVER.start() > time.sleep(0.1) > CLIENT_PIPE = open( '\\\\.\\pipe\\testpipe', 'a+b' ) > You probably want "r+b", although I don't think it really makes a difference here. > for i in range( 10 ): > CLIENT_PIPE.write( 'A' ) > CLIENT_PIPE.flush() > reply = CLIENT_PIPE.read( 1 ) > print 'CLIENT: answer %d received: "%s"'%(i, reply) > The issue here is with the Python file wrappers. You have to take SOME kind of action to allow the Python file wrapper to turn around from reading back to writing. If you add CLIENT_PIPE.seek(0,0) at the end of the loop, after the read, then it works. That is... > CLIENT_PIPE.WRITE( 'C' ) > CLIENT_PIPE.flush() > ...it works after you fix the spelling of "WRITE" there. ;) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From dan at shragmir.com Thu Jan 22 20:59:15 2009 From: dan at shragmir.com (dan at shragmir.com) Date: Thu, 22 Jan 2009 14:59:15 -0500 (EST) Subject: [python-win32] Duplex pipes issue (was (no subject)) In-Reply-To: <4978CA2D.6010100@probo.com> References: <26259.38.100.17.149.1232649234.squirrel@webmail1.pair.com> <4978CA2D.6010100@probo.com> Message-ID: <4559.38.100.17.149.1232654355.squirrel@webmail1.pair.com> Thank you, Tim, That fixed it! (and apologies to the list for initially sending this with no subject). --Dan > dan at shragmir.com wrote: >> This is not the end of the world, because I can write the client >> application to use win32 API calls instead of the Python calls. But >> does >> anyone have any notion of why this is happening? I am hoping the answer >> may help me write clients in other applications (where I don???t have >> access >> to the win32 API). >> >> This code demonstrates the behavior: >> >> import win32file >> import win32pipe >> import threading >> import time >> class Server( threading.Thread ): >> def run( self ): >> self.pipeHandle = win32pipe.CreateNamedPipe( >> '\\\\.\\pipe\\testpipe', >> win32pipe.PIPE_ACCESS_DUPLEX, >> win32pipe.PIPE_TYPE_BYTE | >> win32pipe.PIPE_READMODE_BYTE | >> win32pipe.PIPE_WAIT, >> 50, >> 4096, >> 4096, >> 10000, >> None) >> >> if self.pipeHandle == win32file.INVALID_HANDLE_VALUE: >> print 'Failed to create named pipe!' >> print 'Exiting...' >> sys.exit(1) >> >> win32pipe.ConnectNamedPipe( self.pipeHandle ) >> while True: >> e, v = win32file.ReadFile( self.pipeHandle, 1, None ) >> if v == 'A': >> print 'SERVER: Received request "%s"--answering' %v >> err, j = win32file.WriteFile( self.pipeHandle, 'B' ) >> win32file.FlushFileBuffers( self.pipeHandle ) >> else: >> print 'SERVER: Received request "%s"--exiting' %v >> break >> >> print "SERVER: Exiting server" >> >> SERVER = Server() >> SERVER.start() >> time.sleep(0.1) >> CLIENT_PIPE = open( '\\\\.\\pipe\\testpipe', 'a+b' ) >> > > You probably want "r+b", although I don't think it really makes a > difference here. > >> for i in range( 10 ): >> CLIENT_PIPE.write( 'A' ) >> CLIENT_PIPE.flush() >> reply = CLIENT_PIPE.read( 1 ) >> print 'CLIENT: answer %d received: "%s"'%(i, reply) >> > > The issue here is with the Python file wrappers. You have to take SOME > kind of action to allow the Python file wrapper to turn around from > reading back to writing. If you add > CLIENT_PIPE.seek(0,0) > at the end of the loop, after the read, then it works. That is... > >> CLIENT_PIPE.WRITE( 'C' ) >> CLIENT_PIPE.flush() >> > > ...it works after you fix the spelling of "WRITE" there. ;) > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From matherbe at cisco.com Fri Jan 23 01:40:17 2009 From: matherbe at cisco.com (Matt Herbert (matherbe)) Date: Thu, 22 Jan 2009 19:40:17 -0500 Subject: [python-win32] GetWindowsVersion on Longhorn Message-ID: <249A89BAA060C94FA0B93EA6135CC93C06D7189D@xmb-rtp-20b.amer.cisco.com> Hey all, Just wondering if there is a way to differentiate Windows Server 2008 from Windows Vista? All the normal methods I would use aren't cutting it. For instance, sys.getwindowsversion() and platform.uname() are returning exactly the same thing for Vista and Windows 2008. Any Ideas? Thanks -Matt From timr at probo.com Fri Jan 23 03:14:41 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 22 Jan 2009 18:14:41 -0800 Subject: [python-win32] GetWindowsVersion on Longhorn In-Reply-To: <249A89BAA060C94FA0B93EA6135CC93C06D7189D@xmb-rtp-20b.amer.cisco.com> References: <249A89BAA060C94FA0B93EA6135CC93C06D7189D@xmb-rtp-20b.amer.cisco.com> Message-ID: <49792811.2010209@probo.com> Matt Herbert (matherbe) wrote: > Just wondering if there is a way to differentiate Windows Server 2008 > from Windows Vista? All the normal methods I would use aren't cutting > it. For instance, sys.getwindowsversion() and platform.uname() are > returning exactly the same thing for Vista and Windows 2008. > Yes, this is a common issue. The fact is that Vista SP1 is exactly the same code as Windows Server 2008. There is no difference. Thus, for the most part you shouldn't care. You can dig the real system name from the registry. HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion should have what you need. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From skippy.hammond at gmail.com Fri Jan 23 05:33:24 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 23 Jan 2009 15:33:24 +1100 Subject: [python-win32] The GIL and COM In-Reply-To: References: <49779ACC.5050503@gmail.com> <4977B07D.3030301@gmail.com> Message-ID: <49794894.1070304@gmail.com> On 23/01/2009 4:49 AM, Brad Johnson wrote: >> So one your thread has acquired the GIL, one of 3 things happens: >> >> * It returns quickly and the GIL is released. >> * It executes many many instructions: every 'n' instructions Python will >> temporarily release the GIL for you. >> * It calls some other blocking function. This other blocking function >> must release the GIL before blocking, then re-aquire it when it needs to >> re-enter Python. > > You're gonna love this one, Mark. It's number 3, and it's *pywin32* May I > present exhibit A: ... > I think we have a bug. We do indeed! I've checked the fix into the trunk. Thanks, Mark From jrvilda at gmail.com Fri Jan 23 10:36:09 2009 From: jrvilda at gmail.com (Josu Rodriguez) Date: Fri, 23 Jan 2009 10:36:09 +0100 Subject: [python-win32] Como usar unicode para ejecutar comandos de sistema Message-ID: Hola a todos, Tengo problemas para ejecutar comandos en el sistema, con caracteres unicode. el problema es a la hora de ejecutar un, por ejemplo : 'dir c:\?\' He intentado de varias formas y todas con caracteres unicode me devuelven error. La funci?n que ejecuto es la siguiente: command='explorer c:\\?\\' command1=u'explorer c:\\?\\' command2=unicode('explorer c:\\?\\','cp850') command3=command2.encode('utf-8') command5='explorer c:\new\' command6=u'explorer c:\new\' command7=u'explorer c:\\new\\' command8=u'explorer c:\\new\\' import sys import subprocess sp=subprocess subprocess.Popen(command, stdout=sp.PIPE, stderr=sp.STDOUT) #Lanza explorer pero no en la ruta adecuada. subprocess.Popen(command1, stdout=sp.PIPE, stderr=sp.STDOUT) #UnicodeEncodeError: 'ascii' codec ... subprocess.Popen(command2, stdout=sp.PIPE, stderr=sp.STDOUT) #UnicodeEncodeError: 'ascii' codec ... subprocess.Popen(command2, stdout=sp.PIPE, stderr=sp.STDOUT) #Lanza explorer pero no en la ruta adecuada, diferente a la primera. subprocess.Popen(command5, stdout=sp.PIPE, stderr=sp.STDOUT) #[Error 123] subprocess.Popen(command6, stdout=sp.PIPE, stderr=sp.STDOUT) #[Error 123] subprocess.Popen(command7, stdout=sp.PIPE, stderr=sp.STDOUT) #OK pero no es unicode subprocess.Popen(command8, stdout=sp.PIPE, stderr=sp.STDOUT) #OK pero no es unicode ?Alguien sabe como se resuelve este problemita? Muchas gracias -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Fri Jan 23 17:46:16 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Fri, 23 Jan 2009 09:46:16 -0700 Subject: [python-win32] Como usar unicode para ejecutar comandos de sistema In-Reply-To: References: Message-ID: Josu: Su pregunta no es realmente una cuesti?n pywin32. "Subprocess" es parte de la biblioteca est?ndar de Python, y las preguntas se deben enviar a esa lista. V?ase: http://mail.python.org/mailman/listinfo/python-list. ( Your question is not really a pywin32 question. Subprocess is part of the Python standard library, and questions should be sent to that list.) -- Vernon Cole On Fri, Jan 23, 2009 at 2:36 AM, Josu Rodriguez wrote: > Hola a todos, > > Tengo problemas para ejecutar comandos en el sistema, con caracteres > unicode. > > el problema es a la hora de ejecutar un, por ejemplo : 'dir c:\?\' > > He intentado de varias formas y todas con caracteres unicode me devuelven > error. > La funci?n que ejecuto es la siguiente: > > command='explorer c:\\?\\' > command1=u'explorer c:\\?\\' > command2=unicode('explorer c:\\?\\','cp850') > command3=command2.encode('utf-8') > command5='explorer c:\new\' > command6=u'explorer c:\new\' > command7=u'explorer c:\\new\\' > command8=u'explorer c:\\new\\' > > > import sys > import subprocess > sp=subprocess > > subprocess.Popen(command, stdout=sp.PIPE, stderr=sp.STDOUT) #Lanza > explorer pero no en la ruta adecuada. > > subprocess.Popen(command1, stdout=sp.PIPE, stderr=sp.STDOUT) > #UnicodeEncodeError: 'ascii' codec ... > > subprocess.Popen(command2, stdout=sp.PIPE, stderr=sp.STDOUT) > #UnicodeEncodeError: 'ascii' codec ... > > subprocess.Popen(command2, stdout=sp.PIPE, stderr=sp.STDOUT) #Lanza > explorer pero no en la ruta adecuada, diferente a la primera. > > subprocess.Popen(command5, stdout=sp.PIPE, stderr=sp.STDOUT) #[Error > 123] > > subprocess.Popen(command6, stdout=sp.PIPE, stderr=sp.STDOUT) #[Error > 123] > > subprocess.Popen(command7, stdout=sp.PIPE, stderr=sp.STDOUT) #OK pero no > es unicode > subprocess.Popen(command8, stdout=sp.PIPE, stderr=sp.STDOUT) #OK pero no > es unicode > > ?Alguien sabe como se resuelve este problemita? > > > Muchas gracias > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From jargeek at gmail.com Fri Jan 23 23:34:19 2009 From: jargeek at gmail.com (Jonathan Rivera) Date: Fri, 23 Jan 2009 16:34:19 -0600 Subject: [python-win32] How to say windows run screensaver? Message-ID: Hello all, i need to run a program to ask for a password, but i need this program will be the only accessible window on the screen, so i want to lock the screen but no my window. i see an example in vb and it say i may to use this: ' Tell the system a screen saver is running. SystemParametersInfo SPI_SCREENSAVERRUNNING, True, prev_value, 0 The problem is that when i use: win32gui.SystemParametersInfo(win32con.SPI_SCREENSAVERRUNNING, True) it say: Action 97 is not supported yet Do you know if are any other way to do the same thing? regards. From donald.liu at siemens.com Sat Jan 24 01:03:38 2009 From: donald.liu at siemens.com (Liu, Donald (H USA)) Date: Fri, 23 Jan 2009 19:03:38 -0500 Subject: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. Message-ID: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> Hi. I'm new to Python. Just downloaded ActivePython-2.5.2.2-win32-x86.msi and installed under "Microsoft Windows XP Professional Version 2002 Service Pack 2". When I click Start => Programs => ActiveState ActivePython2.5 => Pythonwin Editor, I got the "PythonWin" window opened with no problem. However, when I try to open a file (by either typing ctrl+o, or using the "open file icon", I run into the following error message: PythonWin 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' for further copyright information. >>> Traceback (most recent call last): File "boot_com_servers.py", line 21, in File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in pywintypes.__import_pywin32_system_module__("pythoncom", globals()) File "C:\Python25\Lib\site-packages\win32\Lib\pywintypes.py", line 98, in __import_pywin32_system_module__ ('.dll', 'rb', imp.C_EXTENSION)) ImportError: DLL load failed: The specified procedure could not be found. Others seem to have ran into this problem before but I couldn't locate a solution. Thanks for your help, Donald ---------------------------------------------------------------------------- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you From skippy.hammond at gmail.com Sat Jan 24 01:36:36 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 24 Jan 2009 11:36:36 +1100 Subject: [python-win32] How to say windows run screensaver? In-Reply-To: References: Message-ID: <497A6294.8060908@gmail.com> On 24/01/2009 9:34 AM, Jonathan Rivera wrote: > Hello all, > > i need to run a program to ask for a password, but i need this program > will be the only accessible window on the screen, so i want to lock > the screen but no my window. > i see an example in vb and it say i may to use this: > > ' Tell the system a screen saver is running. > SystemParametersInfo SPI_SCREENSAVERRUNNING, True, prev_value, 0 > > The problem is that when i use: > > win32gui.SystemParametersInfo(win32con.SPI_SCREENSAVERRUNNING, True) > > it say: Action 97 is not supported yet > > Do you know if are any other way to do the same thing? Windows documents SPI_SETSCREENSAVERRUNNING as existing on windows 9x only, so pywin32 hasn't bothered with support for it. SPI_GETSCREENSAVERRUNNING is supported, but that doesn't sound like what you need. You could try using ctypes... Cheers, Mark From skippy.hammond at gmail.com Sat Jan 24 05:19:40 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 24 Jan 2009 15:19:40 +1100 Subject: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. In-Reply-To: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> References: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> Message-ID: <497A96DC.3040707@gmail.com> On 24/01/2009 11:03 AM, Liu, Donald (H USA) wrote: > Hi. I'm new to Python. Just downloaded > ActivePython-2.5.2.2-win32-x86.msi and installed under "Microsoft > Windows XP Professional Version 2002 Service Pack 2". > > When I click Start => Programs => ActiveState ActivePython2.5 => > Pythonwin Editor, I got the "PythonWin" window opened with no problem. > However, when I try to open a file (by either typing ctrl+o, or using > the "open file icon", I run into the following error message: > > PythonWin 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit > (Intel)] on win32. > Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' > for further copyright information. >>>> Traceback (most recent call last): > File "boot_com_servers.py", line 21, in > File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in > pywintypes.__import_pywin32_system_module__("pythoncom", globals()) > File "C:\Python25\Lib\site-packages\win32\Lib\pywintypes.py", line 98, > in __import_pywin32_system_module__ > ('.dll', 'rb', imp.C_EXTENSION)) > ImportError: DLL load failed: The specified procedure could not be > found. > > Others seem to have ran into this problem before but I couldn't locate a > solution. Check if you have copies of pywintypes25.dll and pythoncom25.dll in your system32 directory, and if so, that they are identical to the ones in your Python directory. If they are not, update the system32 ones with the python ones. Cheers, Mark From charlietaylor at users.sourceforge.net Sun Jan 25 09:13:50 2009 From: charlietaylor at users.sourceforge.net (Charlie Taylor) Date: Sun, 25 Jan 2009 08:13:50 +0000 (UTC) Subject: [python-win32] Announce: Parametric Solutions (parasol) Message-ID: Parasol is a python framework in which mathematical models can be investigated parametrically. Parasol enables easy optimization, sensitivity study, and visualization. The math model can be as big or as small as desired. Output is generated in plain text, HTML, and native Microsoft Suite files (Excel, Word and PowerPoint). A problem is defined by input and output parameters. Results are presented in a manner that conveys insight into system trends and characteristics. The process of performing an analysis results in an ample assortment of graphs, charts, and images that display system sensitivities, variations, and characteristics. Barriers to creating these displays have been reduced to single commands in order to facilitate their use. Parasol has been designed to run under Microsoft Windows. Home Page: http://pyparasol.sourceforge.net/ From efotinis at yahoo.com Mon Jan 26 12:06:13 2009 From: efotinis at yahoo.com (Elias Fotinis) Date: Mon, 26 Jan 2009 03:06:13 -0800 (PST) Subject: [python-win32] PythonWin non-ascii chars typing bug Message-ID: <610256.90337.qm@web52912.mail.re2.yahoo.com> Starting from pywin 211, typing non-ascii chars in any Scintilla control in PythonWin is broken. These characters are truncated to the lower 8 bits of their Unicode values. The changelog of Scintilla 1.75 (the version used in 211 and 212) mentions some Unicode enhancements, which might be the reason for this. There are two solutions that seem to work: - Downgrade the Scintilla DLL to 1.74, or - Use Scintilla 1.77 (the latest release, which introduced the SCI_SETKEYSUNICODE message) and add this to CScintillaView.OnInitialUpdate in pywin/scintilla/view.py: SCI_SETKEYSUNICODE = 2521 self.SendScintilla(SCI_SETKEYSUNICODE, 1, 0) From donald.liu at siemens.com Mon Jan 26 18:28:15 2009 From: donald.liu at siemens.com (Liu, Donald (H USA)) Date: Mon, 26 Jan 2009 12:28:15 -0500 Subject: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. In-Reply-To: <497A96DC.3040707@gmail.com> References: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> <497A96DC.3040707@gmail.com> Message-ID: <68770C7BF531F44AB1DF01D108E6848B076CB25F@USMLVV1EXCTV04.ww005.siemens.net> Hi Mark, Thanks for your reply. I ran "dir c:\Windows\system32\py*.dll", and got the following: C:\>dir Windows\system32\py*.dll Volume in drive C is System Volume Serial Number is F8F2-995F Directory of C:\Windows\system32 03/27/2008 06:12 PM 2,117,632 python25.dll 03/27/2008 06:13 PM 323,584 pythoncom25.dll 03/27/2008 06:13 PM 98,304 pywintypes25.dll 3 File(s) 2,539,520 bytes 0 Dir(s) 12,925,677,568 bytes free Looks like there's only one set of these files in the system32 directory. By the way, I only had problem with installation on the PC at work. My PC at home, which also has Windows XP, runs ActivePython with no problem. Unfortunately it's the PC at work that I'd like to make the installation work ... Thanks again, Donald -----Original Message----- From: Mark Hammond [mailto:skippy.hammond at gmail.com] Sent: Friday, January 23, 2009 8:20 PM To: Liu, Donald (H USA) Cc: python-win32 at python.org Subject: Re: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. On 24/01/2009 11:03 AM, Liu, Donald (H USA) wrote: > Hi. I'm new to Python. Just downloaded > ActivePython-2.5.2.2-win32-x86.msi and installed under "Microsoft > Windows XP Professional Version 2002 Service Pack 2". > > When I click Start => Programs => ActiveState ActivePython2.5 => > Pythonwin Editor, I got the "PythonWin" window opened with no problem. > However, when I try to open a file (by either typing ctrl+o, or using > the "open file icon", I run into the following error message: > > PythonWin 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit > (Intel)] on win32. > Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' > for further copyright information. >>>> Traceback (most recent call last): > File "boot_com_servers.py", line 21, in > File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in > pywintypes.__import_pywin32_system_module__("pythoncom", globals()) > File "C:\Python25\Lib\site-packages\win32\Lib\pywintypes.py", line 98, > in __import_pywin32_system_module__ > ('.dll', 'rb', imp.C_EXTENSION)) > ImportError: DLL load failed: The specified procedure could not be > found. > > Others seem to have ran into this problem before but I couldn't locate a > solution. Check if you have copies of pywintypes25.dll and pythoncom25.dll in your system32 directory, and if so, that they are identical to the ones in your Python directory. If they are not, update the system32 ones with the python ones. Cheers, Mark ---------------------------------------------------------------------------- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you From vernondcole at gmail.com Mon Jan 26 19:35:35 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 26 Jan 2009 11:35:35 -0700 Subject: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. In-Reply-To: <68770C7BF531F44AB1DF01D108E6848B076CB25F@USMLVV1EXCTV04.ww005.siemens.net> References: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> <497A96DC.3040707@gmail.com> <68770C7BF531F44AB1DF01D108E6848B076CB25F@USMLVV1EXCTV04.ww005.siemens.net> Message-ID: Donald: I'm going to do a little information thing here... Active Python is a package put together by ActiveState. It is a commercial product (with some licensing restrictions) that has both commercial and community support. You can find support for that package at http://www.activestate.com/support/ . As far as I know, it is simply a repackaging of two (perhaps more?) free and open source packages, which you can download separately and which have their own support mechanisms -- including the one you are using now. Python is found at http://www.python.org/download/ and pywin32 is at http://sourceforge.net/projects/pywin32/ You might want to try downloading these original packages to see whether your installation problems go away. In exchange for the additional difficulty of downloading two packages, rather than only one, you have the advantage of knowing that you will never have to pay for a redistribution license. -- Vernon Cole On Mon, Jan 26, 2009 at 10:28 AM, Liu, Donald (H USA) < donald.liu at siemens.com> wrote: > Hi Mark, > > Thanks for your reply. I ran "dir c:\Windows\system32\py*.dll", and got > the following: > > C:\>dir Windows\system32\py*.dll > Volume in drive C is System > Volume Serial Number is F8F2-995F > > Directory of C:\Windows\system32 > > 03/27/2008 06:12 PM 2,117,632 python25.dll > 03/27/2008 06:13 PM 323,584 pythoncom25.dll > 03/27/2008 06:13 PM 98,304 pywintypes25.dll > 3 File(s) 2,539,520 bytes > 0 Dir(s) 12,925,677,568 bytes free > > Looks like there's only one set of these files in the system32 > directory. > > By the way, I only had problem with installation on the PC at work. My > PC at home, which also has Windows XP, runs ActivePython with no > problem. Unfortunately it's the PC at work that I'd like to make the > installation work ... > > Thanks again, > Donald > > -----Original Message----- > From: Mark Hammond [mailto:skippy.hammond at gmail.com] > Sent: Friday, January 23, 2009 8:20 PM > To: Liu, Donald (H USA) > Cc: python-win32 at python.org > Subject: Re: [python-win32] ImportError: DLL load failed: The specified > procedure could not be found. > > On 24/01/2009 11:03 AM, Liu, Donald (H USA) wrote: > > Hi. I'm new to Python. Just downloaded > > ActivePython-2.5.2.2-win32-x86.msi and installed under "Microsoft > > Windows XP Professional Version 2002 Service Pack 2". > > > > When I click Start => Programs => ActiveState ActivePython2.5 => > > Pythonwin Editor, I got the "PythonWin" window opened with no problem. > > However, when I try to open a file (by either typing ctrl+o, or using > > the "open file icon", I run into the following error message: > > > > PythonWin 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit > > (Intel)] on win32. > > Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' > > for further copyright information. > >>>> Traceback (most recent call last): > > File "boot_com_servers.py", line 21, in > > File "C:\Python25\lib\site-packages\pythoncom.py", line 3, > in > > pywintypes.__import_pywin32_system_module__("pythoncom", > globals()) > > File "C:\Python25\Lib\site-packages\win32\Lib\pywintypes.py", line > 98, > > in __import_pywin32_system_module__ > > ('.dll', 'rb', imp.C_EXTENSION)) > > ImportError: DLL load failed: The specified procedure could not be > > found. > > > > Others seem to have ran into this problem before but I couldn't locate > a > > solution. > > Check if you have copies of pywintypes25.dll and pythoncom25.dll in your > > system32 directory, and if so, that they are identical to the ones in > your Python directory. If they are not, update the system32 ones with > the python ones. > > Cheers, > > Mark > > > ---------------------------------------------------------------------------- > This message and any included attachments are from Siemens Medical > Solutions > and are intended only for the addressee(s). > The information contained herein may include trade secrets or privileged or > otherwise confidential information. Unauthorized review, forwarding, > printing, > copying, distributing, or using such information is strictly prohibited and > may > be unlawful. If you received this message in error, or have reason to > believe > you are not authorized to receive it, please promptly delete this message > and > notify the sender by e-mail with a copy to > Central.SecurityOffice at siemens.com > > Thank you > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Jan 26 19:36:21 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 26 Jan 2009 10:36:21 -0800 Subject: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. In-Reply-To: <68770C7BF531F44AB1DF01D108E6848B076CB25F@USMLVV1EXCTV04.ww005.siemens.net> References: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> <497A96DC.3040707@gmail.com> <68770C7BF531F44AB1DF01D108E6848B076CB25F@USMLVV1EXCTV04.ww005.siemens.net> Message-ID: <497E02A5.7050000@probo.com> Liu, Donald (H USA) wrote: > Hi Mark, > > Thanks for your reply. I ran "dir c:\Windows\system32\py*.dll", and got > the following: > > C:\>dir Windows\system32\py*.dll > Volume in drive C is System > Volume Serial Number is F8F2-995F > > Directory of C:\Windows\system32 > > 03/27/2008 06:12 PM 2,117,632 python25.dll > 03/27/2008 06:13 PM 323,584 pythoncom25.dll > 03/27/2008 06:13 PM 98,304 pywintypes25.dll > 3 File(s) 2,539,520 bytes > 0 Dir(s) 12,925,677,568 bytes free > > Looks like there's only one set of these files in the system32 > directory. > Of course; Windows does not allow multiple versions in a single directory. What Mark suggested is that you compare those versions to whatever versions are contained in your Python directory. For example: dir /s \Python25\py*.dll -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From donald.liu at siemens.com Mon Jan 26 20:17:43 2009 From: donald.liu at siemens.com (Liu, Donald (H USA)) Date: Mon, 26 Jan 2009 14:17:43 -0500 Subject: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. In-Reply-To: References: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> <497A96DC.3040707@gmail.com> <68770C7BF531F44AB1DF01D108E6848B076CB25F@USMLVV1EXCTV04.ww005.siemens.net> Message-ID: <68770C7BF531F44AB1DF01D108E6848B076CB3B5@USMLVV1EXCTV04.ww005.siemens.net> Vernon, Thanks for the tip, which I followed, but the result was not good yet. [I'm inclined to think that there's something wrong with my PC at work, but it's beyond me to figure out what. I upgraded to Windows XP Pro Service Pack 3.] I downloaded python-2.5.4.msi from python.org, and pywin32-212.win32-py2.5.exe from sourceforge.net, using the links you provided. Then I installed python followed by pywin32. When I run Pythonwin and try to open a file, I got the following (different) error message: PythonWin 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. >>> Traceback (most recent call last): File "boot_com_servers.py", line 44, in File "tbzr.pyo", line 124, in File "tbzr.pyo", line 61, in get_all_com_classes File "contextmenu.pyo", line 9, in ImportError: No module named shell Redirecting output to win32trace remote collector The files in system32 are C:\Python25>dir /s \windows\system32\py*.dll Volume in drive C is System Volume Serial Number is F8F2-995F Directory of C:\windows\system32 12/23/2008 03:10 PM 2,117,632 python25.dll 07/27/2008 03:27 PM 339,968 pythoncom25.dll 07/27/2008 03:23 PM 114,688 pywintypes25.dll 3 File(s) 2,572,288 bytes The files in c:\python25 are C:\Python25>dir /s py*.dll Volume in drive C is System Volume Serial Number is F8F2-995F Directory of C:\Python25\Lib\site-packages\isapi 01/26/2009 11:05 AM 37,888 PyISAPI_loader.dll 1 File(s) 37,888 bytes Directory of C:\Python25\Lib\site-packages\pywin32_system32 01/26/2009 11:05 AM 339,968 pythoncom25.dll 01/26/2009 11:05 AM 114,688 pywintypes25.dll 2 File(s) 454,656 bytes Thanks, Donald ________________________________ From: Vernon Cole [mailto:vernondcole at gmail.com] Sent: Monday, January 26, 2009 10:36 AM To: Liu, Donald (H USA) Cc: mhammond at skippinet.com.au; python-win32 at python.org Subject: Re: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. Donald: I'm going to do a little information thing here... Active Python is a package put together by ActiveState. It is a commercial product (with some licensing restrictions) that has both commercial and community support. You can find support for that package at http://www.activestate.com/support/ . As far as I know, it is simply a repackaging of two (perhaps more?) free and open source packages, which you can download separately and which have their own support mechanisms -- including the one you are using now. Python is found at http://www.python.org/download/ and pywin32 is at http://sourceforge.net/projects/pywin32/ You might want to try downloading these original packages to see whether your installation problems go away. In exchange for the additional difficulty of downloading two packages, rather than only one, you have the advantage of knowing that you will never have to pay for a redistribution license. -- Vernon Cole On Mon, Jan 26, 2009 at 10:28 AM, Liu, Donald (H USA) wrote: Hi Mark, Thanks for your reply. I ran "dir c:\Windows\system32\py*.dll", and got the following: C:\>dir Windows\system32\py*.dll Volume in drive C is System Volume Serial Number is F8F2-995F Directory of C:\Windows\system32 03/27/2008 06:12 PM 2,117,632 python25.dll 03/27/2008 06:13 PM 323,584 pythoncom25.dll 03/27/2008 06:13 PM 98,304 pywintypes25.dll 3 File(s) 2,539,520 bytes 0 Dir(s) 12,925,677,568 bytes free Looks like there's only one set of these files in the system32 directory. By the way, I only had problem with installation on the PC at work. My PC at home, which also has Windows XP, runs ActivePython with no problem. Unfortunately it's the PC at work that I'd like to make the installation work ... Thanks again, Donald -----Original Message----- From: Mark Hammond [mailto:skippy.hammond at gmail.com] Sent: Friday, January 23, 2009 8:20 PM To: Liu, Donald (H USA) Cc: python-win32 at python.org Subject: Re: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. On 24/01/2009 11:03 AM, Liu, Donald (H USA) wrote: > Hi. I'm new to Python. Just downloaded > ActivePython-2.5.2.2-win32-x86.msi and installed under "Microsoft > Windows XP Professional Version 2002 Service Pack 2". > > When I click Start => Programs => ActiveState ActivePython2.5 => > Pythonwin Editor, I got the "PythonWin" window opened with no problem. > However, when I try to open a file (by either typing ctrl+o, or using > the "open file icon", I run into the following error message: > > PythonWin 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit > (Intel)] on win32. > Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' > for further copyright information. >>>> Traceback (most recent call last): > File "boot_com_servers.py", line 21, in > File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in > pywintypes.__import_pywin32_system_module__("pythoncom", globals()) > File "C:\Python25\Lib\site-packages\win32\Lib\pywintypes.py", line 98, > in __import_pywin32_system_module__ > ('.dll', 'rb', imp.C_EXTENSION)) > ImportError: DLL load failed: The specified procedure could not be > found. > > Others seem to have ran into this problem before but I couldn't locate a > solution. Check if you have copies of pywintypes25.dll and pythoncom25.dll in your system32 directory, and if so, that they are identical to the ones in your Python directory. If they are not, update the system32 ones with the python ones. Cheers, Mark ------------------------------------------------------------------------ ---- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 ---------------------------------------------------------------------------- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Mon Jan 26 20:44:08 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 26 Jan 2009 12:44:08 -0700 Subject: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. In-Reply-To: <68770C7BF531F44AB1DF01D108E6848B076CB3B5@USMLVV1EXCTV04.ww005.siemens.net> References: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> <497A96DC.3040707@gmail.com> <68770C7BF531F44AB1DF01D108E6848B076CB25F@USMLVV1EXCTV04.ww005.siemens.net> <68770C7BF531F44AB1DF01D108E6848B076CB3B5@USMLVV1EXCTV04.ww005.siemens.net> Message-ID: Ahha! You are not having a problem with Python, as such. You are having a problem with Bazaar. I tried running bazaar from source some while ago, but had to download a lot of extra modules for it, so I have gotten lazy and just use the version from the windows installer. I am now running bazaar 1.11 alongside Python 2.6 with no problems. Download from http://bazaar-vcs.org/Download Also, unless you have a specific reason for using Python 2.5, I suggest that you upgrade to 2.6. -- Vernon On Mon, Jan 26, 2009 at 12:17 PM, Liu, Donald (H USA) < donald.liu at siemens.com> wrote: > Vernon, > > Thanks for the tip, which I followed, but the result was not good yet. [I'm > inclined to think that there's something wrong with my PC at work, but it's > beyond me to figure out what. I upgraded to Windows XP Pro Service Pack 3.] > > I downloaded python-2.5.4.msi from python.org, and > pywin32-212.win32-py2.5.exe from sourceforge.net, using the links you > provided. Then I installed python followed by pywin32. When I run > Pythonwin and try to open a file, I got the following (different) error > message: > > PythonWin 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit > (Intel)] on win32. > Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for > further copyright information. > >>> Traceback (most recent call last): > File "boot_com_servers.py", line 44, in > File "tbzr.pyo", line 124, in > File "tbzr.pyo", line 61, in get_all_com_classes > File "contextmenu.pyo", line 9, in > ImportError: No module named shell > Redirecting output to win32trace remote collector > > > The files in system32 are > > C:\Python25>dir /s \windows\system32\py*.dll > Volume in drive C is System > Volume Serial Number is F8F2-995F > > Directory of C:\windows\system32 > > 12/23/2008 03:10 PM 2,117,632 python25.dll > 07/27/2008 03:27 PM 339,968 pythoncom25.dll > 07/27/2008 03:23 PM 114,688 pywintypes25.dll > 3 File(s) 2,572,288 bytes > > > The files in c:\python25 are > > C:\Python25>dir /s py*.dll > Volume in drive C is System > Volume Serial Number is F8F2-995F > > Directory of C:\Python25\Lib\site-packages\isapi > > 01/26/2009 11:05 AM 37,888 PyISAPI_loader.dll > 1 File(s) 37,888 bytes > > Directory of C:\Python25\Lib\site-packages\pywin32_system32 > > 01/26/2009 11:05 AM 339,968 pythoncom25.dll > 01/26/2009 11:05 AM 114,688 pywintypes25.dll > 2 File(s) 454,656 bytes > > Thanks, > Donald > ------------------------------ > *From:* Vernon Cole [mailto:vernondcole at gmail.com] > *Sent:* Monday, January 26, 2009 10:36 AM > *To:* Liu, Donald (H USA) > *Cc:* mhammond at skippinet.com.au; python-win32 at python.org > > *Subject:* Re: [python-win32] ImportError: DLL load failed: The specified > procedure could not be found. > > Donald: > I'm going to do a little information thing here... > Active Python is a package put together by ActiveState. It is a commercial > product (with some licensing restrictions) that has both commercial and > community support. You can find support for that package at > http://www.activestate.com/support/ . > > As far as I know, it is simply a repackaging of two (perhaps more?) free > and open source packages, which you can download separately and which have > their own support mechanisms -- including the one you are using now. > > Python is found at http://www.python.org/download/ > and pywin32 is at http://sourceforge.net/projects/pywin32/ > > You might want to try downloading these original packages to see whether > your installation problems go away. In exchange for the additional > difficulty of downloading two packages, rather than only one, you have the > advantage of knowing that you will never have to pay for a redistribution > license. > -- > Vernon Cole > > > On Mon, Jan 26, 2009 at 10:28 AM, Liu, Donald (H USA) < > donald.liu at siemens.com> wrote: > >> Hi Mark, >> >> Thanks for your reply. I ran "dir c:\Windows\system32\py*.dll", and got >> the following: >> >> C:\>dir Windows\system32\py*.dll >> Volume in drive C is System >> Volume Serial Number is F8F2-995F >> >> Directory of C:\Windows\system32 >> >> 03/27/2008 06:12 PM 2,117,632 python25.dll >> 03/27/2008 06:13 PM 323,584 pythoncom25.dll >> 03/27/2008 06:13 PM 98,304 pywintypes25.dll >> 3 File(s) 2,539,520 bytes >> 0 Dir(s) 12,925,677,568 bytes free >> >> Looks like there's only one set of these files in the system32 >> directory. >> >> By the way, I only had problem with installation on the PC at work. My >> PC at home, which also has Windows XP, runs ActivePython with no >> problem. Unfortunately it's the PC at work that I'd like to make the >> installation work ... >> >> Thanks again, >> Donald >> >> -----Original Message----- >> From: Mark Hammond [mailto:skippy.hammond at gmail.com] >> Sent: Friday, January 23, 2009 8:20 PM >> To: Liu, Donald (H USA) >> Cc: python-win32 at python.org >> Subject: Re: [python-win32] ImportError: DLL load failed: The specified >> procedure could not be found. >> >> On 24/01/2009 11:03 AM, Liu, Donald (H USA) wrote: >> > Hi. I'm new to Python. Just downloaded >> > ActivePython-2.5.2.2-win32-x86.msi and installed under "Microsoft >> > Windows XP Professional Version 2002 Service Pack 2". >> > >> > When I click Start => Programs => ActiveState ActivePython2.5 => >> > Pythonwin Editor, I got the "PythonWin" window opened with no problem. >> > However, when I try to open a file (by either typing ctrl+o, or using >> > the "open file icon", I run into the following error message: >> > >> > PythonWin 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit >> > (Intel)] on win32. >> > Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' >> > for further copyright information. >> >>>> Traceback (most recent call last): >> > File "boot_com_servers.py", line 21, in >> > File "C:\Python25\lib\site-packages\pythoncom.py", line 3, >> in >> > pywintypes.__import_pywin32_system_module__("pythoncom", >> globals()) >> > File "C:\Python25\Lib\site-packages\win32\Lib\pywintypes.py", line >> 98, >> > in __import_pywin32_system_module__ >> > ('.dll', 'rb', imp.C_EXTENSION)) >> > ImportError: DLL load failed: The specified procedure could not be >> > found. >> > >> > Others seem to have ran into this problem before but I couldn't locate >> a >> > solution. >> >> Check if you have copies of pywintypes25.dll and pythoncom25.dll in your >> >> system32 directory, and if so, that they are identical to the ones in >> your Python directory. If they are not, update the system32 ones with >> the python ones. >> >> Cheers, >> >> Mark >> >> >> ---------------------------------------------------------------------------- >> This message and any included attachments are from Siemens Medical >> Solutions >> and are intended only for the addressee(s). >> The information contained herein may include trade secrets or privileged >> or >> otherwise confidential information. Unauthorized review, forwarding, >> printing, >> copying, distributing, or using such information is strictly prohibited >> and may >> be unlawful. If you received this message in error, or have reason to >> believe >> you are not authorized to receive it, please promptly delete this message >> and >> notify the sender by e-mail with a copy to >> Central.SecurityOffice at siemens.com >> >> Thank you >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > > ---------------------------------------------------------------------------- > This message and any included attachments are from Siemens Medical Solutions > and are intended only for the addressee(s). > The information contained herein may include trade secrets or privileged or > otherwise confidential information. Unauthorized review, forwarding, printing, > copying, distributing, or using such information is strictly prohibited and may > be unlawful. If you received this message in error, or have reason to believe > you are not authorized to receive it, please promptly delete this message and > notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com > > Thank you > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From donald.liu at siemens.com Mon Jan 26 23:40:46 2009 From: donald.liu at siemens.com (Liu, Donald (H USA)) Date: Mon, 26 Jan 2009 17:40:46 -0500 Subject: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. In-Reply-To: References: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> <497A96DC.3040707@gmail.com> <68770C7BF531F44AB1DF01D108E6848B076CB25F@USMLVV1EXCTV04.ww005.siemens.net> <68770C7BF531F44AB1DF01D108E6848B076CB3B5@USMLVV1EXCTV04.ww005.siemens.net> Message-ID: <68770C7BF531F44AB1DF01D108E6848B076CB5E6@USMLVV1EXCTV04.ww005.siemens.net> Vernon, You solved my problem! I was using Bazaar 1.9 (bzr-setup-1.9.exe) previously. After upgrading to Bazaar 1.11, all the problems disappeared. I'm sticking to Python 2.5 because that's what's being used. Since I'm new to Python, I don't want to be using a different version than the rest. Others are not using Pythonwin so they did not experience this problem before. Thanks for your help, and, to the broader community, for these wonderful tools. Donald ________________________________ From: Vernon Cole [mailto:vernondcole at gmail.com] Sent: Monday, January 26, 2009 11:44 AM To: Liu, Donald (H USA) Cc: mhammond at skippinet.com.au; python-win32 at python.org Subject: Re: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. Ahha! You are not having a problem with Python, as such. You are having a problem with Bazaar. I tried running bazaar from source some while ago, but had to download a lot of extra modules for it, so I have gotten lazy and just use the version from the windows installer. I am now running bazaar 1.11 alongside Python 2.6 with no problems. Download from http://bazaar-vcs.org/Download Also, unless you have a specific reason for using Python 2.5, I suggest that you upgrade to 2.6. -- Vernon On Mon, Jan 26, 2009 at 12:17 PM, Liu, Donald (H USA) wrote: Vernon, Thanks for the tip, which I followed, but the result was not good yet. [I'm inclined to think that there's something wrong with my PC at work, but it's beyond me to figure out what. I upgraded to Windows XP Pro Service Pack 3.] I downloaded python-2.5.4.msi from python.org, and pywin32-212.win32-py2.5.exe from sourceforge.net, using the links you provided. Then I installed python followed by pywin32. When I run Pythonwin and try to open a file, I got the following (different) error message: PythonWin 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. >>> Traceback (most recent call last): File "boot_com_servers.py", line 44, in File "tbzr.pyo", line 124, in File "tbzr.pyo", line 61, in get_all_com_classes File "contextmenu.pyo", line 9, in ImportError: No module named shell Redirecting output to win32trace remote collector The files in system32 are C:\Python25>dir /s \windows\system32\py*.dll Volume in drive C is System Volume Serial Number is F8F2-995F Directory of C:\windows\system32 12/23/2008 03:10 PM 2,117,632 python25.dll 07/27/2008 03:27 PM 339,968 pythoncom25.dll 07/27/2008 03:23 PM 114,688 pywintypes25.dll 3 File(s) 2,572,288 bytes The files in c:\python25 are C:\Python25>dir /s py*.dll Volume in drive C is System Volume Serial Number is F8F2-995F Directory of C:\Python25\Lib\site-packages\isapi 01/26/2009 11:05 AM 37,888 PyISAPI_loader.dll 1 File(s) 37,888 bytes Directory of C:\Python25\Lib\site-packages\pywin32_system32 01/26/2009 11:05 AM 339,968 pythoncom25.dll 01/26/2009 11:05 AM 114,688 pywintypes25.dll 2 File(s) 454,656 bytes Thanks, Donald ________________________________ From: Vernon Cole [mailto:vernondcole at gmail.com] Sent: Monday, January 26, 2009 10:36 AM To: Liu, Donald (H USA) Cc: mhammond at skippinet.com.au; python-win32 at python.org Subject: Re: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. Donald: I'm going to do a little information thing here... Active Python is a package put together by ActiveState. It is a commercial product (with some licensing restrictions) that has both commercial and community support. You can find support for that package at http://www.activestate.com/support/ . As far as I know, it is simply a repackaging of two (perhaps more?) free and open source packages, which you can download separately and which have their own support mechanisms -- including the one you are using now. Python is found at http://www.python.org/download/ and pywin32 is at http://sourceforge.net/projects/pywin32/ You might want to try downloading these original packages to see whether your installation problems go away. In exchange for the additional difficulty of downloading two packages, rather than only one, you have the advantage of knowing that you will never have to pay for a redistribution license. -- Vernon Cole On Mon, Jan 26, 2009 at 10:28 AM, Liu, Donald (H USA) wrote: Hi Mark, Thanks for your reply. I ran "dir c:\Windows\system32\py*.dll", and got the following: C:\>dir Windows\system32\py*.dll Volume in drive C is System Volume Serial Number is F8F2-995F Directory of C:\Windows\system32 03/27/2008 06:12 PM 2,117,632 python25.dll 03/27/2008 06:13 PM 323,584 pythoncom25.dll 03/27/2008 06:13 PM 98,304 pywintypes25.dll 3 File(s) 2,539,520 bytes 0 Dir(s) 12,925,677,568 bytes free Looks like there's only one set of these files in the system32 directory. By the way, I only had problem with installation on the PC at work. My PC at home, which also has Windows XP, runs ActivePython with no problem. Unfortunately it's the PC at work that I'd like to make the installation work ... Thanks again, Donald -----Original Message----- From: Mark Hammond [mailto:skippy.hammond at gmail.com] Sent: Friday, January 23, 2009 8:20 PM To: Liu, Donald (H USA) Cc: python-win32 at python.org Subject: Re: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. On 24/01/2009 11:03 AM, Liu, Donald (H USA) wrote: > Hi. I'm new to Python. Just downloaded > ActivePython-2.5.2.2-win32-x86.msi and installed under "Microsoft > Windows XP Professional Version 2002 Service Pack 2". > > When I click Start => Programs => ActiveState ActivePython2.5 => > Pythonwin Editor, I got the "PythonWin" window opened with no problem. > However, when I try to open a file (by either typing ctrl+o, or using > the "open file icon", I run into the following error message: > > PythonWin 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit > (Intel)] on win32. > Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' > for further copyright information. >>>> Traceback (most recent call last): > File "boot_com_servers.py", line 21, in > File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in > pywintypes.__import_pywin32_system_module__("pythoncom", globals()) > File "C:\Python25\Lib\site-packages\win32\Lib\pywintypes.py", line 98, > in __import_pywin32_system_module__ > ('.dll', 'rb', imp.C_EXTENSION)) > ImportError: DLL load failed: The specified procedure could not be > found. > > Others seem to have ran into this problem before but I couldn't locate a > solution. Check if you have copies of pywintypes25.dll and pythoncom25.dll in your system32 directory, and if so, that they are identical to the ones in your Python directory. If they are not, update the system32 ones with the python ones. Cheers, Mark ------------------------------------------------------------------------ ---- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 ------------------------------------------------------------------------ ---- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you ---------------------------------------------------------------------------- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Tue Jan 27 01:17:25 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 27 Jan 2009 11:17:25 +1100 Subject: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. In-Reply-To: <68770C7BF531F44AB1DF01D108E6848B076CB5E6@USMLVV1EXCTV04.ww005.siemens.net> References: <68770C7BF531F44AB1DF01D108E6848B076CADB3@USMLVV1EXCTV04.ww005.siemens.net> <497A96DC.3040707@gmail.com> <68770C7BF531F44AB1DF01D108E6848B076CB25F@USMLVV1EXCTV04.ww005.siemens.net> <68770C7BF531F44AB1DF01D108E6848B076CB3B5@USMLVV1EXCTV04.ww005.siemens.net> <68770C7BF531F44AB1DF01D108E6848B076CB5E6@USMLVV1EXCTV04.ww005.siemens.net> Message-ID: <017801c98014$ae9b14b0$0bd13e10$@com.au> FYI, I wrote those Tortoise shell extensions too :) We recently moved to the shell extension portion to C++ to avoid this exact problem. It is likely that a similar error would be seen using *any* program which embeds Python and displays a "file open" dialog - pythonwin obviously is such a program. Cheers, Mark -------------------------------------- From: Liu, Donald (H USA) [mailto:donald.liu at siemens.com] Sent: Tuesday, 27 January 2009 9:41 AM To: Vernon Cole Cc: mhammond at skippinet.com.au; python-win32 at python.org Subject: RE: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. Vernon, ? You solved my problem!? I was using Bazaar 1.9 (bzr-setup-1.9.exe)?previously.? After upgrading to Bazaar 1.11, all the problems disappeared.? I'm sticking to Python 2.5 because that's what's being used.? Since I'm new to Python, I don't want to be using a different version than the rest.? Others are not using Pythonwin so they did not experience this problem before. ? Thanks for your help, and, to the broader community,?for these wonderful tools. Donald ________________________________________ From: Vernon Cole [mailto:vernondcole at gmail.com] Sent: Monday, January 26, 2009 11:44 AM To: Liu, Donald (H USA) Cc: mhammond at skippinet.com.au; python-win32 at python.org Subject: Re: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. Ahha! ? You are not having a problem with Python, as such. You are having a problem with Bazaar. I tried running bazaar from source some while ago, but had to download a lot of extra modules for it, so I have gotten lazy and just use the version from the windows installer.? I am now running bazaar 1.11 alongside Python 2.6 with no problems. Download from http://bazaar-vcs.org/Download Also, unless you have a specific reason for using Python 2.5, I suggest that you upgrade to 2.6. -- Vernon On Mon, Jan 26, 2009 at 12:17 PM, Liu, Donald (H USA) wrote: Vernon, ? Thanks for the tip, which I followed, but the result was not good yet. [I'm inclined to think that there's something wrong with my PC at work, but it's beyond me to figure out what.? I upgraded to Windows XP Pro Service Pack 3.] ? I downloaded python-2.5.4.msi from python.org, and pywin32-212.win32-py2.5.exe from sourceforge.net, using the links you provided.? Then I installed python followed by pywin32.? When I run Pythonwin?and try to open a file, I got the following (different) error message: ? PythonWin 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. >>> Traceback (most recent call last): ? File "boot_com_servers.py", line 44, in ? File "tbzr.pyo", line 124, in ? File "tbzr.pyo", line 61, in get_all_com_classes ? File "contextmenu.pyo", line 9, in ImportError: No module named shell Redirecting output to win32trace remote collector ? ? The files in system32 are ? C:\Python25>dir /s \windows\system32\py*.dll ?Volume in drive C is System ?Volume Serial Number is F8F2-995F ? ?Directory of C:\windows\system32 ? 12/23/2008? 03:10 PM???????? 2,117,632 python25.dll 07/27/2008? 03:27 PM?????????? 339,968 pythoncom25.dll 07/27/2008? 03:23 PM?????????? 114,688 pywintypes25.dll ?????????????? 3 File(s)????? 2,572,288 bytes ? ? The?files?in?c:\python25?are ? C:\Python25>dir /s py*.dll ?Volume in drive C is System ?Volume Serial Number is F8F2-995F ? ?Directory of C:\Python25\Lib\site-packages\isapi ? 01/26/2009? 11:05 AM??????????? 37,888 PyISAPI_loader.dll ?????????????? 1 File(s)???????? 37,888 bytes ? ?Directory of C:\Python25\Lib\site-packages\pywin32_system32 ? 01/26/2009? 11:05 AM?????????? 339,968 pythoncom25.dll 01/26/2009? 11:05 AM?????????? 114,688 pywintypes25.dll ?????????????? 2 File(s)??????? 454,656 bytes Thanks, Donald ________________________________________ From: Vernon Cole [mailto:vernondcole at gmail.com] Sent: Monday, January 26, 2009 10:36 AM To: Liu, Donald (H USA) Cc: mhammond at skippinet.com.au; python-win32 at python.org Subject: Re: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. Donald: ? I'm going to do a little information thing here... Active Python is a package put together by ActiveState. It is a commercial product (with some licensing restrictions) that has both commercial and community support. You can find support for that package at http://www.activestate.com/support/ . ? As far as I know, it is simply a repackaging of two (perhaps more?) free and open source packages, which you can download separately and which have their own support mechanisms -- including the one you are using now. Python is found at http://www.python.org/download/ and pywin32 is at http://sourceforge.net/projects/pywin32/ ? You might want to try downloading these original packages to see whether your installation problems go away. In exchange for the additional difficulty of downloading two packages, rather than only one, you have the advantage of knowing that you will never have to pay for a redistribution license. -- Vernon Cole On Mon, Jan 26, 2009 at 10:28 AM, Liu, Donald (H USA) wrote: Hi Mark, Thanks for your reply. ?I ran "dir c:\Windows\system32\py*.dll", and got the following: C:\>dir Windows\system32\py*.dll ?Volume in drive C is System ?Volume Serial Number is F8F2-995F ?Directory of C:\Windows\system32 03/27/2008 ?06:12 PM ? ? ? ? 2,117,632 python25.dll 03/27/2008 ?06:13 PM ? ? ? ? ? 323,584 pythoncom25.dll 03/27/2008 ?06:13 PM ? ? ? ? ? ?98,304 pywintypes25.dll ? ? ? ? ? ? ? 3 File(s) ? ? ?2,539,520 bytes ? ? ? ? ? ? ? 0 Dir(s) ?12,925,677,568 bytes free Looks like there's only one set of these files in the system32 directory. By the way, I only had problem with installation on the PC at work. ?My PC at home, which also has Windows XP, runs ActivePython with no problem. ?Unfortunately it's the PC at work that I'd like to make the installation work ... Thanks again, Donald -----Original Message----- From: Mark Hammond [mailto:skippy.hammond at gmail.com] Sent: Friday, January 23, 2009 8:20 PM To: Liu, Donald (H USA) Cc: python-win32 at python.org Subject: Re: [python-win32] ImportError: DLL load failed: The specified procedure could not be found. On 24/01/2009 11:03 AM, Liu, Donald (H USA) wrote: > Hi. ?I'm new to Python. ?Just downloaded > ActivePython-2.5.2.2-win32-x86.msi and installed under "Microsoft > Windows XP Professional Version 2002 Service Pack 2". > > When I click Start => ?Programs => ?ActiveState ActivePython2.5 => > Pythonwin Editor, I got the "PythonWin" window opened with no problem. > However, when I try to open a file (by either typing ctrl+o, or using > the "open file icon", I run into the following error message: > > PythonWin 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit > (Intel)] on win32. > Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' > for further copyright information. >>>> Traceback (most recent call last): > ? ?File "boot_com_servers.py", line 21, in > ? ?File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in > ? ? ?pywintypes.__import_pywin32_system_module__("pythoncom", globals()) > ? ?File "C:\Python25\Lib\site-packages\win32\Lib\pywintypes.py", line 98, > in __import_pywin32_system_module__ > ? ? ?('.dll', 'rb', imp.C_EXTENSION)) > ImportError: DLL load failed: The specified procedure could not be > found. > > Others seem to have ran into this problem before but I couldn't locate a > solution. Check if you have copies of pywintypes25.dll and pythoncom25.dll in your system32 directory, and if so, that they are identical to the ones in your Python directory. ?If they are not, update the system32 ones with the python ones. Cheers, Mark ---------------------------------------------------------------------------- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 ---------------------------------------------------------------------------- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you ---------------------------------------------------------------------------- This message and any included attachments are from Siemens Medical Solutions and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to Central.SecurityOffice at siemens.com Thank you From ferdinandsousa at gmail.com Tue Jan 27 14:01:43 2009 From: ferdinandsousa at gmail.com (Ferdinand Sousa) Date: Tue, 27 Jan 2009 18:31:43 +0530 Subject: [python-win32] Windows Service, user activity and timed message box Message-ID: Greetings: I wanted some help on the following topics: A] How do I set up a script to run as a service? Are there any prerequisites for this? B] How do we check duration since last user activity -- Assuming that the screen is set to turn off/display a screensaver after a certain duration, I wouldn't mind checking if this has indeed occurred (I know how to use win32gui .SystemParametersInfo to check if either of these has occurred). However, I would prefer to check the time elapsed since last user activity. C] Timed message box -- Is there anyway I can set a timeout for a message box, so that if a user does not click some button within 'x' seconds, the message box closes of its own accord? Thanks in advance! Best regards, Ferdi -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Jan 27 15:03:38 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 27 Jan 2009 14:03:38 +0000 Subject: [python-win32] Windows Service, user activity and timed message box In-Reply-To: References: Message-ID: <497F143A.90303@timgolden.me.uk> Ferdinand Sousa wrote: > Greetings: > > I wanted some help on the following topics: > > A] How do I set up a script to run as a service? Are there any prerequisites > for this? There are a few recipes in the cookbook. Here's one for starters: http://code.activestate.com/recipes/576450/ > B] How do we check duration since last user activity -- Assuming that the > screen is set to turn off/display a screensaver after a certain duration, I > wouldn't mind checking if this has indeed occurred (I know how to use > win32gui .SystemParametersInfo to check if either of > these has occurred). However, I would prefer to check the time elapsed since > last user activity. I don't know that there's a function to do that for the entire system. GetLastInputInfo will do it for your own application, but you'd probably need to install some system hooks and roll your own to get this at system level. (And that sounds like overkill for what you're after). Perhaps a more precise description of your requirement would help? > C] Timed message box -- Is there anyway I can set a timeout for a message > box, so that if a user does not click some button within 'x' seconds, the > message box closes of its own accord? You can certainly implement your own dialog which mimics the message box and which can do whatever it likes in its own message loop. The alternative -- trying to post messages to a modal MessageBox queue -- would involve setting up a watchdog thread before you start the messagebox which "finds" your message box and "presses its button". Haven't tried it myself so there may be some gotcha I haven't thought about. TJG From charlie at begeistert.org Tue Jan 27 17:55:03 2009 From: charlie at begeistert.org (Charlie Clark) Date: Tue, 27 Jan 2009 17:55:03 +0100 Subject: [python-win32] Reading constants Message-ID: Hiya, I'm pretty new to COM but fairly used to Python. Still got most things to work just struggling a little with reading a constant. I'm currently scripting Adobe InDesign (CS4) where I create a document, export a PDF and close it withouth saving. All the documentation I've come across refers to a SaveOptions constant (yes or no) that I presumably can extract from InDesign somehow. While I have managed to come across the right value for this constant: http://www.indesignscriptingreference.com/CS3/JavaScript/SaveOptions-enum.htm it's also pretty clear to me that this might break easily and isn't quite the correct way of doing this. I've read about using introspection to generate the constants in win32com.client but haven't been able to get this to work. Is this a once only procedure or is it possible at run time? Thanks in advance for any pointers! Charlie -- Charlie Clark Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 From vernondcole at gmail.com Tue Jan 27 18:36:01 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 27 Jan 2009 10:36:01 -0700 Subject: [python-win32] Reading constants In-Reply-To: References: Message-ID: Charlie: In my experience, which goes back 35 years, constants like this are pretty much what the word implies -- constant. They are used to communicate between two software packages which were made by different people on different machines using different languages. If the value of the "magic number" where to change, both parties would have to rewrite their interface code. Therefore, in practice, these codes once defined will never change, so you should not have any trouble if you just hard code the number into your program. It is a good practice to define it as a named object for documentation purposes, so the next guy who reads your program (or yourself five years later) can understand what the number means in the interface. -- Vernon Cole # ------ #constants from http://www.indesignscriptingreference.com/CS3/JavaScript/SaveOptions-enum.htm SaveOptionsNo = 1852776480 #does not save changes SaveOptionsYes = 2036691744 #saves changes SaveOptionsAsk = 1634954016 #Displays a prompts asking whether to save changes. # ------ # ... ... Application.quit(SaveOptionsNo) #shut down the application and do not save changes If you never use SaveOptionsYes or SaveOptionsAsk, and are really concerned with efficiency, then make them comments, for documentation sake, but leave them where the code values are obvious. Also document where you got them from, as in the sample above. -- Vernon Cole On Tue, Jan 27, 2009 at 9:55 AM, Charlie Clark wrote: > > Hiya, > > I'm pretty new to COM but fairly used to Python. Still got most things to work just struggling a little with reading a constant. > > I'm currently scripting Adobe InDesign (CS4) where I create a document, export a PDF and close it withouth saving. All the documentation I've come across refers to a SaveOptions constant (yes or no) that I presumably can extract from InDesign somehow. While I have managed to come across the right value for this constant: > > http://www.indesignscriptingreference.com/CS3/JavaScript/SaveOptions-enum.htm > > it's also pretty clear to me that this might break easily and isn't quite the correct way of doing this. I've read about using introspection to generate the constants in win32com.client but haven't been able to get this to work. Is this a once only procedure or is it possible at run time? > > Thanks in advance for any pointers! > > Charlie > -- > Charlie Clark > Helmholtzstr. 20 > D?sseldorf > D- 40215 > Tel: +49-211-938-5360 > GSM: +49-178-782-6226 > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From charlie at begeistert.org Wed Jan 28 09:56:51 2009 From: charlie at begeistert.org (Charlie Clark) Date: Wed, 28 Jan 2009 09:56:51 +0100 Subject: [python-win32] Reading constants In-Reply-To: References: Message-ID: <5AA9AF37-48AB-496A-ACA8-669E7B57D864@begeistert.org> Am 27.01.2009 um 18:36 schrieb Vernon Cole: > Charlie: > In my experience, which goes back 35 years, constants like this are > pretty much what the word implies -- constant. They are used to > communicate between two software packages which were made by different > people on different machines using different languages. If the value > of the "magic number" where to change, both parties would have to > rewrite their interface code. > > Therefore, in practice, these codes once defined will never change, so > you should not have any trouble if you just hard code the number into > your program. > > It is a good practice to define it as a named object for documentation > purposes, so the next guy who reads your program (or yourself five > years later) can understand what the number means in the interface. Thanks very much for the advice, Vernon. Charlie -- Charlie Clark Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 From graham.bloice at trihedral.com Wed Jan 28 10:05:08 2009 From: graham.bloice at trihedral.com (Graham Bloice) Date: Wed, 28 Jan 2009 09:05:08 +0000 Subject: [python-win32] [Fwd: Re: Reading constants] Message-ID: <49801FC4.4040009@trihedral.com> Sending this to the list were it was meant to go in the first place. -- Regards, Graham Bloice -------------- next part -------------- An embedded message was scrubbed... From: Graham Bloice Subject: Re: [python-win32] Reading constants Date: Tue, 27 Jan 2009 17:52:17 +0000 Size: 4503 URL: From wowberk at gmail.com Wed Jan 28 11:17:30 2009 From: wowberk at gmail.com (wowberk) Date: Wed, 28 Jan 2009 11:17:30 +0100 Subject: [python-win32] advanced properties file Message-ID: Hello everybody, I need to list the advanced properties of a file such as organization, dll version, etc.. With module that can perform? Google translation -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Wed Jan 28 12:55:30 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 28 Jan 2009 11:55:30 +0000 Subject: [python-win32] advanced properties file In-Reply-To: References: Message-ID: <498047B2.60005@timgolden.me.uk> wowberk wrote: > Hello everybody, > > I need to list the advanced properties of a file such as organization, dll > version, etc.. I think you want structured storage. Have a look at my winshell module (or at the code it implements): http://timgolden.me.uk/python/winshell.html TJG From efotinis at yahoo.com Wed Jan 28 14:19:34 2009 From: efotinis at yahoo.com (Elias Fotinis) Date: Wed, 28 Jan 2009 05:19:34 -0800 (PST) Subject: [python-win32] advanced properties file In-Reply-To: Message-ID: <381178.88166.qm@web52911.mail.re2.yahoo.com> --- wowberk wrote: > I need to list the advanced properties of a file such as > organization, dll > version, etc.. You can use win32api.GetFileVersionInfo. From mhammond at skippinet.com.au Wed Jan 28 14:34:52 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 29 Jan 2009 00:34:52 +1100 Subject: [python-win32] Merge of py3k branch complete! Message-ID: <004d01c9814d$3b8ed0d0$b2ac7270$@com.au> Hi all, I'm very happy to declare the merge of Roger's py3k branch 'complete' - by which I mean all changes have been merged, and comparing the py3k branch with the trunk after running 2to3 yields identical trees except in a few insignificant directories - and it works :) Work still remains to be done, but it will now all be done on the trunk (so the branch should be considered closed.) I've created a tag on the trunk named 'py3k-merge-complete' to mark this spot. I'd like to express my extreme gratitude to Roger, without whom this py3k work would never have started in the first place. I'd also like to thank Jason and Vern who helped me out with the win32timezone and adodbapi modules respectively. In honour of this, I've made preliminary builds for all supported Python versions available; while they work well for me, they should be treated as alpha quality. I've some more docs to write and some finishing touches on adodbapi to discuss with Vern before I make a *real* release (which I will still declare beta quality). Use at your own risk - but you've probably got nothing much to lose if you are waiting to try out the Python 3.0 version! Further warning: I've only actually tested the installers for the 32bit 2.6 build and the 32 and 64bit 3.0 builds - but I expect all others to work too. I've also applied some recent patches to distutils which should prevent strange "application configuration" errors starting the 2.6 installers, so if you have had such problems in the past, I'd like to know if they are fixed in this build. The CHANGES and py3k notes in the .chm documentation are fairly accurate, if a little terse. The files are at http://starship.python.net/crew/mhammond/downloads and the names are: * pywin32-212.6.win-amd64-py2.6.exe * pywin32-212.6.win-amd64-py3.0.exe * pywin32-212.6.win32-py2.3.exe * pywin32-212.6.win32-py2.4.exe * pywin32-212.6.win32-py2.5.exe * pywin32-212.6.win32-py2.6.exe * pywin32-212.6.win32-py3.0.exe Cheers, Mark From charlie at begeistert.org Wed Jan 28 15:12:00 2009 From: charlie at begeistert.org (Charlie Clark) Date: Wed, 28 Jan 2009 15:12:00 +0100 Subject: [python-win32] [Fwd: Re: Reading constants] In-Reply-To: <49801FC4.4040009@trihedral.com> References: <49801FC4.4040009@trihedral.com> Message-ID: <8507EECA-E342-4571-A289-80157749467D@begeistert.org> Am 28.01.2009 um 10:05 schrieb Graham Bloice: > Or, use the built in win32com support for constants, e.g. > win32com.client.constants.myConstantName. Note I think this only > works if you've run MakePy over the type library for the object. > > Search the pythonwin help for the Quick Start to Client side COM. Got it! The constants I'm interested get slightly different names but so it's worth a look at the generated Python file which has them all nicely commented. Charlie -- Charlie Clark Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 From p.f.moore at gmail.com Wed Jan 28 16:00:07 2009 From: p.f.moore at gmail.com (Paul Moore) Date: Wed, 28 Jan 2009 15:00:07 +0000 Subject: [python-win32] Merge of py3k branch complete! In-Reply-To: <004d01c9814d$3b8ed0d0$b2ac7270$@com.au> References: <004d01c9814d$3b8ed0d0$b2ac7270$@com.au> Message-ID: <79990c6b0901280700i6a5e18efk7b217b5aef37e75b@mail.gmail.com> 2009/1/28 Mark Hammond : > I'd like to express my extreme gratitude to Roger, without whom this py3k > work would never have started in the first place. I'd also like to thank > Jason and Vern who helped me out with the win32timezone and adodbapi modules > respectively. Thank you to all! One of the great things about pywin32 has been the fact that builds for new Python versions are always available so quickly. Given how cautious many projects are being over committing to Python 3, this is a great achievement. Oh - and in case I've not mentioned it for a while, thanks for pywin32 in the first place. Paul. From jrvilda at gmail.com Wed Jan 28 22:49:00 2009 From: jrvilda at gmail.com (Josu Rodriguez) Date: Wed, 28 Jan 2009 22:49:00 +0100 Subject: [python-win32] Mostrar salida en InnerHTML Message-ID: Hola a todos, Alguien sabe como mostrar la salida de un script realizado en python mediante un objeto objExplorer.Document.Body.InnerHTML en vbs existe esta forma: On Error Resume Next Set objExplorer = CreateObject _ ("InternetExplorer.Application") objExplorer.Navigate "about:blank" objExplorer.ToolBar = 0 objExplorer.StatusBar = 0 objExplorer.Width = 400 objExplorer.Height = 200 objExplorer.Visible = 1 objExplorer.Document.Title = "Logon script in progress" objExplorer.Document.Body.InnerHTML = "Your logon script is being processed. " _ & "This might take several minutes to complete." Wscript.Sleep 10000 objExplorer.Document.Body.InnerHTML = "Your logon script is now complete." Wscript.Sleep 5000 objExplorer.Quit Es posible ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jrvilda at gmail.com Wed Jan 28 23:14:59 2009 From: jrvilda at gmail.com (Josu Rodriguez) Date: Wed, 28 Jan 2009 23:14:59 +0100 Subject: [python-win32] Mostrar salida en InnerHTML In-Reply-To: References: Message-ID: Solucionado: import time from win32com.client import DispatchEx ie=DispatchEx('InternetExplorer.Application') ie.Navigate('about:blank') ie.ToolBar = 0 ie.StatusBar = 0 ie.Width = 400 ie.Height = 200 ie.Visible = 1 while ie.Busy: time.sleep(0.1) doc = ie.Document doc.Title = "Logon script in progress" doc.Body.InnerHTML = "Your logon script is being processed.
This might take several minutes to complete." time.sleep(5) doc.Body.InnerHTML = "Your logon script is now complete." time.sleep(5) ie.Quit 2009/1/28 Josu Rodriguez > Hola a todos, > > > Alguien sabe como mostrar la salida de un script realizado en python > mediante un objeto objExplorer.Document.Body.InnerHTML > > en vbs existe esta forma: > > On Error Resume Next > > Set objExplorer = CreateObject _ > ("InternetExplorer.Application") > > objExplorer.Navigate "about:blank" > objExplorer.ToolBar = 0 > objExplorer.StatusBar = 0 > objExplorer.Width = 400 > objExplorer.Height = 200 > objExplorer.Visible = 1 > > objExplorer.Document.Title = "Logon script in progress" > objExplorer.Document.Body.InnerHTML = "Your logon script is being > processed. " _ > & "This might take several minutes to complete." > > Wscript.Sleep 10000 > > objExplorer.Document.Body.InnerHTML = "Your logon script is now complete." > > Wscript.Sleep 5000 > objExplorer.Quit > > Es posible ? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From imageguy1206 at gmail.com Thu Jan 29 08:13:37 2009 From: imageguy1206 at gmail.com (geoff) Date: Thu, 29 Jan 2009 02:13:37 -0500 Subject: [python-win32] How to calc amount of avail RAM in a process ? Message-ID: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> I am hoping someone could steer me in the right direction on how to calculate the amount of RAM available to a process. I found the post below from Tim Roberts - a belated thanks Tim for your patient responses ! and it seems we regularly hit this limit. We have an application that needs to display a large number of bitmaps (ie 100+) at one time. Currently we are just reading the file and storing as a wx.Image in RAM. I would seem we are hitting the 2.0G limited mentioned in the post below and I am wondering if there is some strategy we could use to go beyond this -- other than thumbnails and reading as necessary from the filesystem. At minimum though I would like to be able to 'prompt' the user to close some applications (ie mail clients, spreadsheets, etc) to free up some more space before our process starts. --- or would that even make a difference ? Any on the above (or the post below), help, advice, guidance would be greatly appreciated. Original Date: July 18th, 2005, 02:38 PM No, a user-mode process in Windows is limited to 2GB of address space. Addresses 80000000 and larger are kernel space. You can change the threshhold to 3GB by using the /3gb boot.ini switch, but few do so. You can certainly have more than 2GB of physical RAM in your machine, but a single process cannot use more than 2GB at a time. -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc From mc at mclaveau.com Thu Jan 29 09:16:57 2009 From: mc at mclaveau.com (Michel Claveau) Date: Thu, 29 Jan 2009 09:16:57 +0100 Subject: [python-win32] Merge of py3k branch complete! In-Reply-To: <004d01c9814d$3b8ed0d0$b2ac7270$@com.au> References: <004d01c9814d$3b8ed0d0$b2ac7270$@com.au> Message-ID: > I'm very happy to declare the merge of Roger's py3k branch 'complete' Thanks very much to Jason, Mark, Roger, Vern (alphabetic sort) and all contributors to PyWin32 (for Python 3.0 and others). Pywin32 is the best tool of all times, for the best language of all ages. (just a little problem: it is not in french... and I am a very bad reader of english) Obhama, Bush, Sarkozy can forget their plans anti-crisis: your is better. @-salutations -- Michel Claveau From steven.james at gmail.com Thu Jan 29 13:18:06 2009 From: steven.james at gmail.com (Steven James) Date: Thu, 29 Jan 2009 07:18:06 -0500 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> Message-ID: For the display of bitmaps, most apps take the approach of creating (sometimes multiple) low-res versions of the images, then swapping out so that only what you need at the moment is loaded in to memory. For instance, create a 50x50 version, a 100x100 version, and a 500x500 version. Only load the 500x500 when you are zoomed in enough to see the detail in it. Then again, on 64-bit windows, with 64-bit python, you can theoretically address 8TB of memory per-process. Steven On Thu, Jan 29, 2009 at 2:13 AM, geoff wrote: > I am hoping someone could steer me in the right direction on how to > calculate the amount of RAM available to a process. > > I found the post below from Tim Roberts - a belated thanks Tim for > your patient responses ! and it seems we regularly hit this limit. > > We have an application that needs to display a large number of bitmaps > (ie 100+) at one time. Currently we are just reading the file and > storing as a wx.Image in RAM. I would seem we are hitting the 2.0G > limited mentioned in the post below and I am wondering if there is > some strategy we could use to go beyond this -- other than thumbnails > and reading as necessary from the filesystem. > > At minimum though I would like to be able to 'prompt' the user to > close some applications (ie mail clients, spreadsheets, etc) to free > up some more space before our process starts. > --- or would that even make a difference ? > > Any on the above (or the post below), help, advice, guidance would be > greatly appreciated. > > > Original Date: July 18th, 2005, 02:38 PM > No, a user-mode process in Windows is limited to 2GB of address space. > Addresses 80000000 and larger are kernel space. You can change the > threshhold to 3GB by using the /3gb boot.ini switch, but few do so. > > You can certainly have more than 2GB of physical RAM in your machine, but a > single process cannot use more than 2GB at a time. > -- > - Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Thu Jan 29 18:00:13 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 29 Jan 2009 10:00:13 -0700 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> Message-ID: Geoff: Congratulations, you have just provided an excellent example of Nathan's first law: > *Software is a gas* > Software always expands to fit whatever container it is stored in. > http://www.codinghorror.com/blog/archives/000677.html -- VC On Thu, Jan 29, 2009 at 5:18 AM, Steven James wrote: > For the display of bitmaps, most apps take the approach of creating > (sometimes multiple) low-res versions of the images, then swapping out so > that only what you need at the moment is loaded in to memory. For instance, > create a 50x50 version, a 100x100 version, and a 500x500 version. Only load > the 500x500 when you are zoomed in enough to see the detail in it. > Then again, on 64-bit windows, with 64-bit python, you can theoretically > address 8TB of memory per-process. > Steven > > On Thu, Jan 29, 2009 at 2:13 AM, geoff wrote: >> >> I am hoping someone could steer me in the right direction on how to >> calculate the amount of RAM available to a process. >> >> I found the post below from Tim Roberts - a belated thanks Tim for >> your patient responses ! and it seems we regularly hit this limit. >> >> We have an application that needs to display a large number of bitmaps >> (ie 100+) at one time. Currently we are just reading the file and >> storing as a wx.Image in RAM. I would seem we are hitting the 2.0G >> limited mentioned in the post below and I am wondering if there is >> some strategy we could use to go beyond this -- other than thumbnails >> and reading as necessary from the filesystem. >> >> At minimum though I would like to be able to 'prompt' the user to >> close some applications (ie mail clients, spreadsheets, etc) to free >> up some more space before our process starts. >> --- or would that even make a difference ? >> >> Any on the above (or the post below), help, advice, guidance would be >> greatly appreciated. >> >> >> Original Date: July 18th, 2005, 02:38 PM >> No, a user-mode process in Windows is limited to 2GB of address space. >> Addresses 80000000 and larger are kernel space. You can change the >> threshhold to 3GB by using the /3gb boot.ini switch, but few do so. >> >> You can certainly have more than 2GB of physical RAM in your machine, but >> a >> single process cannot use more than 2GB at a time. >> -- >> - Tim Roberts, timr at probo.com >> Providenza & Boekelheide, Inc >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gustavotabares at gmail.com Thu Jan 29 19:09:17 2009 From: gustavotabares at gmail.com (Gustavo Tabares) Date: Thu, 29 Jan 2009 13:09:17 -0500 Subject: [python-win32] Opening and enumerating resource many times Message-ID: <1871c95a0901291009v42f23925hcbe9e9280ed8f2d5@mail.gmail.com> Hi all, I'm having a problem when opening and enumerating a network resource many times. For example: i = 0 while i < 10000: handle = win32wnet.WNetOpenEnum(win32netcon.RESOURCE_CONNECTED, win32netcon.RESOURCETYPE_ANY, 0, None) partial_nr_list = win32wnet.WNetEnumResource(handle) while partial_nr_list: partial_nr_list = win32wnet.WNetEnumResource(handle) win32wnet.WNetCloseEnum(handle) i += 1 This eventually fails with: Traceback (most recent call last): File "C:\qtest.py", line 17, in partial_nr_list = win32wnet.WNetEnumResource(handle) MemoryError: VirtualAlloc error in WNetEnumResource I took a look at the source for win32wnet.WNetEnumResource and it seems to be doing the correct thing in terms of memory. My application isn't doing the above exactly, however it does open/enumerate many times. Any ideas on what may be going on? Thanks, Gustavo From timr at probo.com Thu Jan 29 19:20:30 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 29 Jan 2009 10:20:30 -0800 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> Message-ID: <4981F36E.7080209@probo.com> geoff wrote: > I am hoping someone could steer me in the right direction on how to > calculate the amount of RAM available to a process. > > I found the post below from Tim Roberts - a belated thanks Tim for > your patient responses ! and it seems we regularly hit this limit. > > We have an application that needs to display a large number of bitmaps > (ie 100+) at one time. Currently we are just reading the file and > storing as a wx.Image in RAM. I would seem we are hitting the 2.0G > limited mentioned in the post below and I am wondering if there is > some strategy we could use to go beyond this -- other than thumbnails > and reading as necessary from the filesystem. > There's no easy fix. Thumbnails and some kind of least-recently-used caching scheme are probably your best choices. As Steven pointed out, you could always install a Win64 system and a 64-bit Python. Then, you can get about 8TB of process space. However, that's not particularly friendly to your end users, if you need to distribute this. > At minimum though I would like to be able to 'prompt' the user to > close some applications (ie mail clients, spreadsheets, etc) to free > up some more space before our process starts. > --- or would that even make a difference ? > No. The 2GB address space limit is per process. It doesn't matter what other processes are doing. You can even have several processes using 2GB of memory, although your disk will get a good workout. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From imageguy1206 at gmail.com Thu Jan 29 19:32:11 2009 From: imageguy1206 at gmail.com (geoff) Date: Thu, 29 Jan 2009 13:32:11 -0500 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <4981F36E.7080209@probo.com> References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> <4981F36E.7080209@probo.com> Message-ID: <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> > There's no easy fix. Thumbnails and some kind of least-recently-used > caching scheme are probably your best choices. As Steven pointed out, > you could always install a Win64 system and a 64-bit Python. Then, you > can get about 8TB of process space. However, that's not particularly > friendly to your end users, if you need to distribute this. Not really and option as we do need to distribute and the users are not at all 'power users' > No. The 2GB address space limit is per process. It doesn't matter what > other processes are doing. You can even have several processes using > 2GB of memory, although your disk will get a good workout. Thanks. Any tips/hints on calculating the potentially available space ? From steven.james at gmail.com Thu Jan 29 19:43:40 2009 From: steven.james at gmail.com (Steven James) Date: Thu, 29 Jan 2009 13:43:40 -0500 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> <4981F36E.7080209@probo.com> <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> Message-ID: Not an expert on this, but googling "win32 performance counters" led me here: http://msdn.microsoft.com/en-us/library/aa373193(VS.85).aspx Should let you get the available physical memory in the system. Not sure that you can specify to Windows that you want physical memory when you create the image objects, but it might be OK as a rough guide of whether there is memory available or not. Steven On Thu, Jan 29, 2009 at 1:32 PM, geoff wrote: > > There's no easy fix. Thumbnails and some kind of least-recently-used > > caching scheme are probably your best choices. As Steven pointed out, > > you could always install a Win64 system and a 64-bit Python. Then, you > > can get about 8TB of process space. However, that's not particularly > > friendly to your end users, if you need to distribute this. > > Not really and option as we do need to distribute and the users are > not at all 'power users' > > > No. The 2GB address space limit is per process. It doesn't matter what > > other processes are doing. You can even have several processes using > > 2GB of memory, although your disk will get a good workout. > > Thanks. > Any tips/hints on calculating the potentially available space ? > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jan 29 19:45:44 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 29 Jan 2009 10:45:44 -0800 Subject: [python-win32] Opening and enumerating resource many times In-Reply-To: <1871c95a0901291009v42f23925hcbe9e9280ed8f2d5@mail.gmail.com> References: <1871c95a0901291009v42f23925hcbe9e9280ed8f2d5@mail.gmail.com> Message-ID: <4981F958.60405@probo.com> Gustavo Tabares wrote: > Hi all, > > I'm having a problem when opening and enumerating a network resource > many times. For example: > > i = 0 > > while i < 10000: > handle = > win32wnet.WNetOpenEnum(win32netcon.RESOURCE_CONNECTED, > win32netcon.RESOURCETYPE_ANY, 0, None) > partial_nr_list = win32wnet.WNetEnumResource(handle) > while partial_nr_list: > partial_nr_list = win32wnet.WNetEnumResource(handle) > win32wnet.WNetCloseEnum(handle) > > i += 1 > > > This eventually fails with: > > Traceback (most recent call last): > File "C:\qtest.py", line 17, in > partial_nr_list = win32wnet.WNetEnumResource(handle) > MemoryError: VirtualAlloc error in WNetEnumResource > Sure enough, if you watch this application in Task Manager, you can see the memory usage going up smoothly over time. On my system, however, 10,000 iterations is not nearly enough; memory usage rises to about 6MB, and then it terminates normally. Also, it's definitely the WNetEnumResource call that does it. If you comment that out, there's no leak. It doesn't seem to be a Python garbage issue; I added a forced garbage collection in every loop, and it still happened. I haven't found any web articles about this. Very interesting... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Thu Jan 29 20:03:13 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 29 Jan 2009 11:03:13 -0800 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> <4981F36E.7080209@probo.com> <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> Message-ID: <4981FD71.8050409@probo.com> geoff wrote: > Any tips/hints on calculating the potentially available space ? > Do you mean the total amount of process virtual memory space still available? You can actually get that from the GlobalMemoryStatusEx API. There's no Python wrapper for that, as far as I know, but here's a ctypes wrapper. Note that this does not return the total CONTIGUOUS memory space, but for your purposes, that's probably not critical. from ctypes import * from ctypes.wintypes import * class MEMORYSTATUSEX(Structure): _fields_ = [ ('dwLength', DWORD), ('dwMemoryLoad', DWORD), ('ullTotalPhys', c_ulonglong), ('ullAvailPhys', c_ulonglong), ('ullTotalPageFile', c_ulonglong), ('ullAvailPageFile', c_ulonglong), ('ullTotalVirtual', c_ulonglong), ('ullAvailVirtual', c_ulonglong), ('ullExtendedVirtual', c_ulonglong), ] def GlobalMemoryStatusEx(): x = MEMORYSTATUSEX() x.dwLength = sizeof(x) windll.kernel32.GlobalMemoryStatusEx(byref(x)) return x z = GlobalMemoryStatusEx() print z.ullAvailVirtual -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Thu Jan 29 20:04:23 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 29 Jan 2009 11:04:23 -0800 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> <4981F36E.7080209@probo.com> <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> Message-ID: <4981FDB7.5020408@probo.com> Steven James wrote: > Not an expert on this, but googling "win32 performance counters" led > me here: > > http://msdn.microsoft.com/en-us/library/aa373193(VS.85).aspx > > > Should let you get the available physical memory in the system. Not > sure that you can specify to Windows that you want physical memory > when you create the image objects, but it might be OK as a rough guide > of whether there is memory available or not. No, that's useless for this purpose. Windows is a virtual memory system. Even if you only have 256MB of physical RAM, your process can still allocate up to 2GB of memory. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From steven.james at gmail.com Thu Jan 29 21:59:28 2009 From: steven.james at gmail.com (Steven James) Date: Thu, 29 Jan 2009 15:59:28 -0500 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <4981FDB7.5020408@probo.com> References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> <4981F36E.7080209@probo.com> <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> <4981FDB7.5020408@probo.com> Message-ID: Agreed, but PDH can give per-process statistics, too. For high-memory-usage apps, I would think that it would be nice for your app to know whether it is *likely* to need to swap out (by comparing needed memory to availably physical memory). Anyway, using the same API, you can determine how much memory space your own app is currently using, which was the original question. Probably clunky, but as I said, I'm not an expert. like so..... http://soundstripe.net/node/62 Steven On Thu, Jan 29, 2009 at 2:04 PM, Tim Roberts wrote: > Steven James wrote: > > Not an expert on this, but googling "win32 performance counters" led > > me here: > > > > http://msdn.microsoft.com/en-us/library/aa373193(VS.85).aspx > > > > > > Should let you get the available physical memory in the system. Not > > sure that you can specify to Windows that you want physical memory > > when you create the image objects, but it might be OK as a rough guide > > of whether there is memory available or not. > > No, that's useless for this purpose. Windows is a virtual memory > system. Even if you only have 256MB of physical RAM, your process can > still allocate up to 2GB of memory. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Thu Jan 29 23:35:03 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 30 Jan 2009 09:35:03 +1100 Subject: [python-win32] Opening and enumerating resource many times In-Reply-To: <1871c95a0901291009v42f23925hcbe9e9280ed8f2d5@mail.gmail.com> References: <1871c95a0901291009v42f23925hcbe9e9280ed8f2d5@mail.gmail.com> Message-ID: <49822F17.1090807@gmail.com> On 30/01/2009 5:09 AM, Gustavo Tabares wrote: > Hi all, > > I'm having a problem when opening and enumerating a network resource > many times. For example: > > i = 0 > > while i< 10000: > handle = > win32wnet.WNetOpenEnum(win32netcon.RESOURCE_CONNECTED, > win32netcon.RESOURCETYPE_ANY, 0, None) > partial_nr_list = win32wnet.WNetEnumResource(handle) > while partial_nr_list: > partial_nr_list = win32wnet.WNetEnumResource(handle) > win32wnet.WNetCloseEnum(handle) > > i += 1 > > > This eventually fails with: > > Traceback (most recent call last): > File "C:\qtest.py", line 17, in > partial_nr_list = win32wnet.WNetEnumResource(handle) > MemoryError: VirtualAlloc error in WNetEnumResource > > > I took a look at the source for win32wnet.WNetEnumResource and it > seems to be doing the correct thing in terms of memory. My application > isn't doing the above exactly, however it does open/enumerate many > times. Any ideas on what may be going on? It appears if we change the memory-free calls in that function to: VirtualFree(lpBuffer, 0, MEM_RELEASE); // free the working buffer The leak goes away. Unless I hear it is a bad thing, I'll check it in... Cheers, Mark. From mc at mclaveau.com Fri Jan 30 00:54:36 2009 From: mc at mclaveau.com (Michel Claveau) Date: Fri, 30 Jan 2009 00:54:36 +0100 Subject: [python-win32] Pb SxS for install Message-ID: <4EB4CDEF5CD046DD8DE51E57E2E31BC0@MCI1330> Hi! When I try to install pywin32-212.6.win32-py2.6.exe, I had a "SideBySide error". Below, the complete message found in the journal of applications. Any idea, for solution ? Thanks in advance. -- Michel Claveau ---------------------------------------------------------- Nom du journal :Application Source : SideBySide Date : 30/01/2009 00:37:14 ID de l'?v?nement :33 Cat?gorie de la t?che :Aucun Niveau : Erreur Mots cl?s : Classique Utilisateur : N/A Ordinateur : VVISTAPREMIUM Description : La cr?ation du contexte d'activation a ?chou? pour ? Z:\pywin32-212.6.win32-py2.6.exe ?. Assembly d?pendant Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" introuvable. Utilisez sxstrace.exe pour un diagnostic d?taill?. XML de l'?v?nement : 33 2 0 0x80000000000000 2684 Application VVISTAPREMIUM Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" Z:\pywin32-212.6.win32-py2.6.exe ---------------------------------------------------------- From skippy.hammond at gmail.com Fri Jan 30 01:31:29 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 30 Jan 2009 11:31:29 +1100 Subject: [python-win32] Pb SxS for install In-Reply-To: <4EB4CDEF5CD046DD8DE51E57E2E31BC0@MCI1330> References: <4EB4CDEF5CD046DD8DE51E57E2E31BC0@MCI1330> Message-ID: <49824A61.3060606@gmail.com> On 30/01/2009 10:54 AM, Michel Claveau wrote: > Hi! > > When I try to install pywin32-212.6.win32-py2.6.exe, I had a "SideBySide > error". > Below, the complete message found in the journal of applications. > > Any idea, for solution ? > Thanks in advance. Oops! It appears that in the process of applying some distutils patches to the various Python trees I have, I neglected to apply it (and/or build things after applying it) to the Python 2.6 trees. As a result, the exe still had a reference to the msvc DLL. I've uploaded pywin32-212.7.win-amd64-py2.6.exe and pywin32-212.7.win32-py2.6.exe which don't reference the C runtime DLL (the problem doesn't apply to earlier python versions and the py3k builds are correct in this regard) It shouldn't be possible for me to make this mistake again as the distutils patches are now checked into Python's SVN, and please let me know if this fixes the problem. Thanks, Mark From mc at mclaveau.com Fri Jan 30 01:41:02 2009 From: mc at mclaveau.com (Michel Claveau) Date: Fri, 30 Jan 2009 01:41:02 +0100 Subject: [python-win32] Pb SxS for install In-Reply-To: <49824A61.3060606@gmail.com> References: <4EB4CDEF5CD046DD8DE51E57E2E31BC0@MCI1330> <49824A61.3060606@gmail.com> Message-ID: Re, > It shouldn't be possible for me to make this mistake again as the > distutils patches are now checked into Python's SVN, and please let me > know if this fixes the problem. OK, but... over night, after a (good ? long?) sleep (with several dreams, where Pywin32 run without problem of DLL loading with Python 2.6.1 & import socket...) @-tomorrow -- Michel Claveau From mhammond at skippinet.com.au Fri Jan 30 02:38:03 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 30 Jan 2009 12:38:03 +1100 Subject: [python-win32] Pb SxS for install In-Reply-To: References: <4EB4CDEF5CD046DD8DE51E57E2E31BC0@MCI1330> <49824A61.3060606@gmail.com> Message-ID: <009401c9827b$67153080$353f9180$@com.au> > OK, but... over night, after a (good ? long?) sleep (with several > dreams, > where Pywin32 run without problem of DLL loading with Python 2.6.1 & > import socket...) The changes in these builds will not have any affect on Python's inability to load modules when the CRT isn't installed globally - it will only allow the pywin32 installer itself to start. I guess it is likely that even though the installer should now start and install, the post-install script will still fail trying to load win32api etc. There has been a recent commit to Python itself that should fix this issue - I've put a copy of python26.dll (built yesterday from the 2.6 svn branch), at the same place as the other installers. I suspect, but haven't tested, that you could drop this DLL into your 2.6 install (including the copy in system32 if appropriate) and all such module load errors will then go away. You might be best making sure that works before you try the new installer. Cheers, Mark From imageguy1206 at gmail.com Fri Jan 30 02:58:36 2009 From: imageguy1206 at gmail.com (geoff) Date: Thu, 29 Jan 2009 20:58:36 -0500 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <4981FD71.8050409@probo.com> References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> <4981F36E.7080209@probo.com> <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> <4981FD71.8050409@probo.com> Message-ID: <3ee0b280901291758r4f336fe4r4a446ddbb9a9e2d7@mail.gmail.com> > from ctypes import * > from ctypes.wintypes import * > > class MEMORYSTATUSEX(Structure): > _fields_ = [ > ('dwLength', DWORD), > ('dwMemoryLoad', DWORD), > ('ullTotalPhys', c_ulonglong), > ('ullAvailPhys', c_ulonglong), > ('ullTotalPageFile', c_ulonglong), > ('ullAvailPageFile', c_ulonglong), > ('ullTotalVirtual', c_ulonglong), > ('ullAvailVirtual', c_ulonglong), > ('ullExtendedVirtual', c_ulonglong), > ] > > def GlobalMemoryStatusEx(): > x = MEMORYSTATUSEX() > x.dwLength = sizeof(x) > windll.kernel32.GlobalMemoryStatusEx(byref(x)) > return x > > z = GlobalMemoryStatusEx() > print z.ullAvailVirtual There does appear to be this win32api.GlobalMemoryStatusEx(). In monitoring my system before and after the process crashed, it yielded this result below - it is supposed to be a table, but I think the HTML is mangling the formatting. key: start crash ( diff) TotalPageFile: 6256201728 6256201728 ( 0) AvailVirtual: 2068193280 346382336 ( -1721810944) MemoryLoad: 33 73 ( 40) TotalPhys: 4284137472 4284137472 ( 0) AvailExtendedVirtual: 0 0 ( 0) Length: 64 64 ( 0) TotalVirtual: 2147352576 2147352576 ( 0) AvailPhys: 2849738752 1146531840 ( -1703206912) AvailPageFile: 4721647616 3014774784 ( -1706872832) If understand your guidance above, monitoring the 'AvailVirtual' should allow be to intelligently guess when the user is approaching the 'cliff' as the process is running. And I would think that examining the AvailPhys should tell me before the process starts if there might be a problem/issue with the system doing some sort of memory swapping/caching to the pagefile ? From timr at probo.com Fri Jan 30 03:10:08 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 29 Jan 2009 18:10:08 -0800 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <3ee0b280901291758r4f336fe4r4a446ddbb9a9e2d7@mail.gmail.com> References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> <4981F36E.7080209@probo.com> <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> <4981FD71.8050409@probo.com> <3ee0b280901291758r4f336fe4r4a446ddbb9a9e2d7@mail.gmail.com> Message-ID: <49826180.2040308@probo.com> geoff wrote: > > There does appear to be this win32api.GlobalMemoryStatusEx(). > It wasn't in mine (I checked there first!), but I am a couple of releases behind. > In monitoring my system before and after the process crashed, it > yielded this result below > - it is supposed to be a table, but I think the HTML is mangling the formatting. > > key: start crash ( diff) > TotalPageFile: 6256201728 6256201728 ( 0) > AvailVirtual: 2068193280 346382336 ( -1721810944) > MemoryLoad: 33 73 ( 40) > TotalPhys: 4284137472 4284137472 ( 0) > AvailExtendedVirtual: 0 0 ( 0) > Length: 64 64 ( 0) > TotalVirtual: 2147352576 2147352576 ( 0) > AvailPhys: 2849738752 1146531840 ( -1703206912) > AvailPageFile: 4721647616 3014774784 ( -1706872832) > So, you have used 1.7GB of your 2GB. It's likely that the remaining 350MB is so badly fragmented that you can't get a single chunk as large as you need. > If understand your guidance above, monitoring the 'AvailVirtual' > should allow be to intelligently guess when the user is approaching > the 'cliff' as the process is running. > Yes, indeed. > And I would think that examining the AvailPhys should tell me before > the process starts if there might be a problem/issue with the system > doing some sort of memory swapping/caching to the pagefile ? > I would caution you not to draw any conclusions based on the physical numbers. You WANT your system to be using all of its physical memory. Unused physical memory is just wasted money. The operating system will page things in and out as needed, on a demand basis, to make sure that pages you are really USING stay in memory. The other pages will be used by DLLs, other processes, and disk caching. Also remember that, if the page file gets low, the system will allocate more. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From imageguy1206 at gmail.com Fri Jan 30 03:57:55 2009 From: imageguy1206 at gmail.com (geoff) Date: Thu, 29 Jan 2009 21:57:55 -0500 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <49826180.2040308@probo.com> References: <3ee0b280901282313l5c1b25ecj2f33dd397367a56a@mail.gmail.com> <4981F36E.7080209@probo.com> <3ee0b280901291032kb494c7ah7330fa193aebb287@mail.gmail.com> <4981FD71.8050409@probo.com> <3ee0b280901291758r4f336fe4r4a446ddbb9a9e2d7@mail.gmail.com> <49826180.2040308@probo.com> Message-ID: <3ee0b280901291857v66172625i92675822efc7a282@mail.gmail.com> > > I would caution you not to draw any conclusions based on the physical > numbers. You WANT your system to be using all of its physical memory. > Unused physical memory is just wasted money. The operating system will > page things in and out as needed, on a demand basis, to make sure that > pages you are really USING stay in memory. The other pages will be used > by DLLs, other processes, and disk caching. Also remember that, if the > page file gets low, the system will allocate more. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. Thanks for your help. g. From mc at mclaveau.com Fri Jan 30 09:58:25 2009 From: mc at mclaveau.com (Michel Claveau) Date: Fri, 30 Jan 2009 09:58:25 +0100 Subject: [python-win32] Pb SxS for install In-Reply-To: <009401c9827b$67153080$353f9180$@com.au> References: <4EB4CDEF5CD046DD8DE51E57E2E31BC0@MCI1330> <49824A61.3060606@gmail.com> <009401c9827b$67153080$353f9180$@com.au> Message-ID: <5F7A30C81B0B4D9F8F9C4F69940D044D@MCI1330> Re! I hope you understand me, and my very bad english. - For tests, I use virtual computers (Virtualbox), and I restore the test-machine between each test. - I try on a: Vista-home-premium (like "new, taken out of factory") + IE-8 rc1 ; french versions - With the same conditions as yesterday, your new installer (pywin32-212.7.win32-py2.6.exe) run OK. But, after, it's my softwares who have SxS problem!!! - With your (special) Python26.dll copied in %windir%\system32, it is same. - But, it is OK if: - I deactivate UAC, - re-install (repair) Python 2.6.1 (that keep your Python26.dll in %windir%\system32) and, bizarre, if I re-activate UAC, all run OK, then... (all problems solved, including "Python-dll-CRT-90") I continue some tests. I will try : - first installs with UAC deactivated prior. - reboot after copy the Python26.dll (with and without UAC) - run all install/copy/configure under Admin, and under single user - test with Windows-7 and XP (I have anothers virtual computers) - etc. Thank you for yours contributions, and have a good day. -- Michel Claveau From metolone+gmane at gmail.com Fri Jan 30 15:15:45 2009 From: metolone+gmane at gmail.com (Mark Tolonen) Date: Fri, 30 Jan 2009 06:15:45 -0800 Subject: [python-win32] Serious bug in pywin32? Message-ID: Today I ran PythonWin and accidentally typed 'python' at the interactive prompt out of habit, since I often use the cmd prompt instead. PythonWin immediately crashed. I re-ran PythonWin and tried again. Same crash. Ran again...typed 'import os'. No crash, but the interactive prompt hung. Anything typed at the interactive prompt now hangs. I have removed and reinstalled pywin32. I even removed and reinstalled my entire Python 2.6.1 installation (including deleting any Python-related keys in the registry). It still doesn't work :'( Python itself (run from the command line) gives the expected: Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> python Traceback (most recent call last): File "", line 1, in NameError: name 'python' is not defined Any ideas how to get PythonWin working again? Anyone else see the same issue (don't try this on your favorite system). I will file a bug on SourceForge. -Mark From rdahlstrom at directedge.com Fri Jan 30 15:44:27 2009 From: rdahlstrom at directedge.com (Dahlstrom, Roger) Date: Fri, 30 Jan 2009 09:44:27 -0500 Subject: [python-win32] Serious bug in pywin32? In-Reply-To: References: Message-ID: <70D9B06B9E99EE4E98E4893703ADA1411199A3EAAA@EXCHANGE1.global.knight.com> Tried it in a few versions on a couple computers, and was unable to reproduce. -----Original Message----- From: python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On Behalf Of Mark Tolonen Sent: Friday, January 30, 2009 9:16 AM To: python-win32 at python.org Subject: [python-win32] Serious bug in pywin32? Today I ran PythonWin and accidentally typed 'python' at the interactive prompt out of habit, since I often use the cmd prompt instead. PythonWin immediately crashed. I re-ran PythonWin and tried again. Same crash. Ran again...typed 'import os'. No crash, but the interactive prompt hung. Anything typed at the interactive prompt now hangs. I have removed and reinstalled pywin32. I even removed and reinstalled my entire Python 2.6.1 installation (including deleting any Python-related keys in the registry). It still doesn't work :'( Python itself (run from the command line) gives the expected: Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> python Traceback (most recent call last): File "", line 1, in NameError: name 'python' is not defined Any ideas how to get PythonWin working again? Anyone else see the same issue (don't try this on your favorite system). I will file a bug on SourceForge. -Mark _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 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, and any attachments thereto, is strictly 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. E-mail transmission cannot be guaranteed to be secure or error-free. 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. NOTICE REGARDING PRIVACY AND CONFIDENTIALITY Direct Edge ECN LLC may, at its discretion, monitor and review the content of all e-mail communications. www.directedge.com From metolone+gmane at gmail.com Fri Jan 30 16:13:39 2009 From: metolone+gmane at gmail.com (Mark Tolonen) Date: Fri, 30 Jan 2009 07:13:39 -0800 Subject: [python-win32] Serious bug in pywin32? References: <70D9B06B9E99EE4E98E4893703ADA1411199A3EAAA@EXCHANGE1.global.knight.com> Message-ID: "Dahlstrom, Roger" wrote in message news:70D9B06B9E99EE4E98E4893703ADA1411199A3EAAA at EXCHANGE1.global.knight.com... > Tried it in a few versions on a couple computers, and was unable to > reproduce. > > -----Original Message----- > From: python-win32-bounces+rdahlstrom=directedge.com at python.org > [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On > Behalf Of Mark Tolonen > Sent: Friday, January 30, 2009 9:16 AM > To: python-win32 at python.org > Subject: [python-win32] Serious bug in pywin32? > > Today I ran PythonWin and accidentally typed 'python' at the interactive > prompt out of habit, since I often use the cmd prompt instead. PythonWin > immediately crashed. I re-ran PythonWin and tried again. Same crash. > Ran > again...typed 'import os'. No crash, but the interactive prompt hung. > Anything typed at the interactive prompt now hangs. > > I have removed and reinstalled pywin32. I even removed and reinstalled my > entire Python 2.6.1 installation (including deleting any Python-related > keys > in the registry). It still doesn't work :'( > > Python itself (run from the command line) gives the expected: > > Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit > (Intel)] > on > win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> python > Traceback (most recent call last): > File "", line 1, in > NameError: name 'python' is not defined > > Any ideas how to get PythonWin working again? Anyone else see the same > issue (don't try this on your favorite system). I will file a bug on > SourceForge. I tracked down the source of the problem. I am using Windows XP, SP3. Two days ago I changed Control Panel, Regional and Language Options, Advanced tab, "Select a language to match the language version of the non-Unicode programs you want to use:" from "English (United States)" to "Chinese (PRC)" to work with Python 2.6 and 3.0 Unicode scripts dealing with Chinese characters at the console prompt. I was able to fix the problem by returning the setting to English, and reproduce the problem by setting it back to Chinese. It turns out typing any command that throws an exception will crash PythonWin with this setting, and any valid command hangs the interactive prompt. I thought I'd used PythonWin since making the change, but it was probably on another computer. Does PythonWin normally work on Chinese Windows, where this setting would be the default? I imagine any Chinese programmer wouldn't use PythonWin since it doesn't support Unicode to begin with, although that may change for the eventual 3.0 release. Anybody willing to try to reproduce this scenario before I file a bug? -Mark From davihigh at gmail.com Fri Jan 30 16:59:34 2009 From: davihigh at gmail.com (David Xiao) Date: Fri, 30 Jan 2009 23:59:34 +0800 Subject: [python-win32] Pythonwin crashes everytime In-Reply-To: <1204b5030901300756ia2b7b6dmbe13c09e39637f12@mail.gmail.com> References: <1204b5030901300756ia2b7b6dmbe13c09e39637f12@mail.gmail.com> Message-ID: <1204b5030901300759t1ebbfaas9d448effa141dacd@mail.gmail.com> Hi pythonwin users, Pythonwin crashes everytime when I simply type several lines of text in it. What could be the reason? vista, python 2.6.1, pywin32 build 212. BTW, i have tried on XP sp3, python 2.5.4, crashed as well! BR, David From cappy2112 at gmail.com Fri Jan 30 19:57:27 2009 From: cappy2112 at gmail.com (Tony Cappellini) Date: Fri, 30 Jan 2009 10:57:27 -0800 Subject: [python-win32] How to calc amount of avail RAM in a process ? Message-ID: <8249c4ac0901301057m34b88006r4b4a33d94da87653@mail.gmail.com> Tim While monitoring The task manager/Performance Tab It seems as though Windows XP is almost always paging, even when all of available memory is not being used. This doesn't make sense and seems to be wasteful. Why should the OS be wasting time paging, when it doesn't need to (aka when all of available physical ram has not been used)? > I would caution you not to draw any conclusions based on the physical > numbers. You WANT your system to be using all of its physical memory. > Unused physical memory is just wasted money. The operating system will > page things in and out as needed, on a demand basis, to make sure that > pages you are really USING stay in memory. The other pages will be used > by DLLs, other processes, and disk caching. Also remember that, if the > page file gets low, the system will allocate more. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From efotinis at yahoo.com Fri Jan 30 20:19:55 2009 From: efotinis at yahoo.com (Elias Fotinis) Date: Fri, 30 Jan 2009 11:19:55 -0800 (PST) Subject: [python-win32] Serious bug in pywin32? In-Reply-To: Message-ID: <910266.84177.qm@web52901.mail.re2.yahoo.com> --- On Fri, 1/30/09, Mark Tolonen wrote: > Two days ago I changed Control > Panel, Regional and Language Options, Advanced tab, > "Select a language to match the language version of the > non-Unicode programs you want to use:" from > "English (United States)" to "Chinese > (PRC)" to work with Python 2.6 and 3.0 Unicode scripts > dealing with Chinese characters at the console prompt. I tried that and got the same behavior. This must be related to the Scintilla bug I mentioned earlier ("PythonWin non-ascii chars typing bug" on Jan 26). The first of my suggestions (downgrading to Scintilla 1.74) will resolve this (at least with ASCII chars; I didn't try with Chinese). The second one (Scintilla 1.77 + SCI_SETKEYSUNICODE) doesn't help with Chinese, even though it works for a Greek system codepage (cp1253). Probably because the Chinese codepage is multibyte. From timr at probo.com Fri Jan 30 21:04:37 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 30 Jan 2009 12:04:37 -0800 Subject: [python-win32] How to calc amount of avail RAM in a process ? In-Reply-To: <8249c4ac0901301057m34b88006r4b4a33d94da87653@mail.gmail.com> References: <8249c4ac0901301057m34b88006r4b4a33d94da87653@mail.gmail.com> Message-ID: <49835D55.6000709@probo.com> Tony Cappellini wrote: > > While monitoring The task manager/Performance Tab > > It seems as though Windows XP is almost always paging, even when all > of available memory > is not being used. > > This doesn't make sense and seems to be wasteful. Why should the OS be > wasting time paging, when it doesn't need to (aka when all of > available physical ram has not been used)? What leads you to believe it is paging? All pageable memory is "backed" by pages in the page file as soon as it is allocated, even though it hasn't been copied there yet. The "PF Usage" page in Task Manager shows how much of the page file is committed, so it includes memory that is currently in use, even if it those pages haven't really been written to disk yet. The Windows paging subsystem is one of the most highly tuned parts of the operating system; it generally behaves pretty sensibly. Also, a certain percentage of physical memory is reserved for "non-paged pool" in the kernel, which is used by drivers for critical buffers and for DMA, among other things. Thus, you can be out of "paged pool" even when there is unused physical memory remaining. Virtual memory is a surprisingly difficult thing to nail down. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From bgailer at gmail.com Fri Jan 30 23:08:22 2009 From: bgailer at gmail.com (bob gailer) Date: Fri, 30 Jan 2009 17:08:22 -0500 Subject: [python-win32] Bug? Can't resize watch window when displayed on 2nd monitor. Message-ID: <49837A56.50703@gmail.com> Bug? Can't resize watch window when displayed on 2nd monitor. -- Bob Gailer Chapel Hill NC 919-636-4239 From mhammond at skippinet.com.au Fri Jan 30 23:37:56 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 31 Jan 2009 09:37:56 +1100 Subject: [python-win32] Pb SxS for install In-Reply-To: <5F7A30C81B0B4D9F8F9C4F69940D044D@MCI1330> References: <4EB4CDEF5CD046DD8DE51E57E2E31BC0@MCI1330> <49824A61.3060606@gmail.com> <009401c9827b$67153080$353f9180$@com.au> <5F7A30C81B0B4D9F8F9C4F69940D044D@MCI1330> Message-ID: <00b801c9832b$68b0a810$3a11f830$@com.au> Thanks for testing this. > - With the same conditions as yesterday, your new installer > (pywin32-212.7.win32-py2.6.exe) run OK. But, after, it's my softwares > who > have SxS problem!!! What problems exactly? IIUC, we have determined that unless the CRT assembly is installed globally, every .DLL or .EXE which references the VC9 CRT must have a copy of that CRT next to itself. For example, if python26.dll references the CRT and socket.pyd references the CRT via its menifest, and these files are not in the same directory, 2 copies of the CRT are needed - the socket module will *not* be use the one *already loaded* by python. Or something like that :) So, the approach taken by Python now is: * python26.dll references the assembly in its manifest. * .pyd files do *not* reference the manifest. * Before python26.dll attempts to load modules, it explicitly re-activates its own "activation context". This causes the assemblies references in python26.dll to be used when satisfying the .pyd imports - so no extra CRT is needed. * bdist_wininst created exectuables (like the pywin32 installer) now embed a static copy of the C runtime library. These should all conspire to work in most cases - so I'd be interested to know how your software fits in this. Is your software .pyd files? If so, you probably need to make sure they so *not* embed a manifest - which later distutils take care of for you. Hope this is helpful, Mark From skippy.hammond at gmail.com Fri Jan 30 23:39:07 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 31 Jan 2009 09:39:07 +1100 Subject: [python-win32] Serious bug in pywin32? In-Reply-To: References: <70D9B06B9E99EE4E98E4893703ADA1411199A3EAAA@EXCHANGE1.global.knight.com> Message-ID: <4983818B.1090105@gmail.com> Please file a bug and I'll try and nail it before the next release (pythonwin itself is now much more unicode aware - it now even allows each file to have its own encoding - but I'm yet to implement the encoding detection beyond detecting a BOM...) Note I'm not that familiar with changing language etc options, so please try and be as explicit as possible in the repro steps. Cheers, Mark On 31/01/2009 2:13 AM, Mark Tolonen wrote: > "Dahlstrom, Roger" wrote in message > news:70D9B06B9E99EE4E98E4893703ADA1411199A3EAAA at EXCHANGE1.global.knight.com... > >> Tried it in a few versions on a couple computers, and was unable to >> reproduce. >> >> -----Original Message----- >> From: python-win32-bounces+rdahlstrom=directedge.com at python.org >> [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On >> Behalf Of Mark Tolonen >> Sent: Friday, January 30, 2009 9:16 AM >> To: python-win32 at python.org >> Subject: [python-win32] Serious bug in pywin32? >> >> Today I ran PythonWin and accidentally typed 'python' at the interactive >> prompt out of habit, since I often use the cmd prompt instead. PythonWin >> immediately crashed. I re-ran PythonWin and tried again. Same crash. Ran >> again...typed 'import os'. No crash, but the interactive prompt hung. >> Anything typed at the interactive prompt now hangs. >> >> I have removed and reinstalled pywin32. I even removed and reinstalled my >> entire Python 2.6.1 installation (including deleting any >> Python-related keys >> in the registry). It still doesn't work :'( >> >> Python itself (run from the command line) gives the expected: >> >> Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit >> (Intel)] >> on >> win32 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> python >> Traceback (most recent call last): >> File "", line 1, in >> NameError: name 'python' is not defined >> >> Any ideas how to get PythonWin working again? Anyone else see the same >> issue (don't try this on your favorite system). I will file a bug on >> SourceForge. > > I tracked down the source of the problem. > > I am using Windows XP, SP3. Two days ago I changed Control Panel, > Regional and Language Options, Advanced tab, "Select a language to match > the language version of the non-Unicode programs you want to use:" from > "English (United States)" to "Chinese (PRC)" to work with Python 2.6 and > 3.0 Unicode scripts dealing with Chinese characters at the console > prompt. I was able to fix the problem by returning the setting to > English, and reproduce the problem by setting it back to Chinese. It > turns out typing any command that throws an exception will crash > PythonWin with this setting, and any valid command hangs the interactive > prompt. > > I thought I'd used PythonWin since making the change, but it was > probably on another computer. Does PythonWin normally work on Chinese > Windows, where this setting would be the default? I imagine any Chinese > programmer wouldn't use PythonWin since it doesn't support Unicode to > begin with, although that may change for the eventual 3.0 release. > > Anybody willing to try to reproduce this scenario before I file a bug? > > -Mark > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From skippy.hammond at gmail.com Fri Jan 30 23:42:11 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 31 Jan 2009 09:42:11 +1100 Subject: [python-win32] Bug? Can't resize watch window when displayed on 2nd monitor. In-Reply-To: <49837A56.50703@gmail.com> References: <49837A56.50703@gmail.com> Message-ID: <49838243.9090902@gmail.com> On 31/01/2009 9:08 AM, bob gailer wrote: > Bug? Can't resize watch window when displayed on 2nd monitor. This works for me on Python 2.6, but does behave strangely on Python 2.5. I suspect this is a bug in MFC fixed in the later version used by 2.6 builds. Cheers, Mark From timr at probo.com Sat Jan 31 01:23:55 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 30 Jan 2009 16:23:55 -0800 Subject: [python-win32] Pb SxS for install In-Reply-To: <00b801c9832b$68b0a810$3a11f830$@com.au> References: <4EB4CDEF5CD046DD8DE51E57E2E31BC0@MCI1330> <49824A61.3060606@gmail.com> <009401c9827b$67153080$353f9180$@com.au> <5F7A30C81B0B4D9F8F9C4F69940D044D@MCI1330> <00b801c9832b$68b0a810$3a11f830$@com.au> Message-ID: <49839A1B.4010609@probo.com> Mark Hammond wrote: > IIUC, we have determined that unless the CRT assembly is installed globally, > every .DLL or .EXE which references the VC9 CRT must have a copy of that CRT > next to itself. For example, if python26.dll references the CRT and > socket.pyd references the CRT via its menifest, and these files are not in > the same directory, 2 copies of the CRT are needed - the socket module will > *not* be use the one *already loaded* by python. Or something like that :) > Not quite, but almost. A manifest resource has a number, like all resources. That number determines the "scope" of the manifest. A manifest with number 1 becomes the default manifest for the whole process. A manifest with number 2 is a manifest only for the binary in which it is contained. So, if python26.dll includes a manifest #2, that only applies to python26.dll. Any other DLLs must include their own manifests to point to the CRT, otherwise you get an activation error. But if python26.dll includes a manifest #1, then it becomes the default manifest for the process, and other DLLs do not have to include their own. The complication happens when the exe has its own #1 manifest. Does the python26.dll manifest override it? I'm not sure the answer is written down anywhere. Side-by-side is an abortion. It is an incredibly baroque solution to a problem that programmers outside of Redmond learned how to handle more than a decade ago. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From skippy.hammond at gmail.com Sat Jan 31 03:44:55 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 31 Jan 2009 13:44:55 +1100 Subject: [python-win32] Pb SxS for install In-Reply-To: <49839A1B.4010609@probo.com> References: <4EB4CDEF5CD046DD8DE51E57E2E31BC0@MCI1330> <49824A61.3060606@gmail.com> <009401c9827b$67153080$353f9180$@com.au> <5F7A30C81B0B4D9F8F9C4F69940D044D@MCI1330> <00b801c9832b$68b0a810$3a11f830$@com.au> <49839A1B.4010609@probo.com> Message-ID: <4983BB27.6010407@gmail.com> On 31/01/2009 11:23 AM, Tim Roberts wrote: > Mark Hammond wrote: >> IIUC, we have determined that unless the CRT assembly is installed globally, >> every .DLL or .EXE which references the VC9 CRT must have a copy of that CRT >> next to itself. For example, if python26.dll references the CRT and >> socket.pyd references the CRT via its menifest, and these files are not in >> the same directory, 2 copies of the CRT are needed - the socket module will >> *not* be use the one *already loaded* by python. Or something like that :) >> > > Not quite, but almost. > > A manifest resource has a number, like all resources. That number > determines the "scope" of the manifest. A manifest with number 1 > becomes the default manifest for the whole process. A manifest with > number 2 is a manifest only for the binary in which it is contained. > > So, if python26.dll includes a manifest #2, that only applies to > python26.dll. Any other DLLs must include their own manifests to point > to the CRT, otherwise you get an activation error. But if python26.dll > includes a manifest #1, then it becomes the default manifest for the > process, and other DLLs do not have to include their own. Interesting. In most of these failure scenarios, the executable itself doesn't have a reference to the assembly - only the DLL does. The DLL has a manifest with an ID of 2 - I seem to recall having problems trying to use an ID of 1 with a DLL, but I can't be sure. Regardless, as you mention, it's unclear what happens when such a DLL is loaded - it *replaces* any manifest with an ID of 1 the executable might have had? So - in the case of mod_python or COM objects, the executable doesn't reference the assembly, but Python's DLL does - which in terms of the above, implies there is no "default manifest" for the process. We've used the ActivateActCtx() etc functions to allow these DLLs to load correctly. http://bugs.python.org/issue4566 is what I am basing my faulty recollections from :) Cheers, Mark From metolone+gmane at gmail.com Sat Jan 31 06:13:17 2009 From: metolone+gmane at gmail.com (Mark Tolonen) Date: Fri, 30 Jan 2009 21:13:17 -0800 Subject: [python-win32] Serious bug in pywin32? References: <910266.84177.qm@web52901.mail.re2.yahoo.com> Message-ID: "Elias Fotinis" wrote in message news:910266.84177.qm at web52901.mail.re2.yahoo.com... > --- On Fri, 1/30/09, Mark Tolonen wrote: >> Two days ago I changed Control >> Panel, Regional and Language Options, Advanced tab, >> "Select a language to match the language version of the >> non-Unicode programs you want to use:" from >> "English (United States)" to "Chinese >> (PRC)" to work with Python 2.6 and 3.0 Unicode scripts >> dealing with Chinese characters at the console prompt. > > I tried that and got the same behavior. This must be related to the > Scintilla bug I mentioned earlier ("PythonWin non-ascii chars typing bug" > on Jan 26). > > The first of my suggestions (downgrading to Scintilla 1.74) will resolve > this (at least with ASCII chars; I didn't try with Chinese). > > The second one (Scintilla 1.77 + SCI_SETKEYSUNICODE) doesn't help with > Chinese, even though it works for a Greek system codepage (cp1253). > Probably because the Chinese codepage is multibyte. Great, thanks for reproducing. The crash dialog does implicate the scintilla.dll as the location of the fault. I'll file the bug. -Mark From metolone+gmane at gmail.com Sat Jan 31 06:16:46 2009 From: metolone+gmane at gmail.com (Mark Tolonen) Date: Fri, 30 Jan 2009 21:16:46 -0800 Subject: [python-win32] Serious bug in pywin32? References: <70D9B06B9E99EE4E98E4893703ADA1411199A3EAAA@EXCHANGE1.global.knight.com> <4983818B.1090105@gmail.com> Message-ID: "Mark Hammond" wrote in message news:4983818B.1090105 at gmail.com... > Please file a bug and I'll try and nail it before the next release > (pythonwin itself is now much more unicode aware - it now even allows each > file to have its own encoding - but I'm yet to implement the encoding > detection beyond detecting a BOM...) > > Note I'm not that familiar with changing language etc options, so please > try and be as explicit as possible in the repro steps. No problem. I'll do it tonight. I'm looking forward to your release. IDLE handles Chinese, but I like the PythonWin interface better. -Mark From skippy.hammond at gmail.com Sat Jan 31 06:37:05 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 31 Jan 2009 16:37:05 +1100 Subject: [python-win32] Serious bug in pywin32? In-Reply-To: References: <70D9B06B9E99EE4E98E4893703ADA1411199A3EAAA@EXCHANGE1.global.knight.com> <4983818B.1090105@gmail.com> Message-ID: <4983E381.5030102@gmail.com> On 31/01/2009 4:16 PM, Mark Tolonen wrote: > "Mark Hammond" wrote in message > news:4983818B.1090105 at gmail.com... >> Please file a bug and I'll try and nail it before the next release >> (pythonwin itself is now much more unicode aware - it now even allows >> each file to have its own encoding - but I'm yet to implement the >> encoding detection beyond detecting a BOM...) >> >> Note I'm not that familiar with changing language etc options, so >> please try and be as explicit as possible in the repro steps. > > No problem. I'll do it tonight. I'm looking forward to your release. > IDLE handles Chinese, but I like the PythonWin interface better. While the recent pythonwin unicode changes are in my head, I've had another play. I upgraded Scintilla and implemented the suggestion from Elias, implemented pep283 support (yay!) and have managed to get things working correctly everywhere I've tested (editing, printing interactively, running, copy-pasting, etc) with the appropriate unicode character being displayed and/or saved in the correct encoding. My testing is done with "simple" extended characters (eg, the "copyright symbol, \xa9, or "hold alt down while pressing 0169 on the numeric keypad" :) so I may yet be missing some more complex cases. If either of you - or anyone else with experience in this area - are brave and willing to test this out, I'll send you an email with the location of a build you can grab and see if (or hopefully how ) things have improved. Thanks, Mark From metolone+gmane at gmail.com Sat Jan 31 07:09:34 2009 From: metolone+gmane at gmail.com (Mark Tolonen) Date: Fri, 30 Jan 2009 22:09:34 -0800 Subject: [python-win32] Serious bug in pywin32? References: <70D9B06B9E99EE4E98E4893703ADA1411199A3EAAA@EXCHANGE1.global.knight.com> <4983818B.1090105@gmail.com> <4983E381.5030102@gmail.com> Message-ID: "Mark Hammond" wrote in message news:4983E381.5030102 at gmail.com... [snip] > If either of you - or anyone else with experience in this area - are brave > and willing to test this out, I'll send you an email with the location of > a build you can grab and see if (or hopefully how ) things have > improved. Sure, I'll try it. My posting email is valid. -Mark From vinaya at adobe.com Sat Jan 31 07:07:56 2009 From: vinaya at adobe.com (Vinay Anantharaman) Date: Fri, 30 Jan 2009 22:07:56 -0800 Subject: [python-win32] VIX (VMware API to control workstation) casting problem Message-ID: Hi, I am trying to cast from one object type to another type. Which is ISnapshot to IVixHandle. My code: #Dispach + connecting to lib and getting a handle to a VM root = vmHandle.GetRootSnapshot(0)[1] rootC = root.GetChild(0)[1] ivixHandle = win32com.client.CastTo(rootC, 'IVixHandle') name = ivixHandle.GetProperties([CONST.VIX_PROPERTY_SNAPSHOT_DISPLAYNAME], None) Result: Traceback (most recent call last): File "Z:\prototype.py", line 20 s = ivixHandle.GetProperties([CONST.VIX_PROPERTY_SNAPSHOT_DISPLAYNAME], None) File "C:\Users\vinaya\AppData\Local\Temp\gen_py\2.4\7A474EE3-0062-4239-AE91-134AC9BD5FD3x0x1x0.py", line 1269, in GetProperties , propertiesArray) File "C:\Python24\lib\site-packages\win32com\client\__init__.py", line 446, in _ApplyTypes_ return self._get_good_object_( pywintypes.com_error: (-2147352571, 'Type mismatch.', None, 1) The signature of the method is: HRESULT GetProperties([in] VARIANT propertyIDs, [in,out] VARIANT* propertiesArray, [out,retval] ULONGLONG* error); The documentation(http://www.vmware.com/support/developer/vix-api/vix16_reference/lang/com/functions/GetProperties.html) says this: This function does not apply in VBScript, since it is not possible to access the IVixHandle interface of an object. Also, this is the way to code(using another handle which is castable to IVixHandle) in C#: VixCOM.IVM vm; UInt64 err; // ...Open the virtual machine and get a handle... int[] propertyIDs = new int[] {VixCOM.Constants.VIX_PROPERTY_VM_POWER_STATE, VixCOM.Constants.VIX_PROPERTY_VM_VMX_PATHNAME}; object properties = null; err = ((VixCOM.IVixHandle)vm).GetProperties(propertyIDs, ref properties); if (lib.ErrorIndicatesFailure(err)) { // Handle the error... } int vmPowerState = ((object[])properties)[0]; // VixCOM.Constants.VIX_PROPERTY_VM_POWER_STATE string vmPathName = ((object[])properties)[1]; // VixCOM.Constants.VIX_PROPERTY_VM_VMX_PATHNAME Is there anyway I can get access to this functionality? Thanks, Vinay A. From skippy.hammond at gmail.com Sat Jan 31 08:27:43 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 31 Jan 2009 18:27:43 +1100 Subject: [python-win32] VIX (VMware API to control workstation) casting problem In-Reply-To: References: Message-ID: <4983FD6F.4000207@gmail.com> On 31/01/2009 5:07 PM, Vinay Anantharaman wrote: ... > The documentation(http://www.vmware.com/support/developer/vix-api/vix16_reference/lang/com/functions/GetProperties.html) says this: > > This function does not apply in VBScript, since it is not possible to access the IVixHandle interface of an object. That is probably due to the interface not supporting IDispatch - which currently means pywin32 also can't take advantage of it. You might like to look at the ctypes-based comtypes... Cheers, Mark From fuzzyman at gmail.com Sat Jan 31 22:22:39 2009 From: fuzzyman at gmail.com (Michael Foord) Date: Sat, 31 Jan 2009 21:22:39 +0000 Subject: [python-win32] IronPython at PyCon 2009 Message-ID: <6f4025010901311322w4221a2fau569c414c587d7c0d@mail.gmail.com> (Slightly off-topic, sorry.) The talk schedule has gone up for for PyCon 2009 in Chicago. There are three talks on IronPython, plus a tutorial on the Wednesday before the conference. The conference dates are: * March 25-26th Tutorial Days * March 27-29th Conference * March 30th - April 2nd Development Sprints Jim Hugunin is one of the invited speakers, so his talk doesn't yet appear on the schedule - but his usual talk is "IronPython the Road Ahead". I've blogged about all the talks, plus the tutorial that Jonathan Hartley and I will be giving, on IronPython URLs. http://ironpython-urls.blogspot.com/2009/01/ironpython-at-pycon-2009.html All the best, Michael Foord -- http://www.ironpythoninaction.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: