From mhammond at skippinet.com.au Fri Jul 2 02:05:20 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Jul 2 02:05:29 2004 Subject: [python-win32] ANN: pywin32 (win32all) build 202 available Message-ID: <08a201c45ffa$90faba30$0200a8c0@eden> Hi all, I have just released build 202 of the pywin32 extensions. These extensions were previously known as the "win32all" extensions. Most installation related issues have been fixed, and the usual round of minor bug-fixes and enhancements. The release notes are at: https://sourceforge.net/project/shownotes.php?release_id=250260 And the download can be found via: https://sourceforge.net/project/showfiles.php?group_id=78018 Regards, Mark. From mhammond at skippinet.com.au Fri Jul 2 02:18:30 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Jul 2 02:18:32 2004 Subject: [python-win32] Converting VB to Python In-Reply-To: <5D7E001D106BA1468625E7905D088F4FE592F7@MC25GLG.scotland.gov.uk> Message-ID: <08a301c45ffc$6613afa0$0200a8c0@eden> The equivalent of "implements" is for your Python COM object to support that interface, like any other COM interface. The slightly tricky thing here is that the interface is described in a type-library. So, you code would look something like: from win32com import universal universal.RegisterInterfaces( '{F5078F18-C551-11D3-89B9-0000F81FE221}', 0, 4, 0, ["_IVBSAXErrorHandler"]) class MyHandler: _com_interfaces_ = ['IVBSAXErrorHandler'] def error(self, locator, strError, nErrorCode): ... Note that the magic numbers passed to RegisterInterfaces is the ID of the type-library. I obtained these by running "makepy.py -i", then selecting the Microsoft XML library version 4. (Version 2 didn't have this interface) To setup the validator, the code would look something like: # create the instance validator = MyHandler() # turn it into a COM object from win32com.server.util import wrap validator = wrap(validator) rdr.errorHandler = validator Note that: validator = wrap(validator, debug=1) May be useful if the code does not run from a console - Pythonwin's "Remote Collector" will see any output or errors generated by your object. I hope this makes sense. Mark. -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Peter.Winstanley@scotland.gsi.gov.uk Sent: Wednesday, 30 June 2004 4:32 PM To: python-win32@python.org Subject: [python-win32] Converting VB to Python **************************************************************************** *************************************************************************** This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. **************************************************************************** *************************************************************************** I would be grateful for help and advice on the following: I am trying to convert into Python an example VB program that uses MSXML 4.0 and the SAXXMLReader40 and XMLSchemaCache40 to validate an XML file against an XSD schema and to provide exhaustive errors. The routine is given here: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q315497 In the VB version a class module is created to act as an error handler. The class starts with the statement "Implements MSXML2.IVBSAXErrorHandler" How do I convert an "Implements" statement to Python? Thanks for your help The original of this email was scanned for viruses by the Government Secure Intranet (GSi) virus scanning service supplied exclusively by Energis in partnership with MessageLabs. On leaving the GSi this email was certified virus-free -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3144 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040702/9aff01dd/winmail.bin From tim.golden at viacom-outdoor.co.uk Fri Jul 2 03:49:14 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri Jul 2 03:52:11 2004 Subject: [python-win32] ANN: pywin32 (win32all) build 202 available Message-ID: MH> Hi all, MH> I have just released build 202 of the pywin32 extensions. These MH> extensions were previously known as the "win32all" extensions. Long overdue vote of thanks for pywin32. I do all my professional programming on Win32 (and most of my private stuff, too) and without the win32 extensions Python would simply be a much weaker candidate. As it is, it's the answer to pretty much every need thrown at me, from database programming (my official job) to making sure some high-profile advertising display screens stay dialled-up to our VPN. >From trawling users' over-large Exchange mail boxes to write out their attachments to disk to programming block-graphics availability screens for our sales teams. And loads more. Thanks again Tim ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From tim.golden at viacom-outdoor.co.uk Fri Jul 2 10:58:48 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri Jul 2 11:01:48 2004 Subject: [python-win32] Any way to get PyHANDLE for any running proces s? Message-ID: | I am having a problem of a process not closing when it | should, actually | stemming from IE's COM object, and it prevents me from | creating another | IE COM object. I would like to have some way to check if | IEXPLORE.EXE | is already running, and if so, then kill it. FWIW, you can do this quite easily with wmi: import wmi c = wmi.WMI () for p in c.Win32_Process (Name="IEXPLORE.EXE"): p.Terminate () TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From jens.jorgensen at tallan.com Fri Jul 2 11:05:03 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Fri Jul 2 11:05:12 2004 Subject: [python-win32] Any way to get PyHANDLE for any running process? In-Reply-To: <40E1BCA2.5080802@ocf.berkeley.edu> References: <40E1BCA2.5080802@ocf.berkeley.edu> Message-ID: <40E5799F.9080406@tallan.com> Hmmm, EnumProcesses would be oneWin32 call to get at this but for whatever reason I don't see that call present in win32process. Odd. I think you may be able to enumerate them through WMI and then use win32api.OpenProcess to get the handle to it. I'd look down that avenue. Brett Cannon wrote: > I am having a problem of a process not closing when it should, > actually stemming from IE's COM object, and it prevents me from > creating another IE COM object. I would like to have some way to > check if IEXPLORE.EXE is already running, and if so, then kill it. > > I noticed win32process.TerminateProcess(), but it wants a PyHANDLE and > I can't figure out how to create one for any process other than the > currently running one. > > Any help on this would be great. Already sick of doing it manually > through the Task Manager. > > -Brett > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3108 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040702/55a8f923/smime.bin From Paul.Moore at atosorigin.com Fri Jul 2 11:06:37 2004 From: Paul.Moore at atosorigin.com (Moore, Paul) Date: Fri Jul 2 11:06:37 2004 Subject: [python-win32] Any way to get PyHANDLE for any running process? Message-ID: <16E1010E4581B049ABC51D4975CEDB8803060F06@UKDCX001.uk.int.atosorigin.com> From: Brett Cannon > I noticed win32process.TerminateProcess(), but it wants a PyHANDLE and I > can't figure out how to create one for any process other than the > currently running one. > Any help on this would be great. Already sick of doing it manually > through the Task Manager. If you don't need to use Python, Systems Internals' pstools package at http://www.sysinternals.com/ntw2k/freeware/pstools.shtml includes a pskill utility - pskill iexplore will kill all iexplore processes. Otherwise, you need stuff from the win32process module. You can use win32process.EnumProcesses to get all processes and then win32api.OpenProcess to convert a pid to a pyHandle, then win32process.GetModuleFileNameEx with a hModule of 0 to get the executable name. Once you have that, you can decide whether it's the one you want to kill... Maybe there's a simpler way, but that would be a bit of a novelty when dealing with the Win32 API :-) Hope this helps, Paul. __________________________________________________________________________ This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. __________________________________________________________________________ From olavi at city.ee Fri Jul 2 11:08:32 2004 From: olavi at city.ee (Olavi Ivask) Date: Fri Jul 2 11:10:17 2004 Subject: [python-win32] Connecting to MySQL In-Reply-To: <000701c4588b$628cce70$054b12ac@D18SYX41> References: <000701c4588b$628cce70$054b12ac@D18SYX41> Message-ID: <40E57A70.9040607@city.ee> Download mysql-python from http://sourceforge.net/projects/mysql-python...unzip content into python23/Lib folder. You can test it by typing : import MySQLdb Olavi Ivask Greg Lindstrom wrote: >Hello- >I am running MySQL 4. (just pulled it today) on Windows XP "Professional". >What package(s) is/are available to connect to it from Python and how do I >go about doing it? > >Thanks! >--greg > >Greg Lindstrom (501) 975-4859 >NovaSys Health greg.lindstrom@novasyshealth.com > >"We are the music makers, and we are the dreamers of dreams" W.W. > > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > From olavi at city.ee Fri Jul 2 11:09:54 2004 From: olavi at city.ee (Olavi Ivask) Date: Fri Jul 2 11:11:41 2004 Subject: [python-win32] Connecting to MySQL In-Reply-To: <000701c4588b$628cce70$054b12ac@D18SYX41> References: <000701c4588b$628cce70$054b12ac@D18SYX41> Message-ID: <40E57AC2.4060709@city.ee> Download mysql-python from http://sourceforge.net/projects/mysql-python ...unzip content into python23/Lib folder. You can test it by typing : import MySQLdb Olavi Ivask Greg Lindstrom wrote: >Hello- >I am running MySQL 4. (just pulled it today) on Windows XP "Professional". >What package(s) is/are available to connect to it from Python and how do I >go about doing it? > >Thanks! >--greg > >Greg Lindstrom (501) 975-4859 >NovaSys Health greg.lindstrom@novasyshealth.com > >"We are the music makers, and we are the dreamers of dreams" W.W. > > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > From bac at OCF.Berkeley.EDU Fri Jul 2 12:53:20 2004 From: bac at OCF.Berkeley.EDU (Brett C.) Date: Fri Jul 2 12:53:31 2004 Subject: [python-win32] Any way to get PyHANDLE for any running process? In-Reply-To: <16E1010E4581B049ABC51D4975CEDB8803060F06@UKDCX001.uk.int.atosorigin.com> References: <16E1010E4581B049ABC51D4975CEDB8803060F06@UKDCX001.uk.int.atosorigin.com> Message-ID: <40E59300.4080200@ocf.berkeley.edu> Moore, Paul wrote: > From: Brett Cannon > >>I noticed win32process.TerminateProcess(), but it wants a PyHANDLE and I >>can't figure out how to create one for any process other than the >>currently running one. > > >>Any help on this would be great. Already sick of doing it manually >>through the Task Manager. > > > If you don't need to use Python, Systems Internals' pstools package at > http://www.sysinternals.com/ntw2k/freeware/pstools.shtml includes a > pskill utility - pskill iexplore will kill all iexplore processes. > > Otherwise, you need stuff from the win32process module. You can use > win32process.EnumProcesses to get all processes and then win32api.OpenProcess > to convert a pid to a pyHandle, then win32process.GetModuleFileNameEx > with a hModule of 0 to get the executable name. Once you have that, you > can decide whether it's the one you want to kill... > > Maybe there's a simpler way, but that would be a bit of a novelty when > dealing with the Win32 API :-) > Thanks to Paul, Jens, and Tim for replying to my email. With two suggestions being the same as above I will give that a shot. And yes, as I have quickly learned from my novice experience with coding for Windows, it would be a novelty if it was in any way simple. -Brett From mhammond at skippinet.com.au Fri Jul 2 19:35:33 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Jul 2 19:35:38 2004 Subject: [python-win32] Any way to get PyHANDLE for any running process? In-Reply-To: <40E1BCA2.5080802@ocf.berkeley.edu> Message-ID: <0a8001c4608d$4889eb70$0200a8c0@eden> > I am having a problem of a process not closing when it > should, actually > stemming from IE's COM object, and it prevents me from > creating another > IE COM object. I would like to have some way to check if > IEXPLORE.EXE > is already running, and if so, then kill it. > > I noticed win32process.TerminateProcess(), but it wants a > PyHANDLE and I > can't figure out how to create one for any process other than the > currently running one. > > Any help on this would be great. Already sick of doing it manually > through the Task Manager. See the other replies - but first, you should try and fix it "cleanly". IE should die when the last reference to it is released, and Visible is not set to True. If this doesn't happen, there is a good chance you have references to IE still hanging around your code. Looking at the value of pythoncom._GetInterfaceCount() should tell you this. If you have the problem even when _GetInterfaceCount() returns 0, then you have no choice - but if _GetInterfaceCount() is non-zero, then try locating where these references are, and have it report 0. The problem may then magically vanish (just like IE!) Mark > > -Brett > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From bac at OCF.Berkeley.EDU Fri Jul 2 20:34:16 2004 From: bac at OCF.Berkeley.EDU (Brett Cannon) Date: Fri Jul 2 20:34:21 2004 Subject: [python-win32] Any way to get PyHANDLE for any running process? In-Reply-To: <0a8001c4608d$4889eb70$0200a8c0@eden> References: <0a8001c4608d$4889eb70$0200a8c0@eden> Message-ID: <40E5FF08.1080207@ocf.berkeley.edu> Mark Hammond wrote: [SNIP] > > See the other replies - but first, you should try and fix it "cleanly". IE > should die when the last reference to it is released, and Visible is not set > to True. If this doesn't happen, there is a good chance you have references > to IE still hanging around your code. Looking at the value of > pythoncom._GetInterfaceCount() should tell you this. If you have the > problem even when _GetInterfaceCount() returns 0, then you have no choice - > but if _GetInterfaceCount() is non-zero, then try locating where these > references are, and have it report 0. The problem may then magically vanish > (just like IE!) > I think the problem was having IE visible when I tried to close it. It has been behaving all day today (and I don't view it while I use the COM object). It looks like that was the problem. I know have a new-found respect for Windows programmers who manage to keep their sanity. -Brett From haim at babysnakes.org Sat Jul 3 18:55:35 2004 From: haim at babysnakes.org (Haim Ashkenazi) Date: Sat Jul 3 19:20:24 2004 Subject: [python-win32] urllib: host not given on windows 98 Message-ID: Hi I'm writing a script that should run on windows 98. I've installed a first edition on vmware and everything went well. because the slowness of the virtual machine I decided to dedicate a computer to it. I took a pentuim 3 and install the same system (win98 first edition no updates, everything with default settings) and installed activestate python. now I'm getting this strange error: >>> import urllib >>> f = urllib.URLopener() >>> x = f.open('http://www.python.org') Traceback (most recent call last): File "", line 1, in -toplevel- x = f.open('http://www.python.org') File "C:\PYTHON23\Lib\urllib.py", line 181, in open return getattr(self, name)(url) File "C:\PYTHON23\Lib\urllib.py", line 281, in open_http if not host: raise IOError, ('http error', 'no host given') IOError: [Errno http error] no host given >>> ------------------------ of-course I can access the web from a browser without a problem. I'm not a windows user (never was) and I really need help here. I've already deleted the vmware installation, so I can't check for differences and I'm completely in the dark. I've tried to install python from python.org and i get the same error. can anybody please, PLEASE, PPPLLLEEEAAASSSEEE help? thanx -- Haim From michael.smith at marketpipe.com Tue Jul 6 18:51:24 2004 From: michael.smith at marketpipe.com (Michael Smith) Date: Tue Jul 6 18:51:32 2004 Subject: [python-win32] controlling modal internet explorer popups Message-ID: <1089132684.32555.48.camel@doctor.marketpipe.com> Has anyone managed to use win32com to control Internet Explorer popups, such as javascript alerts. Suppose I have a web page that asks me to confirm when I hit submit. If I have code like this ie.Document.getElementById('submit_button').Click() print "I clicked on it" then the second line is never reached, as internet explorer is sitting there waiting for someone to click on the pop-up. Is there any way round this? Thank you -- This email and its attachments are confidential and may be subject to copyright. It is intended solely for the addressees. If it is sent to you by mistake then please delete it and immediately notify the sender. You should not copy it or disclose its contents to anyone unauthorised. The views and opinions in this message are the sender's own and do not necessarily represent those of Marketpipe. We believe this message is free of any virus, however Marketpipe cannot accept liability for any loss or damage you may incur as a result of virus infection. Any email sent to or from us may be monitored by us for operational or business reasons. Marketpipe Ltd, 7 Soho Square, London, W1D 3QB From soulse at gmail.com Tue Jul 6 20:03:30 2004 From: soulse at gmail.com (Soulse) Date: Tue Jul 6 20:03:58 2004 Subject: [python-win32] controlling modal internet explorer popups In-Reply-To: <1089132684.32555.48.camel@doctor.marketpipe.com> References: <1089132684.32555.48.camel@doctor.marketpipe.com> Message-ID: <108c1f36040706110324096470@mail.gmail.com> what IDE can i use to develop in win? From soulse at gmail.com Tue Jul 6 20:04:40 2004 From: soulse at gmail.com (Soulse) Date: Tue Jul 6 20:04:43 2004 Subject: [python-win32] IDE Message-ID: <108c1f360407061104781a0ba@mail.gmail.com> what IDE can i use to develop in win? -- Marco Morales ------------------------------------------------------------- aka Soulse "La posibilidad de realizar un sue?o es lo que hace la vida interesante" - Paulo Coelho From jjl at pobox.com Tue Jul 6 20:24:40 2004 From: jjl at pobox.com (John J Lee) Date: Tue Jul 6 20:23:57 2004 Subject: [python-win32] controlling modal internet explorer popups In-Reply-To: <1089132684.32555.48.camel@doctor.marketpipe.com> References: <1089132684.32555.48.camel@doctor.marketpipe.com> Message-ID: On Tue, 6 Jul 2004, Michael Smith wrote: > Has anyone managed to use win32com to control Internet Explorer popups, > such as javascript alerts. > > Suppose I have a web page that asks me to confirm when I hit submit. > > If I have code like this > > ie.Document.getElementById('submit_button').Click() > print "I clicked on it" > > then the second line is never reached, as internet explorer is sitting > there waiting for someone to click on the pop-up. > > Is there any way round this? I don't know, but I have a vague suspicion there's no way around it other than using Windows events. I suspect that because, IIRC, that's the way the 'Internet Macros' product sold by IOpus works. OTOH, that may just be my bad memory, or it may just be because the IOpus software is so flaky ;-) Perhaps you can stop the pop-up from appearing in the first place instead? John From christian at TreesforLife.org Tue Jul 6 22:34:26 2004 From: christian at TreesforLife.org (Christian Junker) Date: Tue Jul 6 22:34:39 2004 Subject: [python-win32] IDE Message-ID: <8643B74BC5B4C045B96E7031CA94CBBD35F5D6@tfls02.tfl.net> Just ask once, you don't need to ask twice to get an answer. I use the PythonWin IDE, which I think is very handy. But there is a whole bunch of editors for Python: (x)emacs, WingIDE or the standard IDLE and much much more... Just search through the Internet and get the one you think is the best for you. Best regards Christian Junker > -----Original Message----- > From: Soulse [mailto:soulse@gmail.com] > Sent: Tuesday, July 06, 2004 1:05 PM > To: python-win32@python.org > Subject: [python-win32] IDE > > > what IDE can i use to develop in win? > > -- > > Marco Morales > ------------------------------------------------------------- > aka Soulse > > "La posibilidad de realizar un sue?o es lo que hace la vida > interesante" > - Paulo Coelho > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From wnvcole at peppermillcas.com Wed Jul 7 00:53:10 2004 From: wnvcole at peppermillcas.com (Vernon Cole) Date: Wed Jul 7 00:54:35 2004 Subject: [python-win32] controlling modal internet explorer popups Message-ID: <07AF3C77A0FBD311A99F00508B65203903272C67@SEBASTIAN> Try http://projects.blender.org/projects/spe Vernon -----Original Message----- From: Soulse [mailto:soulse@gmail.com] Sent: Tuesday, July 06, 2004 12:04 PM To: python-win32@python.org Subject: Re: [python-win32] controlling modal internet explorer popups what IDE can i use to develop in win? _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From Jim.Vickroy at noaa.gov Wed Jul 7 11:45:41 2004 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Jul 7 11:45:54 2004 Subject: [python-win32] How to write to Applications Event Log without Admin privileges? In-Reply-To: <5.2.0.4.2.20040625090956.114f67c8@blue-cove.com> Message-ID: Hello, The subject pretty much describes the problem. I'm running on Windows XP (professional) with Python 2.3.3. I'm seeing a registry "insufficient privilege" error when attempting to place entries in the Windows Application Event Log unless I'm logged in as an administrator. What should I being doing differently? Thanks for any suggestions. -- jv From gjb at crs4.it Wed Jul 7 20:06:05 2004 From: gjb at crs4.it (Gavin Brelstaff) Date: Wed Jul 7 20:05:19 2004 Subject: [python-win32] Existing App-window ->Transparent Message-ID: <40EC3B8D.1030408@crs4.it> I've been happily using win32gui.EnumWindows() to get handles of GUI windows existing applications running on Win2k and WinXP. I've managed to read the titlebar of various running apps windows. Now I'd like to change the background color of that window so that it is transparent - i.e. so I can see through it to the window underneath it. Is this possible? I am no guru of MFC,COM etc - so I'd appreciate any existence proofs. I've tried - without joy - this : ... dc = win32ui.CreateDCFromHandle(handle) try: dc.SetBkMode(win32con.TRANSPARENT) dc.RestoreDC() except Exception, e: print "dc.SetBkMode(win32con.TRANSPARENT) failed", e But my ignorance of the Windows API From mhammond at skippinet.com.au Fri Jul 9 05:45:01 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Jul 9 05:45:04 2004 Subject: [python-win32] Existing App-window ->Transparent In-Reply-To: <40EC3B8D.1030408@crs4.it> Message-ID: <17af01c46567$1dc0d4b0$0200a8c0@eden> > I've been happily using win32gui.EnumWindows() > to get handles of GUI windows existing applications > running on Win2k and WinXP. > > I've managed to read the titlebar of various running apps windows. > Now I'd like to change the background color of that window > so that it is transparent - i.e. so I can see through it to > the window underneath it. Is this possible? > I am no guru of MFC,COM etc - so I'd appreciate any existence proofs. > > I've tried - without joy - this : > > ... > dc = win32ui.CreateDCFromHandle(handle) > try: > dc.SetBkMode(win32con.TRANSPARENT) > dc.RestoreDC() > except Exception, e: > print "dc.SetBkMode(win32con.TRANSPARENT) failed", e > > But my ignorance of the Windows API I'm not 100% sure, but I think you will be pushing poo uphill. Code similar to yours will exist in the other application's code - ie, as the other app receives a WM_PAINT message, it will setup the DC context and mode itself before doing the drawing. For apps that have very simple painting, and do not handle WM_ERASEBKGRND, you *may* be able to tweak the window class, as Windows itself then does the background paint, but I doubt you will find something that works for every app. Mark From mhammond at skippinet.com.au Fri Jul 9 05:48:29 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Jul 9 05:48:45 2004 Subject: [python-win32] How to write to Applications Event Log without Adminprivileges? In-Reply-To: Message-ID: <17b001c46567$a6b1e610$0200a8c0@eden> > Hello, > > The subject pretty much describes the problem. > > I'm running on Windows XP (professional) with Python 2.3.3. > > I'm seeing a registry "insufficient privilege" error when > attempting to > place entries in the Windows Application Event Log unless I'm > logged in as > an administrator. What should I being doing differently? That user doesn't have permission to write to the event log, so your choices are simply to either give them the permission, or stop trying to write to the log :) Depending on what your app does, it may be possible to arrange for your non-admin user to execute the program as an admin user - for example, the non-admin user may be able to start and stop services which are executed by the SYSTEM user, and therefore is able to write to this log. Mark. From phil.hornby at accutest.co.uk Fri Jul 9 10:12:41 2004 From: phil.hornby at accutest.co.uk (Phil Hornby) Date: Fri Jul 9 10:12:32 2004 Subject: [python-win32] COM Events Message-ID: Okay guys - probably being REALLY dumb - but I have a COM server that I am trying to interact with from Python and one of the things that I need to do is receive event notifications from it... In VB one way to write the code would be something like this: """ Dim WithEvents gMyApp As XYZ.Application Private Sub gMyApp_OnQuit() 'create application specific OnQuit event handler here.. End Sub """ Where the event handler HAS to be called '_' I can obviously make sure that I have a function with the correct name - but HOW do I do the WithEvents bit!!?? Thanks in advance... -- Phil Hornby From Paul.Moore at atosorigin.com Fri Jul 9 10:16:24 2004 From: Paul.Moore at atosorigin.com (Moore, Paul) Date: Fri Jul 9 10:16:22 2004 Subject: [python-win32] Existing App-window ->Transparent Message-ID: <16E1010E4581B049ABC51D4975CEDB88052CB275@UKDCX001.uk.int.atosorigin.com> There are window styles WS_EX_LAYERED and WS_EX_TRANSPARENT, and a SetLayeredWindowAttributes call which are probably relevant. I have an application, Windows PowerPro, which among, other functions, can set arbitrary windows to have a transparency of anything between 0 (opaque) and 255 (completely invisible). I don't know how it works, exactly, but playing with it (www.windowspowerpro.com) and something like Spy++ might give some ideas... Paul. -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Mark Hammond Sent: 09 July 2004 04:45 To: 'Gavin Brelstaff'; python-win32@python.org Subject: RE: [python-win32] Existing App-window ->Transparent > I've been happily using win32gui.EnumWindows() > to get handles of GUI windows existing applications > running on Win2k and WinXP. > > I've managed to read the titlebar of various running apps windows. > Now I'd like to change the background color of that window > so that it is transparent - i.e. so I can see through it to > the window underneath it. Is this possible? > I am no guru of MFC,COM etc - so I'd appreciate any existence proofs. > > I've tried - without joy - this : > > ... > dc = win32ui.CreateDCFromHandle(handle) > try: > dc.SetBkMode(win32con.TRANSPARENT) > dc.RestoreDC() > except Exception, e: > print "dc.SetBkMode(win32con.TRANSPARENT) failed", e > > But my ignorance of the Windows API I'm not 100% sure, but I think you will be pushing poo uphill. Code similar to yours will exist in the other application's code - ie, as the other app receives a WM_PAINT message, it will setup the DC context and mode itself before doing the drawing. For apps that have very simple painting, and do not handle WM_ERASEBKGRND, you *may* be able to tweak the window class, as Windows itself then does the background paint, but I doubt you will find something that works for every app. Mark _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 __________________________________________________________________________ This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. __________________________________________________________________________ From tim.golden at viacom-outdoor.co.uk Fri Jul 9 10:14:34 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri Jul 9 10:17:33 2004 Subject: [python-win32] COM Events Message-ID: | In VB one way to write the code would be something like this: | | """ | Dim WithEvents gMyApp As XYZ.Application | | Private Sub gMyApp_OnQuit() | 'create application specific OnQuit event handler here.. | End Sub | """ | | Where the event handler HAS to be called '_' | | I can obviously make sure that I have a function with the | correct name - but | HOW do I do the WithEvents bit!!?? You want to use DispatchWithEvents. You use it like the normal Dispatch, but pass in additionally a class (*not* an instance) which contains methods corresponding to the events you're interested in. The following code fragment should illustrate what I mean (from when I was playing around with Microsoft Agent): class AgentEvents: def OnActivateInput (self, character_id): this_agent = active_agents.get (character_id) if this_agent: this_agent.on_activate_input () def OnActiveClientChange (self, character_id, active): this_agent = active_agents.get (character_id) if this_agent: this_agent.on_activate_client_change (active) def OnAgentPropertyChange (self): pass agent = win32com.client.DispatchWithEvents ("Agent.Control.2", AgentEvents) TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From phil.hornby at accutest.co.uk Fri Jul 9 11:39:36 2004 From: phil.hornby at accutest.co.uk (Phil Hornby) Date: Fri Jul 9 11:39:23 2004 Subject: [python-win32] COM Events In-Reply-To: Message-ID: Great that seems to work - but I only get my parent object in this way: agent = win32com.client.DispatchWithEvents ("Agent.Control.2", AgentEvents) What if I then get other objects as properties of this object - E.g. """ SomethingElse = agent.Another """ And this object/interface has events too... In VB it would be something like: """ Dim WithEvents gCanApp As CANalyzer.Application Dim WithEvents gCanMeasurement As CANalyzer.Measurement Set gCanApp = New Application Set gCanMeasurement = gCanApp.Measurement """ I have tried to do something similar like: """ CANalyzer = win32com.client.DispatchWithEvents('CANalyzer.Application', CANalyzerEvents) measurement = win32com.client.DispatchWithEvents('CANalyzer.Measurement', MeasurementEvents) measurement = CANalyzer.Measurement """ But I get a claim that I have an invalid class string - if I look at the typelib that I am working with and it contains both interfaces - if I simply have some code like: """ CANalyzer = win32com.client.DispatchWithEvents('CANalyzer.Application', CANalyzerEvents) measurement = CANalyzer.Measurement """ Then I get 'some' of the events from the CANalyzerEvents object - but the ones I don't get are ones I can understand NOT getting - and I can use the measurement interface in the way I would like EXCEPT I don't get any events. Any ideas? -- Phil > -----Original Message----- > From: Tim Golden [mailto:tim.golden@viacom-outdoor.co.uk] > Sent: Friday, July 09, 2004 9:15 AM > To: 'Phil Hornby'; Python Win32 > Subject: RE: [python-win32] COM Events > > | In VB one way to write the code would be something like this: > | > | """ > | Dim WithEvents gMyApp As XYZ.Application > | > | Private Sub gMyApp_OnQuit() > | 'create application specific OnQuit event handler here.. > | End Sub > | """ > | > | Where the event handler HAS to be called '_' > | > | I can obviously make sure that I have a function with the > correct name > | - but HOW do I do the WithEvents bit!!?? > > You want to use DispatchWithEvents. You use it like the > normal Dispatch, but pass in additionally a class > (*not* an instance) which contains methods corresponding to > the events you're interested in. > > The following code fragment should illustrate what I mean > (from when I was playing around with Microsoft Agent): > > > > class AgentEvents: > def OnActivateInput (self, character_id): > this_agent = active_agents.get (character_id) > if this_agent: this_agent.on_activate_input () > > def OnActiveClientChange (self, character_id, active): > this_agent = active_agents.get (character_id) > if this_agent: this_agent.on_activate_client_change (active) > > def OnAgentPropertyChange (self): > pass > > agent = win32com.client.DispatchWithEvents > ("Agent.Control.2", AgentEvents) > > > > TJG > > > ______________________________________________________________ > __________ > This e-mail has been scanned for all viruses by Star > Internet. The service is powered by MessageLabs. For more > information on a proactive anti-virus service working around > the clock, around the globe, visit: > http://www.star.net.uk > ______________________________________________________________ > __________ > From tim.golden at viacom-outdoor.co.uk Fri Jul 9 12:16:37 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri Jul 9 12:19:39 2004 Subject: [python-win32] COM Events Message-ID: | Great that seems to work - but I only get my parent object in | this way: | | agent = win32com.client.DispatchWithEvents | ("Agent.Control.2", AgentEvents) | | What if I then get other objects as properties of this object - | E.g. | """ | SomethingElse = agent.Another | """ | | And this object/interface has events too... I'm going horribly out of my depth (or, in fact, out of my shallows) now, but I have an idea that you can pass not just a class string, but a dispatched object in as the first parameter to DispatchWithEvents. ie you can do a = win32com.client.DispatchWithEvents ("x.y", xy_events_class) b = win32com.client.DispatchWithEvents (a.z, az_events_class) I could very well be wrong, having never tried it. In any case, I *strongly* suggest you browse the generously-commented source in win32com\client\__init__.py. On my machine, that's: c:\python23\lib\site-packages\win32com\client\__init__.py You're looking for DispatchWithEvents, obviously, but also for the other related functions referred to in its docstring. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From phil.hornby at accutest.co.uk Fri Jul 9 13:21:19 2004 From: phil.hornby at accutest.co.uk (Phil Hornby) Date: Fri Jul 9 13:21:08 2004 Subject: [python-win32] COM Events In-Reply-To: Message-ID: Tim, Thanks loads that worked... Have been bashing my head against a wall for about a week on this thing!!! I probably should have done as you suggested and dived into the source - I just hate having to do that - I like to use documentation - not that the app I am trying to automate has particularly good docs on the COM server - I am having to use an OLE/COM Viewer to find out what I can really do in the latest version instead of what was available 3 or 4 versions ago!! Anyway thanks tons again - I owe you a bevvie...;) -- Phil > -----Original Message----- > From: Tim Golden [mailto:tim.golden@viacom-outdoor.co.uk] > Sent: Friday, July 09, 2004 11:17 AM > To: 'Phil Hornby'; 'Python Win32' > Subject: RE: [python-win32] COM Events > > | Great that seems to work - but I only get my parent object in this > | way: > | > | agent = win32com.client.DispatchWithEvents > | ("Agent.Control.2", AgentEvents) > | > | What if I then get other objects as properties of this object - E.g. > | """ > | SomethingElse = agent.Another > | """ > | > | And this object/interface has events too... > > I'm going horribly out of my depth (or, in fact, out of my > shallows) now, but I have an idea that you can pass not just > a class string, but a dispatched object in as the first > parameter to DispatchWithEvents. > ie you can do > > a = win32com.client.DispatchWithEvents ("x.y", > xy_events_class) b = win32com.client.DispatchWithEvents (a.z, > az_events_class) > > I could very well be wrong, having never tried it. > > In any case, I *strongly* suggest you browse the > generously-commented source in win32com\client\__init__.py. > On my machine, that's: > > c:\python23\lib\site-packages\win32com\client\__init__.py > > You're looking for DispatchWithEvents, obviously, but also > for the other related functions referred to in its docstring. > > TJG > > > ______________________________________________________________ > __________ > This e-mail has been scanned for all viruses by Star > Internet. The service is powered by MessageLabs. For more > information on a proactive anti-virus service working around > the clock, around the globe, visit: > http://www.star.net.uk > ______________________________________________________________ > __________ > From tim.golden at viacom-outdoor.co.uk Fri Jul 9 14:15:22 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri Jul 9 14:18:20 2004 Subject: [python-win32] COM Events Message-ID: | Thanks loads that worked... Phew! I half-expected a learned response from some pywin32 guru suggesting I keep my head down when I'm out of my depth (!) | I am having to use an OLE/COM Viewer to find out | what I can really do in the latest version instead | of what was available 3 or 4 versions ago!! Often worth browsing the python module in the gen_py directory. That pulls out all the methods etc which it can discover (and, therefore, which you'll be able to use in Python). TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From theller at python.net Fri Jul 9 15:03:36 2004 From: theller at python.net (Thomas Heller) Date: Fri Jul 9 15:03:45 2004 Subject: [python-win32] Re: COM Events References: Message-ID: <7jtd49jr.fsf@python.net> Tim Golden writes: > | Great that seems to work - but I only get my parent object in > | this way: > | > | agent = win32com.client.DispatchWithEvents > | ("Agent.Control.2", AgentEvents) > | > | What if I then get other objects as properties of this object - > | E.g. > | """ > | SomethingElse = agent.Another > | """ > | > | And this object/interface has events too... > > I'm going horribly out of my depth (or, in fact, out of my shallows) now, > but I have an idea that you can pass not just a class string, but > a dispatched object in as the first parameter to DispatchWithEvents. > ie you can do > > a = win32com.client.DispatchWithEvents ("x.y", xy_events_class) > b = win32com.client.DispatchWithEvents (a.z, az_events_class) > > I could very well be wrong, having never tried it. Hm, isn't that what win32com.client.WithEvents is for? At least the OP should also look into that too. Thomas From ta-meyer at ihug.co.nz Fri Jul 9 11:38:35 2004 From: ta-meyer at ihug.co.nz (Tony Meyer) Date: Fri Jul 9 17:20:12 2004 Subject: [python-win32] Installing Build 202 with Python 2.4a1 Message-ID: <1ED4ECF91CDED24C8D012BCF2B034F13064C02CE@its-xchg4.massey.ac.nz> Has anyone else had troubles using the Build 202 installer with Python 2.4a1? It all goes nicely for me until the end, when I get: """ Creating .PTH file C:\Python24\pywin32.pth Copied pythoncom24.dll to C:\WINDOWS\System32\pythoncom24.dll Copied pywintypes24.dll to C:\WINDOWS\System32\pywintypes24.dll Registered: Python.Interpreter Registered: Python.Dictionary Traceback (most recent call last): File "C:\Python24\Scripts\pywin32_postinstall.py", line 313, in ? install() File "C:\Python24\Scripts\pywin32_postinstall.py", line 210, in install SetPyKeyVal("Help", None, None) File "C:\Python24\Scripts\pywin32_postinstall.py", line 97, in SetPyKeyVal root_hkey = get_root_hkey() NameError: global name 'get_root_hkey' is not defined *** run_installscript: internal error 0xFFFFFFFF *** """ I'm not sure what the try/except block that includes the get_root_hkey definition is doing, so I don't know whether this is a bug or something wrong here. Build 202 for Py2.3 and Py2.2 work fine, though. =Tony Meyer From Paul.Moore at atosorigin.com Fri Jul 9 17:22:45 2004 From: Paul.Moore at atosorigin.com (Moore, Paul) Date: Fri Jul 9 17:22:45 2004 Subject: [python-win32] Installing Build 202 with Python 2.4a1 Message-ID: <16E1010E4581B049ABC51D4975CEDB88052CB27A@UKDCX001.uk.int.atosorigin.com> From: Tony Meyer > Has anyone else had troubles using the Build 202 installer with > Python 2.4a1? It all goes nicely for me until the end, when I > get: [...] I got the same problem. Haven't had a chance to look into it yet. Having said that, thanks to Mark for putting out a 2.4 build - without pywin32, I wouldn't be able to even consider doing any serious testing of 2.4... Paul. __________________________________________________________________________ This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. __________________________________________________________________________ From gjb at crs4.it Fri Jul 9 18:51:45 2004 From: gjb at crs4.it (Gavin Brelstaff) Date: Fri Jul 9 18:50:58 2004 Subject: [python-win32] Existing App-window ->Transparent Message-ID: <40EECD21.1080705@crs4.it> Paul wrote: > There are window styles WS_EX_LAYERED and WS_EX_TRANSPARENT, and a > SetLayeredWindowAttributes call which are probably relevant. I have > an application, Windows PowerPro, which among, other functions, can > set arbitrary windows to have a transparency of anything between 0 > (opaque) and 255 (completely invisible). I don't know how it works, > exactly, but playing with it (www.windowspowerpro.com) and something > like Spy++ might give some ideas... Thanks Paul, I did a search through the Python Win32 docs and the call SetLayeredWindowAttributes seems to be missing from the API. I guess you wrote "Windows PowerPro" in C/C++ and not in python? \Gavin -- Gavin Brelstaff - BioMedical Area, CRS4 in Sardinia Loc. Pixina Manna Edificio 1, C.P. n.25, 09010 Pula (CA) Italy. Email: gjb@crs4.it Phone:+39.070.9250.312 Fax:+39.070.9250.216 From pf_moore at yahoo.co.uk Fri Jul 9 22:10:56 2004 From: pf_moore at yahoo.co.uk (Paul Moore) Date: Fri Jul 9 22:10:51 2004 Subject: [python-win32] Re: Installing Build 202 with Python 2.4a1 References: <16E1010E4581B049ABC51D4975CEDB88052CB27A@UKDCX001.uk.int.atosorigin.com> Message-ID: "Moore, Paul" writes: > From: Tony Meyer >> Has anyone else had troubles using the Build 202 installer with >> Python 2.4a1? It all goes nicely for me until the end, when I >> get: > [...] > > I got the same problem. Haven't had a chance to look into it yet. Looks like the following bit of code from the postinstall script is at fault: try: # When this script is run from inside the bdist_wininst installer, # file_created() and directory_created() are additional builtin # functions which write lines to Python23\pywin32-install.log. This is # a list of actions for the uninstaller, the format is inspired by what # the Wise installer also creates. file_created except NameError: def file_created(file): pass def directory_created(directory): pass def get_root_hkey(): try: _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, root_key_name, _winreg.KEY_CREATE_SUB_KEY) return _winreg.HKEY_LOCAL_MACHINE except OSError, details: # Either not exist, or no permissions to create subkey means # must be HKCU return _winreg.HKEY_CURRENT_USER I can only assume from this that the bdist_wininst installer for 2.4 doesn't provide the same set of "extra builtins" as the one for 2.3 and earlier. Paul. -- A little inaccuracy sometimes saves tons of explanation -- Saki From mhammond at skippinet.com.au Sat Jul 10 03:23:06 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat Jul 10 03:23:10 2004 Subject: [python-win32] Installing Build 202 with Python 2.4a1 In-Reply-To: <1ED4ECF91CDED24C8D012BCF2B034F13064C02CE@its-xchg4.massey.ac.nz> Message-ID: <19ca01c4661c$757e1090$0200a8c0@eden> > Has anyone else had troubles using the Build 202 installer with Python > 2.4a1? It all goes nicely for me until the end, when I get: Unfortunately, my 2.4 build came out just a few days *before* 2.4 itself - hence I didn't test that build as well as I could have. The installation should work correctly, but the registry keys (eg, the Help File location) will not be setup. I will fix this in the next build. Mark. From christian at TreesforLife.org Sat Jul 10 04:13:21 2004 From: christian at TreesforLife.org (Christian Junker) Date: Sat Jul 10 04:26:40 2004 Subject: [python-win32] Re: COM Events Message-ID: <8643B74BC5B4C045B96E7031CA94CBBD4359E2@tfls02.tfl.net> Very interesting thread, I am trying something similiar for OpenOffice.org, which has a quite similiar listener system. If someone has ever written a listener or handler for OpenOffice.org via COM, please let me know, I am digging in the dark. Best regards Christian Junker > -----Original Message----- > From: Thomas Heller [mailto:theller@python.net] > Sent: Friday, July 09, 2004 8:04 AM > To: python-win32@python.org > Subject: [python-win32] Re: COM Events > > > Tim Golden writes: > > > | Great that seems to work - but I only get my parent object in > > | this way: > > | > > | agent = win32com.client.DispatchWithEvents > > | ("Agent.Control.2", AgentEvents) > > | > > | What if I then get other objects as properties of this object - > > | E.g. > > | """ > > | SomethingElse = agent.Another > > | """ > > | > > | And this object/interface has events too... > > > > I'm going horribly out of my depth (or, in fact, out of my > shallows) now, > > but I have an idea that you can pass not just a class string, but > > a dispatched object in as the first parameter to DispatchWithEvents. > > ie you can do > > > > a = win32com.client.DispatchWithEvents ("x.y", xy_events_class) > > b = win32com.client.DispatchWithEvents (a.z, az_events_class) > > > > I could very well be wrong, having never tried it. > > Hm, isn't that what win32com.client.WithEvents is for? At > least the OP > should also look into that too. > > Thomas > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From t-meyer at ihug.co.nz Sun Jul 11 08:26:27 2004 From: t-meyer at ihug.co.nz (Tony Meyer) Date: Sun Jul 11 08:26:34 2004 Subject: [python-win32] Installing Build 202 with Python 2.4a1 In-Reply-To: <1ED4ECF91CDED24C8D012BCF2B034F13070AE45B@its-xchg4.massey.ac.nz> Message-ID: <1ED4ECF91CDED24C8D012BCF2B034F13046780DA@its-xchg4.massey.ac.nz> > Having said that, thanks to Mark for putting out a 2.4 build > - without pywin32, I wouldn't be able to even consider doing > any serious testing of 2.4... Yes, indeed - thanks from here, too :) =Tony Meyer From Paul.Moore at atosorigin.com Mon Jul 12 10:18:13 2004 From: Paul.Moore at atosorigin.com (Moore, Paul) Date: Mon Jul 12 10:18:13 2004 Subject: [python-win32] Existing App-window ->Transparent Message-ID: <16E1010E4581B049ABC51D4975CEDB88052CB27B@UKDCX001.uk.int.atosorigin.com> From: Gavin Brelstaff > I did a search through the Python Win32 docs and the call > SetLayeredWindowAttributes seems to be missing from the > API. I guess you wrote "Windows PowerPro" in C/C++ and not > in python? I didn't write it but yes, it's in C/C++. It's not available in source, so you wouldn't be able to get the details from it, I really only mentioned it as an example to confirm that what you wanted *could* be done. You can probably use ctypes to get at API calls that aren't exposed by pywin32, if that's of any help. Paul __________________________________________________________________________ This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. __________________________________________________________________________ From Shu-Chin.Cheeng at Shell.com Mon Jul 12 12:38:02 2004 From: Shu-Chin.Cheeng at Shell.com (Cheeng, Shu-Chin SC SITI-ITIBDO2) Date: Mon Jul 12 12:40:53 2004 Subject: [python-win32] How to QueryInterface IID_IExchangeManageStore Message-ID: Hi all, Anyone know how to QueryInterface IID_IExchangeManageStore base on microsoft article?? http://support.microsoft.com/?kbid=259570 in python code Regards, Cheeng Shu Chin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040712/3fb71488/attachment.html From Shu-Chin.Cheeng at Shell.com Mon Jul 12 13:16:00 2004 From: Shu-Chin.Cheeng at Shell.com (Cheeng, Shu-Chin SC SITI-ITIBDO2) Date: Mon Jul 12 13:16:06 2004 Subject: [python-win32] How to QueryInterface IID_IExchangeManageStore Message-ID: hi all, should I make use of : * Exchsdk.lib * Mapi32.lib * Edkutils.lib * Edkmapi.lib * edk.h regards, Cheeng Shu Chin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040712/8eb24a02/attachment.html From theller at python.net Mon Jul 12 22:38:48 2004 From: theller at python.net (Thomas Heller) Date: Mon Jul 12 22:38:53 2004 Subject: [python-win32] Re: Installing Build 202 with Python 2.4a1 References: <1ED4ECF91CDED24C8D012BCF2B034F13064C02CE@its-xchg4.massey.ac.nz> <19ca01c4661c$757e1090$0200a8c0@eden> Message-ID: "Mark Hammond" writes: >> Has anyone else had troubles using the Build 202 installer with Python >> 2.4a1? It all goes nicely for me until the end, when I get: > > Unfortunately, my 2.4 build came out just a few days *before* 2.4 itself - > hence I didn't test that build as well as I could have. > > The installation should work correctly, but the registry keys (eg, the Help > File location) will not be setup. I will fix this in the next build. This seems to be my fault. When the source files for the wininst installer changes in CVS, the binaries (wininst.exe or wininst-6.exe and wininst-7.1.exe) must be recompiled, and commited to CVS. The changed binaries didn't make it into the 2.4a1 installer. I'll add warnings to the source files so it doesn't get forgotten again. Thomas From mhammond at skippinet.com.au Tue Jul 13 14:26:14 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Jul 13 14:26:15 2004 Subject: [python-win32] How to QueryInterface IID_IExchangeManageStore In-Reply-To: Message-ID: <039e01c468d4$9867a020$0200a8c0@eden> You will need to implement this interface manually, in the win32com.mapi.exchange module. This will require C++ I'm afraid, but I am willing to help where I can. Mark -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Cheeng, Shu-Chin SC SITI-ITIBDO2 Sent: Monday, 12 July 2004 8:38 PM To: python-win32@python.org Subject: [python-win32] How to QueryInterface IID_IExchangeManageStore Hi all, Anyone know how to QueryInterface IID_IExchangeManageStore base on microsoft article?? http://support.microsoft.com/?kbid=259570 in python code Regards, Cheeng Shu Chin -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3260 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040713/da8ce481/winmail.bin From mhammond at skippinet.com.au Tue Jul 13 15:17:56 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Jul 13 15:18:09 2004 Subject: [python-win32] Re: Installing Build 202 with Python 2.4a1 In-Reply-To: Message-ID: <03ca01c468db$dc010f40$0200a8c0@eden> [Thomas] > This seems to be my fault. When the source files for the wininst > installer changes in CVS, the binaries (wininst.exe or > wininst-6.exe and > wininst-7.1.exe) must be recompiled, and commited to CVS. The changed > binaries didn't make it into the 2.4a1 installer. I'll add > warnings to the source files so it doesn't get forgotten again. To be fair though, I was building from my local tree, and appears that I simply forgot to rebuild the MSVC7 executable after applying all my patches. So try as you like, I still get the blame Mark. From Shu-Chin.Cheeng at Shell.com Tue Jul 13 17:38:24 2004 From: Shu-Chin.Cheeng at Shell.com (Cheeng, Shu-Chin SC SITI-ITIBDO2) Date: Tue Jul 13 17:40:01 2004 Subject: [python-win32] How to QueryInterface IID_IExchangeManageStore Message-ID: Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: Cheeng, Shu-Chin SC SSI-ISWA2.vcf Type: text/x-vcard Size: 365 bytes Desc: Cheeng, Shu-Chin SC SSI-ISWA2.vcf Url : http://mail.python.org/pipermail/python-win32/attachments/20040713/d2f43c76/CheengShu-ChinSCSSI-ISWA2.vcf From Shu-Chin.Cheeng at Shell.com Tue Jul 13 17:54:24 2004 From: Shu-Chin.Cheeng at Shell.com (Cheeng, Shu-Chin SC SITI-ITIBDO2) Date: Tue Jul 13 18:18:28 2004 Subject: [python-win32] How to QueryInterface IID_IExchangeManageStore Message-ID: hi mark, Nice to hear from you. This is some of my code: ==================================== import win32com.mapi.mapi as mapi import win32com.mapi.exchange as exchange import pythoncom,pywintypes hr=mapi.MAPIInitialize(None) lpsess = mapi.MAPILogonEx(0,"",None,mapi.MAPI_LOGON_UI|mapi.MAPI_NEW_SESSION|mapi.MAPI_EXPLICIT_PROFILE) lpmdb=exchange.HrOpenExchangePrivateStore(lpsess) print lpmdb tmp=lpmdb.QueryInterface(IID_IExchangeManageStore) # it fail in here #print exchange.HrMailboxLogon(lpsess,lpmdb,lpszMsgStoreDN,lpszMailboxDN) #print lpmdb.GetPropList(0) #print pywintypes.IID('IID_IExchangeManageStore') #print lpmdb._com_interfaces_ #tmp=lpmdb.QueryInterface(pythoncom.MakeIID('{00000000-0000-0000-C000-000000000046}')) #print tmp._com_interfaces_ #IExchangeManageStore=tmp.QueryInterface(pythoncom.IID_IDispatch) #print pythoncom._GetInterfaceCount() #tmp.Release() #print IExchangeManageStore ==================================== should we need some of the LIB,TBL, and dll: * Exchsdk.lib * Mapi32.lib * Edkutils.lib * Edkmapi.lib * edk.h can we use ctypes for this???? What can I do for it : ) Regards, Cheeng Shu Chin -------------- next part -------------- A non-text attachment was scrubbed... Name: Cheeng, Shu-Chin SC SSI-ISWA2.vcf Type: text/x-vcard Size: 365 bytes Desc: Cheeng, Shu-Chin SC SSI-ISWA2.vcf Url : http://mail.python.org/pipermail/python-win32/attachments/20040713/74d0f625/CheengShu-ChinSCSSI-ISWA2.vcf From rogelio.flores at gmail.com Wed Jul 14 23:56:45 2004 From: rogelio.flores at gmail.com (Rogelio Flores) Date: Thu Jul 15 00:14:13 2004 Subject: [python-win32] Unable to find PythonCOM20.dll Message-ID: I'm running into a weird behavior (unless I'm able to find an explanation with your help) from Mark Hammond's win32 extensions. This is what I'm trying to do: I want to distribute only the modules/libraries/files needed for a simple interaction with excel that my program uses. I know what I need to include, but I get this error: Traceback (most recent call last): import win32com.client File "C:\sviews\rxf_IQ_v4\cadiq\cadiq\modules\plat-win32\win32com\client\__init__.py", line 12, in ? import dynamic, gencache, pythoncom File "C:\sviews\rxf_IQ_v4\cadiq\cadiq\modules\plat-win32\win32com\client\dynamic.py", line 22, in ? import pythoncom File "C:\sviews\rxf_IQ_v4\cadiq\cadiq\modules\plat-win32\pythoncom.py", line 3, in ? pywintypes.__import_pywin32_system_module__("pythoncom", globals()) File "C:\sviews\rxf_IQ_v4\cadiq\cadiq\modules\plat-win32\pywintypes.py", line 41, in __import_pywin32_system_module__ h = win32api.LoadLibrary(filename) pywintypes.api_error: (126, 'LoadLibrary', 'The specified module could not be found.') I know it looked for pywintypes20.dll (really PyWinTypes20.dll on disk) successfully first, and this file is located in the same directory as PythonCOM20.dll. The directory in question is included in sys.path at run-time, but still, it finds PyWinTypes20.dll and not PythonCOM20.dll. I tried replacing "pythoncom" for "PythonCOM" inside pywintypes.py without success. Then I renamed PythonCOM20.dll to pythoncom.dll and now it works. Can somebody explain this? I'm using (and must use) python 2.0 and the files from win32all-144.exe (win32 extensions). Actually, the problem could be that I wasn't able to find a pywintypes.py or a pythoncom.py in this installer and so I used the ones from the python23 installation that I have because it win32com/client/dynamic.py is asking for pythoncom.py. Is there actually a way to run this without pythoncom.py and pywintypes.py and just assume that both dlls are there? Any help would be appreciated. Please reply off the list. Thanks, -- Rogelio From phil.hornby at accutest.co.uk Fri Jul 16 11:35:53 2004 From: phil.hornby at accutest.co.uk (Phil Hornby) Date: Fri Jul 16 11:36:07 2004 Subject: [python-win32] Unable to find PythonCOM20.dll Message-ID: The problem is that you have a pythoncom.py file in the sitepackages directory of your Python Install which 'magically' (as it claims) redirects all calls to the appropriate version of PythonCOMXX.dll HTH -- Phil Hornby From justinjohnson at gmail.com Fri Jul 16 17:24:35 2004 From: justinjohnson at gmail.com (Justin Johnson) Date: Fri Jul 16 17:24:37 2004 Subject: [python-win32] Changing Windows NT File Permissions Message-ID: <94a776e704071608241d7e84f5@mail.gmail.com> Hello, I am trying to write a script that will add a user to a file's permission list with full control to the file. I have the following code, but I'm not sure what the 2nd option to win32security.SetFileSecurity is supposed to be. The ActiveState docs at http://aspn.activestate.com/ASPN/docs/ActivePython/2.3/PyWin32/win32security__SetFileSecurity_meth.html say the following: info : int The type of information to set. I tried setting it to 0 but nothing seems to happen and I don't get any error. When I set it to 1 I get the following error: C:\temp\perm>python sec.py ms\jjohn53 Traceback (most recent call last): File "sec.py", line 23, in ? win32security.SetFileSecurity(fileName, 1, sd) pywintypes.error: (1338, 'SetFileSecurity', 'The security descriptor structure i s invalid.') Does anyone know what I need to do to accomplish my goal? My script is attached, with 1 as the 2nd option to SetFileSecurity. Thanks much. -Justin -------------- next part -------------- import win32security import pywintypes import ntsecuritycon import win32file import sys def createSD(userName): sd = pywintypes.SECURITY_DESCRIPTOR() sidUser = win32security.LookupAccountName(None,userName)[0] sidCreator = pywintypes.SID() sidCreator.Initialize(ntsecuritycon.SECURITY_CREATOR_SID_AUTHORITY,1) sidCreator.SetSubAuthority(0, ntsecuritycon.SECURITY_CREATOR_OWNER_RID) acl = pywintypes.ACL() acl.AddAccessAllowedAce(win32file.FILE_ALL_ACCESS, sidUser) acl.AddAccessAllowedAce(win32file.FILE_ALL_ACCESS, sidCreator) sd.SetSecurityDescriptorDacl(1, acl, 0) return sd fileName = "file.txt" userId = "test" sd = createSD(userId) win32security.SetFileSecurity(fileName, 1, sd) From 3fps at telia.com Thu Jul 15 05:11:46 2004 From: 3fps at telia.com (Jonas Carlsson) Date: Fri Jul 16 19:33:32 2004 Subject: [python-win32] Grab text from textbox Message-ID: <40F5F5F2.3080406@telia.com> Hi, I sent this to the python-help list but was directed here. I need to write an app which grabs text from a textbox within another running windows (xp) application. Is there tools for this in python? Thanks in advance. From rogelio.flores at gmail.com Fri Jul 16 15:01:36 2004 From: rogelio.flores at gmail.com (Rogelio Flores) Date: Fri Jul 16 19:33:32 2004 Subject: [python-win32] Unable to find PythonCOM20.dll In-Reply-To: References: Message-ID: On Fri, 16 Jul 2004 10:35:53 +0100, Phil Hornby wrote: > The problem is that you have a pythoncom.py file in the sitepackages > directory of your Python Install which 'magically' (as it claims) redirects > all calls to the appropriate version of PythonCOMXX.dll > > HTH > > -- > Phil Hornby Well, no. For python2.0 and the win32all-144.exe installation of the win32 extensions, there is no site-packages directory and there is no pythoncom.py distributed. I think it hopes to find PythonCOMXX.dll because it is installed in the winnt/system32 (win2k) directory. I tried putting the pythoncom.py file from a python23 installation but its magic fails because it cannot find the library. -- Rogelio From rwupole at msn.com Sat Jul 17 00:56:58 2004 From: rwupole at msn.com (Roger Upole) Date: Sat Jul 17 00:40:35 2004 Subject: [python-win32] Re: Changing Windows NT File Permissions Message-ID: <001201c46b88$345a8b90$6917c943@rupole> The value you need is win32security.DACL_SECURITY_INFORMATION. Other possible values are SACL_SECURITY_INFORMATION, OWNER_SECURITY_INFORMATION, or GROUP_SECURITY_INFORMATION. (can also be a bitwise or combination of any of them) It threw an error when you passed it 1 because 1 is OWNER_SECURITY_INFORMATION, and you passed it a security descriptor without an owner set. And 0 doesn't specify that *any* info should be set. Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040716/1186363b/attachment.html From mhammond at skippinet.com.au Sat Jul 17 01:54:02 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat Jul 17 01:54:09 2004 Subject: [python-win32] Unable to find PythonCOM20.dll In-Reply-To: Message-ID: <01ec01c46b90$35b9fae0$0200a8c0@eden> > Well, no. For python2.0 and the win32all-144.exe installation of the > win32 extensions, there is no site-packages directory and there is no > pythoncom.py distributed. I think it hopes to find PythonCOMXX.dll > because it is installed in the winnt/system32 (win2k) directory. I > tried putting the pythoncom.py file from a python23 installation but > its magic fails because it cannot find the library. win32all-144 used the registry to perform even blacker magic than later builds. The magic in pywintypes.py was used to avoid the registry, but if the registry keys exist, they will still be used (by Python itself, before we get a chance to intercept) Look for HKLM\Software\Python\PythonCore\2.3\Modules. I recommend upgrading to build 202 - installing these later builds will nuke these old keys, and use the pywintypes.py white-magic. Mark. From mhammond at skippinet.com.au Sat Jul 17 01:59:39 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat Jul 17 01:59:30 2004 Subject: [python-win32] ISAPI filter testers? Message-ID: <01f501c46b90$f4f6e3a0$0200a8c0@eden> I've been given a very cool ISAPI (IIS extension) framework that I have been extending, and hope to include in later pywin32 builds. At the moment I'm interested in people who would like to play with early versions of it, and offer feedback about the configuration and extension mechanisms employed. Ideally, I would love people experienced with Apache and mod_python, and *also* IIS. If you fit this category and have a little time to play, please drop me a line. Thanks, Mark. From tim.golden at viacom-outdoor.co.uk Mon Jul 19 09:18:40 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Mon Jul 19 09:21:55 2004 Subject: [python-win32] Grab text from textbox Message-ID: | I need to write an app which grabs text from a textbox within another | running windows (xp) application. | Is there tools for this in python? Have a look at Simon Brunning's WinGuiAuto; I think it does the kind of thing you're after. http://www.brunningonline.net/simon/blog/archives/001129.html TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From sdahlbac at abo.fi Mon Jul 19 14:24:35 2004 From: sdahlbac at abo.fi (sdahlbac@abo.fi) Date: Mon Jul 19 14:29:25 2004 Subject: [python-win32] 'transparently' open file Message-ID: <1090239875.40fbbd83a1246@webmail.abo.fi> How do I open a file "transparently" (whatever the correct term would be), that is so that subsequent (and previous) processes can do whatever they want with the file (read/write/delete..) Basically I just want to monitor a log file, but if I open it plain open('myfile', 'r') the RotatingFileHandler in the logging module crashes on me with a permission error when it tries to rotate the logs. I'm assuming I'll have to do some win32 specific black magic to make it work. Presumably using FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE if I was to use win api CreateFile. solutions, pointers, hints would be appreciated. /Simon platform is winxp, python2.3 From mferguson at ntlworld.com Mon Jul 19 16:39:41 2004 From: mferguson at ntlworld.com (mferguson@ntlworld.com) Date: Mon Jul 19 19:02:46 2004 Subject: [python-win32] Can't find WindowFromPoint Message-ID: <20040719143710.XUOD1023.mta05-svc.ntlworld.com@[10.137.100.64]> Is this function implemented, or am I not looking in the right places? TIA. Mark. ----------------------------------------- Email provided by http://www.ntlhome.com/ From justinjohnson at gmail.com Mon Jul 19 19:41:04 2004 From: justinjohnson at gmail.com (Justin Johnson) Date: Mon Jul 19 19:41:07 2004 Subject: [python-win32] Re: Changing Windows NT File Permissions In-Reply-To: <001201c46b88$345a8b90$6917c943@rupole> References: <001201c46b88$345a8b90$6917c943@rupole> Message-ID: <94a776e70407191041674e9160@mail.gmail.com> Does the following code look right for getting permissions on an existing file and then adding users to the permissions list? It seems to be working for me on some files, but on another it completed successfully and then when I tried to view permissions on the file using the windows explorer I got a popup that said: The permissions on file.ini are incorrectly ordered, which may cause some entries to be ineffective. Press OK to continue and sort the permissions correctly, or Cancel to reset the permissions. Should I be using something other than DACL_SECURITY_INFORMATION for the info passed to GetFileSecurity? def giveUsersFullControlOfFile(userIds, file): info = win32security.DACL_SECURITY_INFORMATION sd = win32security.GetFileSecurity(file, info) acl = sd.GetSecurityDescriptorDacl() for userId in userIds: sidUser = win32security.LookupAccountName(None,userId)[0] sidCreator = pywintypes.SID() sidCreator.Initialize(ntsecuritycon.SECURITY_CREATOR_SID_AUTHORITY,1) sidCreator.SetSubAuthority(0, ntsecuritycon.SECURITY_CREATOR_OWNER_RID) acl.AddAccessAllowedAce(win32file.FILE_ALL_ACCESS, sidUser) acl.AddAccessAllowedAce(win32file.FILE_ALL_ACCESS, sidCreator) sd.SetSecurityDescriptorDacl(1, acl, 0) win32security.SetFileSecurity(file, info, sd) ----- Original Message ----- From: Roger Upole Date: Fri, 16 Jul 2004 18:56:58 -0400 Subject: [python-win32] Re: Changing Windows NT File Permissions To: python-win32@python.org The value you need is win32security.DACL_SECURITY_INFORMATION. Other possible values are SACL_SECURITY_INFORMATION, OWNER_SECURITY_INFORMATION, or GROUP_SECURITY_INFORMATION. (can also be a bitwise or combination of any of them) It threw an error when you passed it 1 because 1 is OWNER_SECURITY_INFORMATION, and you passed it a security descriptor without an owner set. And 0 doesn't specify that *any* info should be set. Roger From rwupole at msn.com Tue Jul 20 05:07:40 2004 From: rwupole at msn.com (Roger Upole) Date: Tue Jul 20 04:51:19 2004 Subject: [python-win32] Re: Changing Windows NT File Permissions Message-ID: <000601c46e06$b9d7c000$cd17c943@rupole> This appears to be a problem with ACL's that contain auto-inherited ACE's. Right now the function is only ordering ACEs so that access-denied ACEs are first (previously the only requirement). Now ACLs require that inherited ACEs come last regardless of type. I'll try to get a fix in for this. Roger >>> Does the following code look right for getting permissions on an >>> existing file and then adding users to the permissions list? It seems >>> to be working for me on some files, but on another it completed >>> successfully and then when I tried to view permissions on the file >>> using the windows explorer I got a popup that said: >>> The permissions on file.ini are incorrectly ordered, which may cause >>> some entries to be ineffective. Press OK to continue and sort the >>> permissions correctly, or Cancel to reset the permissions. >>> Should I be using something other than >>> DACL_SECURITY_INFORMATION for the info passed to GetFileSecurity? >>> def giveUsersFullControlOfFile(userIds, file): >>> info = win32security.DACL_SECURITY_INFORMATION >>> sd = win32security.GetFileSecurity(file, info) >>> acl = sd.GetSecurityDescriptorDacl() >>> for userId in userIds: >>> sidUser = win32security.LookupAccountName(None,userId)[0] >>> sidCreator = pywintypes.SID() >>> sidCreator.Initialize(ntsecuritycon.SECURITY_CREATOR_SID_AUTHORITY,1) >>> sidCreator.SetSubAuthority(0, ntsecuritycon.SECURITY_CREATOR_OWNER_RID) >>> acl.AddAccessAllowedAce(win32file.FILE_ALL_ACCESS, sidUser) >>> acl.AddAccessAllowedAce(win32file.FILE_ALL_ACCESS, sidCreator) >>> >>> sd.SetSecurityDescriptorDacl(1, acl, 0) >>> win32security.SetFileSecurity(file, info, sd) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040719/529fe073/attachment.html From mhammond at skippinet.com.au Tue Jul 20 08:19:37 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Jul 20 08:19:34 2004 Subject: [python-win32] Can't find WindowFromPoint In-Reply-To: <20040719143710.XUOD1023.mta05-svc.ntlworld.com@[10.137.100.64]> Message-ID: <089701c46e21$89a710a0$0200a8c0@eden> > Is this function implemented, or am I not looking in the right places? It wasn't. It is now (along with the 2 other related functions) :) Let me know your Python version and I'll send you a new win32gui. Mark From darek at tiger.com.pl Tue Jul 20 09:36:17 2004 From: darek at tiger.com.pl (marchew) Date: Tue Jul 20 09:35:55 2004 Subject: [python-win32] high cpu usage in wxPython with Twisted Message-ID: <1631851454.20040720093617@tiger.com.pl> hi, i have a problem integrating wxPython and Twisted under Win32. my application consumes 40-50% of CPU resources when wxFrame is visible and reactor (twisted) is running. i looked at integration example which comes with twisted package and figured that it also has that problem. here comes listing: PYTHON_HOME\Lib\site-packages\TwistedDocs\examples\wxdemo.py #---------------------------------------------------------------- from wxPython.wx import * from twisted.internet import wxreactor wxreactor.install() from twisted.internet import reactor # set up so that "hello, world" is printed once a second def helloWorld(): print "hello, world" reactor.callLater(1, helloWorld) reactor.callLater(1, helloWorld) def twoSecondsPassed(): print "two seconds passed" reactor.callLater(2, twoSecondsPassed) ID_EXIT = 101 class MyFrame(wxFrame): def __init__(self, parent, ID, title): wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, wxSize(300, 200)) menu = wxMenu() menu.Append(ID_EXIT, "E&xit", "Terminate the program") menuBar = wxMenuBar() menuBar.Append(menu, "&File"); self.SetMenuBar(menuBar) EVT_MENU(self, ID_EXIT, self.DoExit) def DoExit(self, event): self.Close(true) reactor.stop() class MyApp(wxApp): def OnInit(self): frame = MyFrame(NULL, -1, "Hello, world") frame.Show(true) self.SetTopWindow(frame) return true def demo(): app = MyApp(0) reactor.registerWxApp(app) reactor.run(0) if __name__ == '__main__': demo() #---------------------------------------------------------------- can You help me? has anyone encountered similar problem? -- marchew mailto:darek@tiger.com.pl -- From darek at tiger.com.pl Mon Jul 19 19:35:40 2004 From: darek at tiger.com.pl (marchew) Date: Tue Jul 20 15:54:18 2004 Subject: [python-win32] high cpu usage in wxPython with Twisted Message-ID: <126076752.20040719193540@tiger.com.pl> hi, i have a problem integrating wxPython and Twisted under Win32. my application consumes 40-50% of CPU resources when wxFrame is visible and reactor (twisted) is running. i looked at integration example which comes with twisted package and figured that it also has that problem. here comes listing: PYTHON_HOME\Lib\site-packages\TwistedDocs\examples\wxdemo.py #---------------------------------------------------------------- from wxPython.wx import * from twisted.internet import wxreactor wxreactor.install() from twisted.internet import reactor # set up so that "hello, world" is printed once a second def helloWorld(): print "hello, world" reactor.callLater(1, helloWorld) reactor.callLater(1, helloWorld) def twoSecondsPassed(): print "two seconds passed" reactor.callLater(2, twoSecondsPassed) ID_EXIT = 101 class MyFrame(wxFrame): def __init__(self, parent, ID, title): wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, wxSize(300, 200)) menu = wxMenu() menu.Append(ID_EXIT, "E&xit", "Terminate the program") menuBar = wxMenuBar() menuBar.Append(menu, "&File"); self.SetMenuBar(menuBar) EVT_MENU(self, ID_EXIT, self.DoExit) def DoExit(self, event): self.Close(true) reactor.stop() class MyApp(wxApp): def OnInit(self): frame = MyFrame(NULL, -1, "Hello, world") frame.Show(true) self.SetTopWindow(frame) return true def demo(): app = MyApp(0) reactor.registerWxApp(app) reactor.run(0) if __name__ == '__main__': demo() #---------------------------------------------------------------- can You help me? has anyone encountered similar problem? -- marchew mailto:darek@tiger.com.pl -- From bacondog835710 at yahoo.com Wed Jul 21 11:44:54 2004 From: bacondog835710 at yahoo.com (barry brant) Date: Wed Jul 21 11:44:58 2004 Subject: [python-win32] Re: high cpu usage in wxPython with Twisted Message-ID: <20040721094454.1378.qmail@web13122.mail.yahoo.com> Don't use ANY of the many variations of the Twisted reactors. They all use some variation of polling, event loop control, etc. Basically they all result in poor performance. I have tried them all (there are about 5 of them). The way I solved the problem with wxPython is the following: launch the standard reactor (not the special wx one, nor any of the other variations) in a separate background process. Then use Pyro to communicate between them (alternatively you can use XMLRPC or COM or sockets or... anything that handles communication between two programs on the same machine). I used Pyro and it works great. With Pyro, you need to set up the background process as a client and the wxPython application as a server off the main event thread (Pyro works fine on a separate thread). The wxPython program does not communicate directly with Twisted, but rather through the background process. The performance is very good... you really can not tell that the server communication is through another process. Lastly, putting the reactor in a separate process solves the problem of it competing for the main event loop with wx. --------------------------------- Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040721/fbd50fc7/attachment.html From florian.proff.schulze at gmx.net Wed Jul 21 13:19:46 2004 From: florian.proff.schulze at gmx.net (Florian Schulze) Date: Wed Jul 21 13:30:24 2004 Subject: [python-win32] GDI+ with Python? Message-ID: Hi! Has anyone here used GDI+ from Python and could tell me how? Regards, Florian Schulze From gjb at crs4.it Wed Jul 21 21:06:21 2004 From: gjb at crs4.it (Gavin Brelstaff) Date: Wed Jul 21 21:06:30 2004 Subject: [python-win32] Existing App-window ->Transparent In-Reply-To: <16E1010E4581B049ABC51D4975CEDB88052CB27B@UKDCX001.uk.int.atosorigin.com> References: <16E1010E4581B049ABC51D4975CEDB88052CB27B@UKDCX001.uk.int.atosorigin.com> Message-ID: <40FEBEAD.7030803@crs4.it> Moore, Paul wrote: > From: Gavin Brelstaff > >>I did a search through the Python Win32 docs and the call >>SetLayeredWindowAttributes seems to be missing from the >>API. I guess you wrote "Windows PowerPro" in C/C++ and not >>in python? > > > I didn't write it but yes, it's in C/C++. It's not available > in source, so you wouldn't be able to get the details from it, > I really only mentioned it as an example to confirm that what > you wanted *could* be done. > > You can probably use ctypes to get at API calls that aren't > exposed by pywin32, if that's of any help. Thanks Paul, Can anyone explain how I can do a call to SetLayeredWindowAttributes eventhough it is not yet implemented/documented in Python Win32. Do I have to declare it some place? \Gavin From craig at coot.net Thu Jul 22 04:58:51 2004 From: craig at coot.net (Craig H. Anderson) Date: Thu Jul 22 04:59:04 2004 Subject: [python-win32] Session object in IIS ASP Python script? Message-ID: I am attempting to mix some Python ASP pages with an existing VBScript ASP site. I have been unable access data on the Session object. Can anyone provide an example of how to do this? From craig_gcs at qwest.net Thu Jul 22 04:36:35 2004 From: craig_gcs at qwest.net (Craig H. Anderson) Date: Thu Jul 22 15:27:52 2004 Subject: [python-win32] Session object in IIS ASP Python script? Message-ID: I am attempting to mix some Python ASP pages with an existing VBScript ASP site. I have been unable access data on the Session object. Can anyone provide an example of how to do this? -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ From brian at assess.net Thu Jul 22 16:53:59 2004 From: brian at assess.net (Brian Brown) Date: Thu Jul 22 16:54:19 2004 Subject: [python-win32] Session object in IIS ASP Python script? In-Reply-To: References: Message-ID: <1090508039.40ffd50709872@www.teuton.org> Quoting "Craig H. Anderson" : > > I am attempting to mix some Python ASP pages with an existing > VBScript ASP site. I have been unable access data on the Session > object. Can anyone provide an example of how to do this? > To set a Session variable from Python/ASP: Session.SetValue("SomeVariableName", "SomeVariableValue") and to use an already set Session var: myLocalVar = Session("SomeVariableName") # looks like the VB way hth, Brian /--------------------------- AbleLink Technologies, Inc. Cognitive Support Technology http://www.ablelinktech.com From jody.burgess at sewardconsulting.com Thu Jul 22 18:42:32 2004 From: jody.burgess at sewardconsulting.com (Jody Burgess) Date: Thu Jul 22 22:50:27 2004 Subject: [python-win32] Exceptions occuring when passing parameters. Message-ID: Hi; I am new to python and am writting a program that accepts directory paths as parameters. I am sending r'Y://mymaindir//mysubdir//my_subdir-002' as one of the parameters. In interactive mode, when executing: import sys import os maindir = r'Y://mymaindir//mysubdir//my_subdir-002' fileNameList = os.listdir(maindir) print fileNameList I get results in the fileNameList list. However, when executing the same code after passing the path as a parameter to a python program, I get an error and am unable to see what the error message. As you can see I am trying to capture the error into a log file. When this code executes, the os.listdir function fails, and error is generated and is displayed in the window. I need to be able to trap the exact error message. try: myfile.write('just before listdir function. Maindir = ' + maindir + '\n') fileNameList = os.listdir(maindir) except: myfile.write(sys.exc_info) myfile.write(sys.exc_type) myfile.write(sys.exc_value) myfile.write('error occurs') Two questions arise: 1) Why does the call work in interactive mode and not when parameters are passed to a program? 2) How can I trap the exact traceback message that appears on the screen? Jody Burgess ISP Systems Analyst Seward Consulting Ltd. 780.702.5103 jody.burgess@sewardconsulting.com From wnvcole at peppermillcas.com Fri Jul 23 01:24:00 2004 From: wnvcole at peppermillcas.com (Vernon Cole) Date: Fri Jul 23 01:24:08 2004 Subject: [python-win32] Exceptions occuring when passing parameters. Message-ID: <07AF3C77A0FBD311A99F00508B65203903272C7A@SEBASTIAN> Jody: I cannot answer your first question. It works fine here, even with the raw - string - double - forward - slash combination, which I assumed would blow everything away. (My environment is python 2.3.4, pywin32 build 202, and Windows 2000) As for how to capture the error message: 1) Why? Just run in command line interactive mode. If you are at a C:\mydir> prompt with your program named X.PY in the default directory, then just type "x.py" at the command prompt and read the error message on the screen. 2) If you really DO need to capture the error traceback, then use the python system, don't fight it. syserr is a file object and can be reassigned freely. The following example will write a list of filenames, and then an error traceback, in the file X.TXT: def dirtest(dir): import sys import os sys.stderr = myfile myfile.write('just before listdir function. Maindir = ' + dir + '\n') fileNameList = os.listdir(dir) myfile.write(str(fileNameList)) myfile.write('\nDone\n') myfile = file("X.txt","w") #this will work dirtest(r'C://Windows//system32//dllcache') #this will fail dirtest(r'XC://Windows//system32//dllcache') myfile.close() -----Original Message----- From: Jody Burgess [mailto:jody.burgess@sewardconsulting.com] Sent: Thursday, July 22, 2004 10:43 AM To: python-win32@python.org Subject: [python-win32] Exceptions occuring when passing parameters. Importance: High Hi; I am new to python and am writting a program that accepts directory paths as parameters. I am sending r'Y://mymaindir//mysubdir//my_subdir-002' as one of the parameters. In interactive mode, when executing: import sys import os maindir = r'Y://mymaindir//mysubdir//my_subdir-002' fileNameList = os.listdir(maindir) print fileNameList I get results in the fileNameList list. However, when executing the same code after passing the path as a parameter to a python program, I get an error and am unable to see what the error message. As you can see I am trying to capture the error into a log file. When this code executes, the os.listdir function fails, and error is generated and is displayed in the window. I need to be able to trap the exact error message. try: myfile.write('just before listdir function. Maindir = ' + maindir + '\n') fileNameList = os.listdir(maindir) except: myfile.write(sys.exc_info) myfile.write(sys.exc_type) myfile.write(sys.exc_value) myfile.write('error occurs') Two questions arise: 1) Why does the call work in interactive mode and not when parameters are passed to a program? 2) How can I trap the exact traceback message that appears on the screen? Jody Burgess ISP Systems Analyst Seward Consulting Ltd. 780.702.5103 jody.burgess@sewardconsulting.com _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From tim.golden at viacom-outdoor.co.uk Fri Jul 23 10:16:31 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri Jul 23 10:20:15 2004 Subject: [python-win32] Exceptions occuring when passing parameters. Message-ID: | Hi; | I am new to python and am writting a program that | accepts directory paths | as parameters. | I am sending r'Y://mymaindir//mysubdir//my_subdir-002' as one of the | parameters. Just to clarify something here, you're going slightly into overkill mode with that path name. You've obviously avoided the usual mistake of just passing "c:\path\to\file" where the "\t" in the middle would be interpreted as a tab, but instead of just using the r-prefix or just doubling the backslashes or just using forward-slashes, you've done all three! I'm honestly rather surprised it even works. Just to explain, you could do one of these (but I suggest only one): a) r"y:\mymaindir\mysubdir\mysubdir-002" b) "y:\\mymaindir\\mysubdir\\mysubdir-002" c) "y:/mymaindir/mysubdir/mysubdir-002" To test them out, just try running them at the interactive prompt: import os os.listdir () Now the difference between this and the command-line is that python will convert whatever you type at the command line into a python string, so there's no need to put double-quotes or prefix with an r. import os, sys dirname = sys.argv[1] print dirname print os.listdir (dirname) c:\> myscript.py y:\mymaindir\mysubdir\mysubdir-002 You should see the name of the directory followed by a list of its contents. Someone else has already given advice on trapping the error message (basically, run the thing from the command prompt rather than by double-clicking on its icon). I hope that all helps. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From baryza at intersystems.com Fri Jul 23 18:53:40 2004 From: baryza at intersystems.com (Greg Baryza) Date: Fri Jul 23 18:53:59 2004 Subject: [python-win32] How do I re-assign stdin and stdout Message-ID: <5.0.2.1.2.20040723124704.024b63a0@moon> Sorry for the newbie question, but... So far I have been creating scripts that automate command invocations and start up Windows apps just fine. Now, however, I wanted automate some Perforce commands. Perforce has an option that takes writes its command output as a marshaled Python dictionary. This requires me to route stdout to a file. I have created a file using win32file and gotten back a file handle. I have assigned that file handle to the hStdOutput item in STARTUPINFO. I have passed the STARTUPINFO to the win32process.CreateProcess method. Yet, the output does not get written to the file. I have tested various combinations of create and sharing options, but nothing seems to work. There is obviously some detail I am missing. Can someone give me the nudge I need to get over this hurdle? TIA From craig at coot.net Fri Jul 23 19:36:40 2004 From: craig at coot.net (Craig H. Anderson) Date: Fri Jul 23 19:36:44 2004 Subject: [python-win32] db-api connection pooling in ASP? Message-ID: Greetings, My adventure in mixing Python scripting into an existing VBScript and Javascript application is moving along. The current question is how to manage database connections. * The database is Sql-server 2000 * Current VBScript code uses ADO * New Python code uses DB-API library adodbapi In production there may be 100 browser seats accessing the web pages. I'm thinking I will try this library http://jonpy.sourceforge.net/dbpool.html Does anyone have experience and advice on this? Another possibility is using the same ADO connection object as the VBScript code. I could use this to initialze the adodbapi connection. However, I'm not sure how to pass the ADO object from VBScript to Python. Thanks for your help. From gtalvola at nameconnector.com Fri Jul 23 19:55:19 2004 From: gtalvola at nameconnector.com (Geoffrey Talvola) Date: Fri Jul 23 19:55:23 2004 Subject: [python-win32] db-api connection pooling in ASP? Message-ID: <61957B071FF421419E567A28A45C7FE5029D2258@mailbox.nameconnector.com> ADO will do connection pooling automatically. In my experience all you need to do is make sure that at least one connection always exists with a particular connection string, by keeping a connection object in a global variable. Then all other connections with the same connection string are automatically pooled and recycled. In other words you can write the rest of your code to simply create and destroy connections as needed and pooling will happen by magic. adodbapi is a wrapper over ADO, so automatic connection pooling should work with it. You can use Performance Monitor to verify the number of SQL Server connections and see if pooling is working properly. Hope this helps. - Geoff Craig H. Anderson wrote: > Greetings, > > My adventure in mixing Python scripting into > an existing VBScript and Javascript application > is moving along. The current question is how > to manage database connections. > > * The database is Sql-server 2000 > * Current VBScript code uses ADO > * New Python code uses DB-API library adodbapi > > In production there may be 100 browser seats accessing > the web pages. > > I'm thinking I will try this library > http://jonpy.sourceforge.net/dbpool.html > > Does anyone have experience and advice on this? > > Another possibility is using the same ADO connection object > as the VBScript code. I could use this to initialze the adodbapi > connection. However, I'm not sure how to pass the ADO object from > VBScript to Python. > > Thanks for your help. > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From jens.jorgensen at tallan.com Fri Jul 23 19:57:46 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Fri Jul 23 19:58:01 2004 Subject: [python-win32] db-api connection pooling in ASP? In-Reply-To: References: Message-ID: <4101519A.8030800@tallan.com> You probably don't need to do anything as connection pooling is built into ODBC and OLEDB. The main thing is to make sure the connection string is identical. You can pass the vbscript connection to Python in a couple of ways. The easiest would be to make your python code into a COM object and pass it that way. Do some googling for deeper information on how ODBC and OLEDB do their connection pooling. Craig H. Anderson wrote: > > Greetings, > My adventure in mixing Python scripting into > an existing VBScript and Javascript application > is moving along. The current question is how > to manage database connections. > * The database is Sql-server 2000 > * Current VBScript code uses ADO > * New Python code uses DB-API library adodbapi > In production there may be 100 browser seats accessing > the web pages. > I'm thinking I will try this library > http://jonpy.sourceforge.net/dbpool.html > Does anyone have experience and advice on this? > Another possibility is using the same ADO connection object > as the VBScript code. I could use this to initialze the adodbapi > connection. However, I'm not sure how to pass the ADO object > from VBScript to Python. > Thanks for your help. > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 2861 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040723/dc527c2d/smime.bin From david at graniteweb.com Fri Jul 23 21:56:11 2004 From: david at graniteweb.com (David Rock) Date: Fri Jul 23 21:56:14 2004 Subject: [python-win32] How do I re-assign stdin and stdout In-Reply-To: <5.0.2.1.2.20040723124704.024b63a0@moon> References: <5.0.2.1.2.20040723124704.024b63a0@moon> Message-ID: <20040723195611.GC15342@wdfs.attbi.com> * Greg Baryza [2004-07-23 12:53]: > Sorry for the newbie question, but... > > So far I have been creating scripts that automate command invocations and > start up Windows apps just fine. Now, however, I wanted automate some > Perforce commands. Perforce has an option that takes writes its command > output as a marshaled Python dictionary. This requires me to route stdout > to a file. > > I have created a file using win32file and gotten back a file handle. I > have assigned that file handle to the hStdOutput item in STARTUPINFO. I > have passed the STARTUPINFO to the win32process.CreateProcess method. Yet, > the output does not get written to the file. > > I have tested various combinations of create and sharing options, but > nothing seems to work. There is obviously some detail I am missing. Can > someone give me the nudge I need to get over this hurdle? The simplest way to redirect stdout to a file is something like this: print >>file, "what you want to print(write)" This may not be quite what you are looking for, though. -- David Rock david@graniteweb.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040723/fac155f2/attachment.pgp From Shu-Chin.Cheeng at Shell.com Fri Jul 23 23:12:24 2004 From: Shu-Chin.Cheeng at Shell.com (Cheeng, Shu-Chin SC SITI-ITIBDO2) Date: Fri Jul 23 23:12:30 2004 Subject: [python-win32] How to create new MAPI Profile in Python vs C++?? Message-ID: Hi All, Anyone know how to create new MAPI Profile in Python base on Microsoft C++ code example(http://support.microsoft.com/default.aspx?scid=kb;EN-US;306962)?? this is my source: =========================================================== from win32com.mapi import mapitags,emsabtags from win32com.mapi import mapi from win32com.mapi import mapiutil import pprint,pythoncom prf='cgf' mapi.MAPIInitialize(None) ma=mapi.MAPIAdminProfiles(0) ma.DeleteProfile(prf,0) mt=ma.GetProfileTable(0) #print '='*50 #pprint.pprint(mt.QueryRows(mt.GetRowCount(0),0)) pf=ma.CreateProfile(prf,None,0,0) pa=ma.AdminServices(prf,None,0,0) pa.CreateMsgService('MSEMS',None,0,0) pst=pa.GetMsgServiceTable(0) tbp=pst.QueryRows(mt.GetRowCount(0),0) print '='*50 pprint.pprint(tbp) print '='*50 tbr=mapi.HrQueryAllRows(pst,None,None,None,0) pprint.pprint(tbr[0][0][1]) print '='*50 pa.ConfigureMsgService(tbr[0][0][1],0,0,((1711800351,"MyServer"),(1711734815,"csc"))) # it fail in this line print '='*50 #ma.DeleteProfile(prf,0) mapi.MAPIUninitialize() =========================================================== result: =========================================================== C:\csc\PY\PyKIV>mpii.py C:\Python23\lib\site-packages\win32comext\mapi\mapitags.py:59: FutureWarning: x< iid in python need IID (GUID) but in C++ need 16 bytes of MAPIUID... Anyone know the trick & tips on this??? Regards, Cheeng Shu Chin SA-Messaging Shell Information Technology International 2340 Century Square, Jalan Usahawan, 63000 Cyberjaya, Selangor D.E., Malaysia -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040724/3f862c7c/attachment.html From mhammond at skippinet.com.au Sat Jul 24 01:14:51 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat Jul 24 01:14:45 2004 Subject: [python-win32] How do I re-assign stdin and stdout In-Reply-To: <5.0.2.1.2.20040723124704.024b63a0@moon> Message-ID: <048701c4710a$dc31f650$0200a8c0@eden> The simplest way is to use the popen() family of functions. If you really do need to re-implement it in Python, you probably want to check out the source to popen - it plays a similar dance you what you tried. Mark. > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of Greg Baryza > Sent: Saturday, 24 July 2004 2:54 AM > To: python-win32@python.org > Subject: [python-win32] How do I re-assign stdin and stdout > > > Sorry for the newbie question, but... > > So far I have been creating scripts that automate command > invocations and > start up Windows apps just fine. Now, however, I wanted > automate some > Perforce commands. Perforce has an option that takes writes > its command > output as a marshaled Python dictionary. This requires me to > route stdout > to a file. > > I have created a file using win32file and gotten back a file > handle. I > have assigned that file handle to the hStdOutput item in > STARTUPINFO. I > have passed the STARTUPINFO to the win32process.CreateProcess > method. Yet, > the output does not get written to the file. > > I have tested various combinations of create and sharing options, but > nothing seems to work. There is obviously some detail I am > missing. Can > someone give me the nudge I need to get over this hurdle? > > TIA > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From rwupole at msn.com Sat Jul 24 05:13:59 2004 From: rwupole at msn.com (Roger Upole) Date: Sat Jul 24 04:57:38 2004 Subject: [python-win32] Re: How do I re-assign stdin and stdout Message-ID: <000601c4712c$45361b10$ae2af243@rupole> You'll need to set win32con.STARTF_USESTDHANDLES in the dwFlags member of PySTARTUPINFO. Also, the PySECURITY_ATTRIBUTES in the call to CreateFile has to have bInherit set to True, and the bInheritHandles parm to CreateProcess has to be True. hth Roger >>> Sorry for the newbie question, but... >>> So far I have been creating scripts that automate command invocations and >>> start up Windows apps just fine. Now, however, I wanted automate some >>> Perforce commands. Perforce has an option that takes writes its command >>> output as a marshaled Python dictionary. This requires me to route stdout >>> to a file. >>> I have created a file using win32file and gotten back a file handle. I >>> have assigned that file handle to the hStdOutput item in STARTUPINFO. I >>> have passed the STARTUPINFO to the win32process.CreateProcess method. Yet, >>> the output does not get written to the file. >>> I have tested various combinations of create and sharing options, but >>> nothing seems to work. There is obviously some detail I am missing. Can >>> someone give me the nudge I need to get over this hurdle? >>> TIA >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040723/8f678e47/attachment.html From trader at terray.com Fri Jul 23 05:23:49 2004 From: trader at terray.com (trader) Date: Sun Jul 25 16:29:02 2004 Subject: [python-win32] Exceptions occuring when passing parameters. Message-ID: Hi Jody, This code works for me, and answers your Question #2: #---------------------------------------------------------------------# try: int('Error') # create an obvious error except: import traceback writefile = open('errors.log', 'a') traceback.print_exc(file=writefile) # this command outputs the # error message as it appears # in the interactive # environment writefile.close() #---------------------------------------------------------------------# As an alternative, you could change 'file=writefile' to 'file=sys.stdout', after importing the sys module, in order to see the code appear in your DOS window. You're probably doing something different when passing in your command line arguments that's hosing up the code. Any spaces in your path will break up sys.argv into different pieces. You'd have to pull it all together, with code like: import sys if len(sys.argv) > 1: path2use = " ".join(sys.argv[1:]) It *never* hurts to import the os module and do an os.path.normpath() and an os.path.exists() on your path argument to verify that your target path or direction actually exists. Hope that helps, and good luck! JT P.S. Your use of r'Y://mymaindir//mysubdir//my_subdir-002' is a little screwy. The r(aw) modifier is meant to turn backslashes (\) into literals and not escape characters, which means you can create a path string like r'c:\Program Files\MyGreatApp' without having to worry about those backslashes having a 'meta' meaning. Otherwise, you'd have to double up on them: 'c:\\Program Files\\MyGreatApp' . Doubling up forward slashes is unnecessary in your example. From bwinton at latte.ca Fri Jul 23 17:44:51 2004 From: bwinton at latte.ca (Blake Winton) Date: Sun Jul 25 16:29:03 2004 Subject: [python-win32] Python/Palm Parameter passing problems... Message-ID: <41013273.8020609@latte.ca> So, I'm trying to write a conduit for my Palm in Python, using the COM interface. I've successfully implemented the Interface I need to, and I can run my conduit, and even call some methods, however, I'm running into a problem calling the following method: Function ReadNextModifiedInCategory(nIndex as Long, vUniqueId as Variant, nCategory as Long, nAttributes as ERecordAttributes) as Variant Parameters <- nIndex Index of returned record. <- vUniqueId Unique ID of returned record. -> nCategory Category ID of record to return. <- nAttributes Attributes from the ERecordAttributes constants. Returns For PDRecordAdapter objects representing any database, returns a Byte array containing record data. The generated Python method is: def ReadNextModifiedInCategory(self, nIndex=pythoncom.Missing, pvUniqueId=pythoncom.Missing, nCategory=defaultNamedNotOptArg, eAttributes=pythoncom.Missing): """method ReadNextModifiedInCategory""" return self._ApplyTypes_(7, 1, (12, 0), ((16387, 2), (16396, 2), (3, 1), (16387, 2)), 'ReadNextModifiedInCategory', None,nIndex, pvUniqueId, nCategory, eAttributes) I've tried the following calls: categoryId = 17 # --- z = adapter.ReadNextModifiedInCategory( nCategory=categoryId ) # --- index, uid, attribs = 0, 0, 0 z=adapter.ReadNextModifiedInCategory( index, uid, categoryId, attribs ) # --- index, uid, attribs = 0, "0000", 0 uid2 = buffer(uid) z=adapter.ReadNextModifiedInCategory( index, uid2, categoryId, attribs ) # --- index, uid, attribs = 0, "0000", 0 z=adapter.ReadNextModifiedInCategory( index, uid, categoryId, attribs ) # --- And none of them seem to work. The first one gives me: Traceback (most recent call last): File "C:\PROGRA~1\Python\lib\site-packages\conduit\PyConduit.py", line 81, in BeginProcess z = adapter.ReadNextModifiedInCategory( nCategory=categoryId ) File "C:\PROGRA~1\Python\lib\site-packages\win32com\gen_py\6FD7A7A1-FA1F-11D2-AC32-006008E3F0A2x0x1x0.py", line 1251, in ReadNextModifiedInCategory return self._ApplyTypes_(7, 1, (12, 0), ((16387, 2), (16396, 2), (3, 1), (16387, 2)), 'ReadNextModifiedInCategory', None,nIndex, pvUniqueId, nCategory, eAttributes) File "C:\PROGRA~1\Python\lib\site-packages\win32com\client\__init__.py", line 445, in _ApplyTypes_ return self._get_good_object_(self._oleobj_.InvokeTypes(*((dispid, 0, wFlags, retType, argTypes) + args)), user, resultCLSID) TypeError: int() argument must be a string or a number And the others give me: Traceback (most recent call last): File "C:\PROGRA~1\Python\lib\site-packages\conduit\PyConduit.py", line 80, in BeginProcess z = adapter.ReadNextModifiedInCategory( index, prefs, categoryId, attribs ) File "C:\PROGRA~1\Python\lib\site-packages\win32com\gen_py\6FD7A7A1-FA1F-11D2-AC32-006008E3F0A2x0x1x0.py", line 1251, in ReadNextModifiedInCategory return self._ApplyTypes_(7, 1, (12, 0), ((16387, 2), (16396, 2), (3, 1), (16387, 2)), 'ReadNextModifiedInCategory', None,nIndex, pvUniqueId, nCategory, eAttributes) File "C:\PROGRA~1\Python\lib\site-packages\win32com\client\__init__.py", line 445, in _ApplyTypes_ return self._get_good_object_(self._oleobj_.InvokeTypes(*((dispid, 0, wFlags, retType, argTypes) + args)), user, resultCLSID) com_error: (-2147352567, 'Exception occurred.', (0, 'PDDirect.PDRecordAdapter.1', 'Parameter error', None, 0, -2147213312), None) Any ideas what I might be doing wrong here, or how I could find out what parameter to pass? I'm fairly sure that the problem is with the second parameter, pvUniqueId, the [out] Variant, but I can't quite figure out what I should change it to. Thanks, Blake. From craig at coot.net Mon Jul 26 21:43:36 2004 From: craig at coot.net (Craig H. Anderson) Date: Mon Jul 26 21:43:40 2004 Subject: [python-win32] Reload Python libraries to ASP script engine Message-ID: One of the things I like about Python is managing libraries with distutils. I struggled for a while with how to get my ASP pages to use newly installed Python libraries. Here is a procedure I found to work: Start->All Programs->Administrative Tools->Internet Information Services Right Click on 'Default Web Site' select Properties Select 'Home Directory' panel Set Application Projection to 'Medium (Pooled' Click on the Unload button Unloading this application will unload all applications in the application pool. Are you sure you want to continue? Click on Yes After doing this, my newly installed Python library code is run. I assume this causes any Python script engine to exit and a new Python script engine to be started at the next ASP reference. Are there other ways to get Python library code loaded? From mhammond at skippinet.com.au Tue Jul 27 09:11:10 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Jul 27 09:11:12 2004 Subject: [python-win32] Reload Python libraries to ASP script engine In-Reply-To: Message-ID: <069b01c473a8$e89586f0$0200a8c0@eden> > After doing this, my newly installed Python library code is run. > I assume this causes any Python script engine to exit and a new > Python script engine to be started at the next ASP reference. > > Are there other ways to get Python library code loaded? Remember that inside ASP, you just have a simple Python environment. So the issues you face are identical to what python.exe faces. Thus, the problem you describe can happen in one of 2 ways: * You already had an imported module of the same name as the new one. * the newly installed modules relied on a sys.path change. A third way would be something I haven't thought of :) So, consider these problems as if you were facing them from python.exe and didn't want to shut it down. For the 2 secnarios above, you would need either an explicit "reload()", or a runtime modification to sys.path. So one option would be a private page with a multi-line edit control, and your ASP code could simply execute this code (via "exec"). In this form you could enter a statement like: """ import foo reload(foo) """ or maybe: """ import sys sys.path.append("c:\\mydir") """ and the foo module will be reloaded for the entire process. There are other ways you could tackle this too. Unfortunately, exactly what you do will probably depend on your app, so providing any kind of generic "reload_libraries" command is not practical. I hope that makes sense. Mark. From emmanuel.breton at logilab.fr Wed Jul 28 15:46:47 2004 From: emmanuel.breton at logilab.fr (Emmanuel Breton) Date: Wed Jul 28 15:46:50 2004 Subject: [python-win32] automation error on VB CreateObject Message-ID: <20040728134647.GF805@logilab.fr> Hi I have been trying to work arround an automation error for the second day and make no progress so far and would greatly appreciate your help :) Here is my problem: Any call to Set com_object = CreateObject("MyModule") throws a MsgBox with the following error: ---- Runtime Error '-2147467259 (80004005)' Automation error Unspecified error ---- I am working at a client's on Windows Server 2003 (python 2.3) with the Pack Office 2002 (same error from Excel or Word). What's weird is that the same code (both the python server and the VB client) works fine at work on a Windows 2000 OS (python 2.1). I have checked the Path and the PYTHONPATH, checked that I could Create my pythonCOM object from a python client: Win32com.client.Dispath("MyModule") works fine... I have also tried to rebuild a SimpleCOMServer and a simple client from Python Programming on Win32... without any more success however. (Still, when doing the same on my Win2000 environnement, it works great!) If you have any idea/suggestion/answer... Thanks Emmanuel Follow the code I have used for my tests: ---- Class PythonUtilities: _public_methods_ = [ 'SplitString' ] _reg_progid_ = "PythonDemos.Utilities" _reg_clsid_ = unique_generated_clsid def SplitString(self, val, item=None): import string if item != None: item = str(item) return string.split(str(val), item) Here is the VB script (from the book too) ---- Sub python_test() Set PythonUtils = CreateObject("PythonDemos.Utilities") response = PythonUtils.SplitString("Hello from VB") For Each Item In response MsgBox Item Next End Sub -- Emmanuel Br?ton LOGILAB, Paris (France) Tel: 01 45 32 03 12 http://www.logilab.org -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040728/e2e6bbbf/attachment.pgp From fmml at cedval.org Wed Jul 28 20:35:16 2004 From: fmml at cedval.org (fmml@cedval.org) Date: Wed Jul 28 20:41:03 2004 Subject: [python-win32] win32ras.dial Message-ID: <4940.192.168.41.52.1091039716.squirrel@whoami3.cedval.org> Hi all, I need to have a window machine, to periodically transfer a file over the internet. The Net connection is by modem. When trying the code below, the script initiate a call, but seem to close the connection right after. Does anybody have example code of using win32ras.dial? import win32ras, ftplib, os handle = win32ras.Dial(None, None, ("my_local_isp",), None) os.chdir('/temp') ftp = ftplib.FTP("myftpserver.mydomain.org") ftp.login("myftp", "myftp") filename = 'fmtest.txt' ftp.storlines("STOR " + filename, open(filename)) win32ras.HangUp() Regards, Francois From mhammond at skippinet.com.au Thu Jul 29 00:41:25 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Jul 29 00:41:17 2004 Subject: [python-win32] win32ras.dial In-Reply-To: <4940.192.168.41.52.1091039716.squirrel@whoami3.cedval.org> Message-ID: <029201c474f4$045973f0$0200a8c0@eden> > When trying the code below, the script initiate a call, but > seem to close > the connection right after. Does anybody have example code of using > win32ras.dial? I'm not sure if this is your problem, but a couple of test scripts I have here do: dial, have_pw = win32ras.GetEntryDialParams(None, rasEntryName) rasHandle, errCode = win32ras.Dial(None, None, dial, None) if win32ras.IsHandleValid(rasHandle): # worked. Check out win32\Demos\rastest.py - it makes and breaks connections. Mark. From mhammond at skippinet.com.au Thu Jul 29 00:43:33 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Jul 29 00:43:17 2004 Subject: [python-win32] automation error on VB CreateObject In-Reply-To: <20040728134647.GF805@logilab.fr> Message-ID: <029801c474f4$504073e0$0200a8c0@eden> I suggest you follow the steps for debugging Python COM objects - ie, register with "--debug", and start the Pythonwin "Remote Trace Collector". Hopefully this will cause the error to be dumped to Pythonwin, shedding some light. Mark > -----Original Message----- > From: python-win32-bounces+mhammond=keypoint.com.au@python.org > [mailto:python-win32-bounces+mhammond=keypoint.com.au@python.org]On > Behalf Of Emmanuel Breton > Sent: Wednesday, 28 July 2004 11:47 PM > To: python-win32@python.org > Subject: [python-win32] automation error on VB CreateObject > > > Hi > > I have been trying to work arround an automation error for > the second day and make no progress so far and would greatly > appreciate your help :) > > Here is my problem: Any call to > Set com_object = CreateObject("MyModule") throws a MsgBox > with the following error: > ---- > Runtime Error '-2147467259 (80004005)' > > Automation error > Unspecified error > ---- > > I am working at a client's on Windows Server 2003 (python > 2.3) with the Pack Office 2002 (same error from Excel or Word). > What's weird is that the same code (both the python server > and the VB client) works fine at work on a Windows 2000 OS > (python 2.1). > > I have checked the Path and the PYTHONPATH, > checked that I could Create my pythonCOM object from a python client: > Win32com.client.Dispath("MyModule") works fine... > > I have also tried to rebuild a SimpleCOMServer and a simple > client from Python Programming on Win32... > without any more success however. > (Still, when doing the same on my Win2000 environnement, it > works great!) > > If you have any idea/suggestion/answer... > Thanks > > Emmanuel > > Follow the code I have used for my tests: > > ---- > Class PythonUtilities: > _public_methods_ = [ 'SplitString' ] > _reg_progid_ = "PythonDemos.Utilities" > _reg_clsid_ = unique_generated_clsid > > def SplitString(self, val, item=None): > import string > if item != None: item = str(item) > return string.split(str(val), item) > > Here is the VB script (from the book too) > ---- > Sub python_test() > Set PythonUtils = CreateObject("PythonDemos.Utilities") > response = PythonUtils.SplitString("Hello from VB") > For Each Item In response > MsgBox Item > Next > End Sub > > -- > Emmanuel Br?ton LOGILAB, > Paris (France) > Tel: 01 45 32 03 12 http://www.logilab.org From tim.golden at viacom-outdoor.co.uk Thu Jul 29 08:08:13 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Thu Jul 29 08:11:36 2004 Subject: [python-win32] win32ras.dial Message-ID: [fmml@cedval.org] | I need to have a window machine, to periodically transfer a | file over the internet. The Net connection is by modem. | When trying the code below, the script initiate a call, but | seem to close the connection right after. | Does anybody have example code of using win32ras.dial? Just to reassure you, I've recently used Python to save our (and our customer's) bacon by maintaining a dial-up from some high-profile advertising sites here in London. So it definitely works. The important code fragment is: def connect (ras_entry_name, username, password): return win32ras.Dial ( None, None, (ras_entry_name, "", "", username, password, ""), None ) [fmml@cedval.org] | handle = win32ras.Dial(None, None, ("my_local_isp",), None) Now it's not clear from your code whether the "my_local_isp" in your third parameter is the name of a dial-up entry. Assuming it is, are the username/password stored against the entry? Try adding them in explicitly. I'm a little surprised that the function doesn't throw you out for passing the wrong number of entries in the RASDIALPARAMS tuple. Try specifying them all as in my example above. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From emmanuel.breton at logilab.fr Thu Jul 29 10:19:28 2004 From: emmanuel.breton at logilab.fr (Emmanuel Breton) Date: Thu Jul 29 10:19:29 2004 Subject: [python-win32] automation error on VB CreateObject In-Reply-To: <029801c474f4$504073e0$0200a8c0@eden> References: <20040728134647.GF805@logilab.fr> <029801c474f4$504073e0$0200a8c0@eden> Message-ID: <20040729081927.GC808@logilab.fr> On Thu, Jul 29, 2004 at 08:43:33AM +1000, Mark Hammond wrote: > I suggest you follow the steps for debugging Python COM objects - ie, > register with "--debug", and start the Pythonwin "Remote Trace Collector". > Hopefully this will cause the error to be dumped to Pythonwin, shedding some > light. > > Mark > Thanks for the piece of advice :) Now, the problem seems to come from gateways... from VB: On command o = CreateObject("PythonDemos.Server") ----error------> Object with win32trace dispatcher created (object=None) pythoncom error: CPyFactory::CreateInstance failed to get gateway to returned object exceptions.ValueError: argument is not a COM object Whereas, from pythonWin: >>> o = win32com.client.Dispatch("PythonDemos.Server") ----success------> Object with win32trace dispatcher created (object=None) >>> o.SplitString("hi there") in _Invoke_ with 1000 0 1 (u'hi there',) (u'hi', u'there') >>> does the following trace makes sense to you? -- Emmanuel Br?ton LOGILAB, Paris (France) Tel: 01 45 32 03 12 http://www.logilab.org -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040729/efddb0a4/attachment.pgp From mhammond at skippinet.com.au Thu Jul 29 12:03:40 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Jul 29 12:03:34 2004 Subject: [python-win32] automation error on VB CreateObject In-Reply-To: <20040729081927.GC808@logilab.fr> Message-ID: <011201c47553$54bd6450$0200a8c0@eden> > does the following trace makes sense to you? Not really! I'm afraid that makes no sense at all, unless you have 2 different "modules" with the same name, and that the VB environment is finding one, while Python is finding another due to different CWD. However, that seems unlikely for that sample. Alternatively, duplicate pythoncom23.dll files could also explain it. Actually, the more I think about it, the more likely this is it. Failing that, I would start adding extra print statements in policy.py, particularly in CreateInstance. Mark. From emmanuel.breton at logilab.fr Thu Jul 29 15:04:49 2004 From: emmanuel.breton at logilab.fr (Emmanuel Breton) Date: Thu Jul 29 15:04:52 2004 Subject: [python-win32] automation error on VB CreateObject In-Reply-To: <011201c47553$54bd6450$0200a8c0@eden> References: <20040729081927.GC808@logilab.fr> <011201c47553$54bd6450$0200a8c0@eden> Message-ID: <20040729130449.GG808@logilab.fr> On Thu, Jul 29, 2004 at 08:03:40PM +1000, Mark Hammond wrote: > > Alternatively, duplicate pythoncom23.dll files could also explain it. Got it! Nice shot! :) Then Excel was getting confused between the different versions of python 2.1, 2?2 and 2.3. Actually there was another dll involved along with pythoncom2x.dll: pywintypes2x.dll. Thanks a lot, its a real pleasure to have these three MsgBox "Hello" "from" "VB" :) -- Emmanuel Br?ton LOGILAB, Paris (France) Tel: 01 45 32 03 12 http://www.logilab.org -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040729/43302dc1/attachment.pgp From ndrake at gmail.com Thu Jul 29 01:43:05 2004 From: ndrake at gmail.com (Nate Drake) Date: Thu Jul 29 15:37:56 2004 Subject: [python-win32] Capture "Windows Key" keypress Message-ID: Hi, Is there a way to have my python program catch when the user has pressed the windows key, and to prevent the OS from seeing that the user has pressed it? I'm writing a small "game" with pygame, and he sometimes bangs the windows key and the game is minimized and I go back to the desktop. Thanks! Nate From tim.golden at viacom-outdoor.co.uk Thu Jul 29 16:01:03 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Thu Jul 29 16:04:21 2004 Subject: [python-win32] Capture "Windows Key" keypress Message-ID: [Nate Drake] | Is there a way to have my python program catch when the user has | pressed the windows key, and to prevent the OS from seeing that the | user has pressed it? | | I'm writing a small "game" with pygame, and he sometimes bangs the | windows key and the game is minimized and I go back to the desktop. I don't know of any way to do exactly this, but even assuming someone can come up with some system-hook derived mechanism, I would *strongly* advise against doing it unless you have some mission-critical reason for it... and possibly not then. I say this simply because I believe it would take quite a low-level hack to override the Win key and such hacks have a nasty effect of destabilising other things. My twopence-ha'penny worth. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From mhammond at skippinet.com.au Fri Jul 30 01:40:39 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Jul 30 01:40:29 2004 Subject: [python-win32] How to create new MAPI Profile in Python vs C++?? In-Reply-To: Message-ID: <037701c475c5$752877d0$0200a8c0@eden> There are "exchange" and "exchdapi" modules which have some of this stuff as helper functions. For example, exchange.HrCreateProfileName() exists. I really can't recall where some of this came from, as HrCreateProfileName() etc seem completely undocumented by MS, and even google struggles to find references. However, other functions like HrCreateMailboxAgentProfile() are documented. Re your particular question - the "mapi" module itself contains all the IIDs recognized - pass one of them. Mark. -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Cheeng, Shu-Chin SC SITI-ITIBDO2 Sent: Saturday, 24 July 2004 7:12 AM To: python-win32@python.org; Mark Hammond Cc: Cheeng, Shu-Chin SC SITI-ITIBDO2 Subject: [python-win32] How to create new MAPI Profile in Python vs C++?? Hi All, Anyone know how to create new MAPI Profile in Python base on Microsoft C++ code example( http://support.microsoft.com/default.aspx?scid=kb;EN-US;306962 )?? this is my source: =========================================================== from win32com.mapi import mapitags,emsabtags from win32com.mapi import mapi from win32com.mapi import mapiutil import pprint,pythoncom prf='cgf' mapi.MAPIInitialize(None) ma=mapi.MAPIAdminProfiles(0) ma.DeleteProfile(prf,0) mt=ma.GetProfileTable(0) #print '='*50 #pprint.pprint(mt.QueryRows(mt.GetRowCount(0),0)) pf=ma.CreateProfile(prf,None,0,0) pa=ma.AdminServices(prf,None,0,0) pa.CreateMsgService('MSEMS',None,0,0) pst=pa.GetMsgServiceTable(0) tbp=pst.QueryRows(mt.GetRowCount(0),0) print '='*50 pprint.pprint(tbp) print '='*50 tbr=mapi.HrQueryAllRows(pst,None,None,None,0) pprint.pprint(tbr[0][0][1]) print '='*50 pa.ConfigureMsgService(tbr[0][0][1],0,0,((1711800351,"MyServer"),(1711734815 ,"csc"))) # it fail in this line print '='*50 #ma.DeleteProfile(prf,0) mapi.MAPIUninitialize() =========================================================== result: =========================================================== C:\csc\PY\PyKIV>mpii.py C:\Python23\lib\site-packages\win32comext\mapi\mapitags.py:59: FutureWarning: x< iid in python need IID (GUID) but in C++ need 16 bytes of MAPIUID... Anyone know the trick & tips on this??? Regards, Cheeng Shu Chin SA-Messaging Shell Information Technology International 2340 Century Square, Jalan Usahawan, 63000 Cyberjaya, Selangor D.E., Malaysia -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 8276 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040730/31a0173d/winmail.bin From mferguson at ntlworld.com Sat Jul 31 12:27:37 2004 From: mferguson at ntlworld.com (Mark Ferguson) Date: Sat Jul 31 12:28:55 2004 Subject: [python-win32] Capture "Windows Key" keypress In-Reply-To: References: Message-ID: <1091269657.2714.6.camel@trout.kintore.net> Have a look at Peter Parente's excellent pyHook module at http://sourceforge.net/projects/uncassist I know this can pick up the keyboard events, although I'm not sure if you can remove it before the system processes it. Must be worth a look though... Mark. On Thu, 2004-07-29 at 00:43, Nate Drake wrote: > Hi, > > Is there a way to have my python program catch when the user has > pressed the windows key, and to prevent the OS from seeing that the > user has pressed it? > > I'm writing a small "game" with pygame, and he sometimes bangs the > windows key and the game is minimized and I go back to the desktop. > > Thanks! > > Nate > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 Mark Ferguson Mobile 07919 068906 Home 0141 571 2479 email mferguson@ntlworld.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040731/5e941490/attachment.html From bartek.b at eranet.pl Sat Jul 31 20:00:22 2004 From: bartek.b at eranet.pl (Bartek Bargiel) Date: Sat Jul 31 22:27:44 2004 Subject: [python-win32] problem with detecting when another app finished Message-ID: <26281084.20040731200022@eranet.pl> Hi! I've got a problem with detection of the moment when the chosen application was closed. There are some apps whose .exe files are only 'constructors' for the main app (such as Microsoft Word). Is there a way to 'catch'&spy them? My solutions which failed: 1. Starting the app with help of win32process - it doesn't work - reasons mentioned in first paragraph above 2. Acquiring a lock on the file being edited in a loop; if it's possible, it means the app has already finished. Well, it works often but not ALWAYS. It may happen (moreover: it DOES HAPPEN) that my application acquires a lock before MS Word which is then unable to open the file. 3. Taking a look at app's windows' titles. I thought that was good. But from to time my app crashed and I couldn't find out why. :-( Any suggestions, any ideas? -- Bartek Bargiel