From kimwaic888-pythonwin32 at yahoo.com Mon Aug 1 19:42:22 2005 From: kimwaic888-pythonwin32 at yahoo.com (kimwaic888-pythonwin32@yahoo.com) Date: Mon, 1 Aug 2005 10:42:22 -0700 (PDT) Subject: [python-win32] Invoking InchesToPoints Message-ID: <20050801174222.24431.qmail@web51402.mail.yahoo.com> Hello list, Does anybody know how I can invoke the Word InchesToPoints function from Python using PythonWin32? Thanks, -- John Henry From justinjohnson at gmail.com Mon Aug 1 21:35:25 2005 From: justinjohnson at gmail.com (Justin Johnson) Date: Mon, 1 Aug 2005 14:35:25 -0500 Subject: [python-win32] Getting new thread's ID (not handle) Message-ID: <94a776e7050801123541977ac8@mail.gmail.com> MSDN says PostThreadMessage takes the thread ID as a parameter. From reading the doc I see that handle and ID are different and that both should be returned when creating a new thread with CreateThread. I am creating a new thread with the threading module and do not see a way to get the ID back. I searched the source to see if CreateThread is being called and didn't find anything. Does anyone know how to get a thread's ID if the thread was created with threading.Thread? Thanks. Justin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050801/e9ecf070/attachment.htm From justinjohnson at gmail.com Mon Aug 1 22:28:09 2005 From: justinjohnson at gmail.com (Justin Johnson) Date: Mon, 1 Aug 2005 15:28:09 -0500 Subject: [python-win32] Getting new thread's ID (not handle) In-Reply-To: <94a776e7050801123541977ac8@mail.gmail.com> References: <94a776e7050801123541977ac8@mail.gmail.com> Message-ID: <94a776e7050801132875cb94e7@mail.gmail.com> It looks like GetThreadId is what I need, but I can't find that in any of the win32* modules. I do see CreateThread in CVS in Pythonwin/win32thread.cpp, but I don't have a win32thread in my installation. On 8/1/05, Justin Johnson wrote: > > MSDN says PostThreadMessage takes the thread ID as a parameter. From > reading the doc I see that handle and ID are different and that both should > be returned when creating a new thread with CreateThread. I am creating a > new thread with the threading module and do not see a way to get the ID > back. I searched the source to see if CreateThread is being called and > didn't find anything. Does anyone know how to get a thread's ID if the > thread was created with threading.Thread? > Thanks. > Justin > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050801/d48b3518/attachment.htm From Jim.Vickroy at noaa.gov Mon Aug 1 22:37:31 2005 From: Jim.Vickroy at noaa.gov (Jim.Vickroy@noaa.gov) Date: Mon, 01 Aug 2005 14:37:31 -0600 Subject: [python-win32] Getting new thread's ID (not handle) Message-ID: <7b4637f0.37f07b46@noaa.gov> It is in the win32api module. -- jv -------------- next part -------------- It looks like GetThreadId is what I need, but I can't find that in any of the win32* modules. I do see CreateThread in CVS in Pythonwin/win32thread.cpp, but I don't have a win32thread in my installation. On 8/1/05, Justin Johnson wrote: > > MSDN says PostThreadMessage takes the thread ID as a parameter. From > reading the doc I see that handle and ID are different and that both should > be returned when creating a new thread with CreateThread. I am creating a > new thread with the threading module and do not see a way to get the ID > back. I searched the source to see if CreateThread is being called and > didn't find anything. Does anyone know how to get a thread's ID if the > thread was created with threading.Thread? > Thanks. > Justin > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050801/cc678290/attachment.htm -------------- next part -------------- _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From justinjohnson at gmail.com Mon Aug 1 23:00:13 2005 From: justinjohnson at gmail.com (Justin Johnson) Date: Mon, 1 Aug 2005 16:00:13 -0500 Subject: [python-win32] Getting new thread's ID (not handle) In-Reply-To: <7b4637f0.37f07b46@noaa.gov> References: <7b4637f0.37f07b46@noaa.gov> Message-ID: <94a776e705080114001906ef19@mail.gmail.com> I see GetCurrentThreadId there, but not GetThreadId. On 8/1/05, Jim.Vickroy at noaa.gov wrote: > > It is in the win32api module. > > -- jv > > > It looks like GetThreadId is what I need, but I can't find that in any of > the win32* modules. I do see CreateThread in CVS in > Pythonwin/win32thread.cpp, but I don't have a win32thread in my > installation. > > On 8/1/05, Justin Johnson wrote: > > > > MSDN says PostThreadMessage takes the thread ID as a parameter. >From > > reading the doc I see that handle and ID are different and that both should > > be returned when creating a new thread with CreateThread. I am creating a > > new thread with the threading module and do not see a way to get the ID > > back. I searched the source to see if CreateThread is being called and > > didn't find anything. Does anyone know how to get a thread's ID if the > > thread was created with threading.Thread? > > Thanks. > > Justin > > > > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050801/21e6b330/attachment.htm From mhammond at skippinet.com.au Tue Aug 2 00:28:13 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 2 Aug 2005 08:28:13 +1000 Subject: [python-win32] Getting new thread's ID (not handle) In-Reply-To: <94a776e7050801123541977ac8@mail.gmail.com> Message-ID: GetThreadID is a member of an MFC CThread class, probably not what you want. The thread itself can call GetCurrentlThreadId - so the simplest way is probably for your new thread to call this function and store the result in a global. Your main thread can then use this global. The only other way I know to get this thread ID is to create the thread using win32process.CreateThread - that will return the thread ID and handle of the new thread. Mark -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Justin Johnson Sent: Tuesday, 2 August 2005 5:35 AM To: python-win32 at python.org Subject: [python-win32] Getting new thread's ID (not handle) MSDN says PostThreadMessage takes the thread ID as a parameter. >From reading the doc I see that handle and ID are different and that both should be returned when creating a new thread with CreateThread. I am creating a new thread with the threading module and do not see a way to get the ID back. I searched the source to see if CreateThread is being called and didn't find anything. Does anyone know how to get a thread's ID if the thread was created with threading.Thread? Thanks. Justin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050802/c61130b2/attachment.htm From smilner at trinityz.com Tue Aug 2 15:20:57 2005 From: smilner at trinityz.com (Steve Milner) Date: Tue, 02 Aug 2005 09:20:57 -0400 Subject: [python-win32] Outlook Task/Appt Deleting Message-ID: <42EF7339.2070001@trinityz.com> Good Day List, I'm trying to figure out how to delete tasks/appointments in the Outlook via win32com.client in python. I've been able to write code to create new tasks and appointments but can not find documentation (from MS or via Google searches) on how to use the object to search and delete for a specific task/appointment. Any and all help is much appreciated! Thanks alot! Steve Milner From eric.boucher at messier-dowty.com Tue Aug 2 16:42:08 2005 From: eric.boucher at messier-dowty.com (Boucher, Eric) Date: Tue, 2 Aug 2005 10:42:08 -0400 Subject: [python-win32] Running remote command (like psexec.exe) Message-ID: <8CD1D9DB65FBF540B06E79015F0DA1118ABBF4@MON-EXCH55-01.Montreal.mdi.messier-dowty.snecma> Hi, I wanted to know if it's possible to execute remote command from one computer to another, a little bit like the utility "psexec.exe" from sysinternals (www.systinternals.com), with python code (without calling os.system("psexec ...")). I want to execute a DOS command on a group of computer. I wander if it's possible with python. Maybe should I use Corba (which is more complicated to me) or some COM that I will have to put on each computer? Is it possible without installing anything on the remote computer? Thanks Eric Boucher Eric Boucher *: (450) 434-3400 Ext :195 *: (450) 434-5876 *: eric.boucher at messier-dowty.com *:Messier-Dowty Inc, 13000 du Parc, St-Janvier, Mirabel (Qu?bec), Canada J7J 1P3 Veuillez noter le nouveau format des adresses courriel / Please note change of format to email addresses : eric.boucher at messier-dowty.com ((?tait | was) .ORG) Merci de mettre ? jour votre banque de contact. NOTICE - Ce courriel peut contenir des informations privil?gi?es, confidentielles ou de la propri?t? de Messier-Dowty Inc. Uniquement destin?es ? l'usage du destinataire. Si vous n'?tes pas le destinataire de ce courriel, nous vous informons que tout usage, diffusion, distribution ou reproduction de ce courriel est interdit. Si vous avez re?u ce courriel par erreur, nous vous remercions d'en informer Messier-Dowty Inc. imm?diatement et d'en effacer son contenu ainsi que tout document joint de votre syst?me informatique. Les opinions formul?es dans ce courriel sont celles des exp?diteurs et ne refl?tent pas n?cessairement la position de Messier-Dowty Inc. NOTICE - This e-mail message may contain privileged, confidential, or proprietary information intended only for the use of the intended recipient. If you are not the intended recipient of this e-mail, you are hereby notified that any use, dissemination, distribution or reproduction of this e-mail is prohibited. If you have received this e-mail in error, please notify Messier-Dowty Inc. immediately and delete this e-mail and all attachments from your computer system. Any views expressed in this e-mail are those of the individual sender and may not necessarily reflect the From tim.golden at viacom-outdoor.co.uk Tue Aug 2 16:49:28 2005 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Tue, 2 Aug 2005 15:49:28 +0100 Subject: [python-win32] Running remote command (like psexec.exe) Message-ID: <9A28C052FF32734DACB0A288A3533991044D2179@vogbs009.gb.vo.local> [Boucher, Eric] | | Hi, | | I wanted to know if it's possible to execute remote command from one | computer to another, a little bit like the utility "psexec.exe" from | sysinternals (www.systinternals.com), with python code | (without calling | os.system("psexec ...")). I want to execute a DOS command on | a group of | computer. I wander if it's possible with python. Maybe should | I use Corba | (which is more complicated to me) or some COM that I will | have to put on | each computer? Is it possible without installing anything on | the remote | computer? You should be able to do it using WMI: http://timgolden.me.uk/python/wmi_cookbook.html#create_destroy_notepad In theory, there are restrictions on what you can run on a remote computer -- specifically, the notebook example should fail -- and I think that XP / 2k3 have added more restrictive security. But try it for the process you have in mind to see if it works. In the WMI () constructor, pass the name of the remote computer: c = wmi.WMI ("other_computer") This doesn't require anything on the remote PC except WMI, which is standard with Windows from Win2K upwards. If this doesn't work, you have several options involving running some Python process on the other machine: Pyro, XMLRPC, Corba, simple socket servers, and many more. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. 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 justinjohnson at gmail.com Tue Aug 2 16:52:56 2005 From: justinjohnson at gmail.com (Justin Johnson) Date: Tue, 2 Aug 2005 09:52:56 -0500 Subject: [python-win32] Getting new thread's ID (not handle) In-Reply-To: References: <94a776e7050801123541977ac8@mail.gmail.com> Message-ID: <94a776e705080207521324050f@mail.gmail.com> Okay, that'll have to do. Thanks. On 8/1/05, Mark Hammond wrote: > > GetThreadID is a member of an MFC CThread class, probably not what you > want. The thread itself can call GetCurrentlThreadId - so the simplest way > is probably for your new thread to call this function and store the result > in a global. Your main thread can then use this global. > The only other way I know to get this thread ID is to create the thread > using win32process.CreateThread - that will return the thread ID and > handle of the new thread. > Mark > > -----Original Message----- > *From:* python-win32-bounces at python.org [mailto: > python-win32-bounces at python.org]*On Behalf Of *Justin Johnson > *Sent:* Tuesday, 2 August 2005 5:35 AM > *To:* python-win32 at python.org > *Subject:* [python-win32] Getting new thread's ID (not handle) > > MSDN says PostThreadMessage takes the thread ID as a parameter. >From > reading the doc I see that handle and ID are different and that both should > be returned when creating a new thread with CreateThread. I am creating a > new thread with the threading module and do not see a way to get the ID > back. I searched the source to see if CreateThread is being called and > didn't find anything. Does anyone know how to get a thread's ID if the > thread was created with threading.Thread? > Thanks. > Justin > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050802/da6ad170/attachment.htm From timr at probo.com Tue Aug 2 18:45:50 2005 From: timr at probo.com (Tim Roberts) Date: Tue, 02 Aug 2005 09:45:50 -0700 Subject: [python-win32] Invoking InchesToPoints In-Reply-To: References: Message-ID: <42EFA33E.4050403@probo.com> On Mon, 1 Aug 2005 10:42:22 -0700 (PDT), wrote: >Hello list, > >Does anybody know how I can invoke the Word >InchesToPoints function from Python using PythonWin32? > > Why would you want to? This does exactly the same thing in WAY fewer cycles: def InchesToPoints( inches ): return inches * 72.0 -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kimwaic888-pythonwin32 at yahoo.com Tue Aug 2 20:43:08 2005 From: kimwaic888-pythonwin32 at yahoo.com (kimwaic888-pythonwin32@yahoo.com) Date: Tue, 2 Aug 2005 11:43:08 -0700 (PDT) Subject: [python-win32] Invoking InchesToPoints Message-ID: <20050802184309.24674.qmail@web51401.mail.yahoo.com> Hi, Tim, Thank you for responding. I don't know why that's needed neither but that's what Record Macro showed in Word. Is it possible that it's not 72 all the time, depending on the screen resolution and so forth? Regards, Tim Roberts wrote: > On Mon, 1 Aug 2005 10:42:22 -0700 (PDT), > wrote: > > >>Hello list, >> >>Does anybody know how I can invoke the Word >>InchesToPoints function from Python using PythonWin32? >> >> > > > Why would you want to? This does exactly the same thing in WAY fewer > cycles: > > def InchesToPoints( inches ): > return inches * 72.0 > -- John Henry From dcbill at volny.cz Wed Aug 3 03:59:40 2005 From: dcbill at volny.cz (Bill Eldridge) Date: Wed, 03 Aug 2005 03:59:40 +0200 Subject: [python-win32] making Windows Media Player visible & catching events Message-ID: <42F0250C.9080805@volny.cz> I'm trying to make Windows Media Player visible and control it from Python - especially to restart it when there's an error event. It seems when I call it below, I get only the console version, and there's no Visible method like with Internet Explorer. I do catch events, but I need it visible. Should it be put into a panel instead? Should a different type dispatch be called or a different method? it seems that there are a console and a windows classes in the COM browser, but I can't seem to access any useful windows classes, and the methods available related to Visible are gets, not puts/sets. I get "fullScreen" as False, but can't set it. openPlayer(address) will launch a visible window, but with no control of the the window/events after that. Any ideas? Thanks, Bill from win32com.client import Dispatch,DispatchWithEvents class WMPEvents: def OnVisible(self,evt): print "OnVisible changed:",evt def OnError(self,evt=None): print "OnError",evt def OnMediaError(self,evt=None): print "OnMediaError",evt def OnDisconnect(self,evt): print "OnDisconnect",evt def OnStatusChange(self): print "OnStatusChange" def OnDisconnect(self,evt): print "Disconnect",evt def OnBuffering(self,evt): print "OnBuffering changed:",evt def OnOpenStateChange(self,evt=None): print "OnOpenStateChange" ,evt mp = DispatchWithEvents("WMPlayer.OCX.7",WMPEvents) mp.Visible = True # Does nothing tune = mp.newMedia("C:/WINDOWS/system32/oobe/images/title.wma") mp.currentPlaylist.appendItem(tune) mp.controls.playItem(tune) mp.controls.play() raw_input("Press enter to stop playing") mp.controls.stop() From eric.boucher at messier-dowty.com Wed Aug 3 15:03:53 2005 From: eric.boucher at messier-dowty.com (Boucher, Eric) Date: Wed, 3 Aug 2005 09:03:53 -0400 Subject: [python-win32] SUSPECT: RE: Running remote command (like psex ec.exe) Message-ID: <8CD1D9DB65FBF540B06E79015F0DA1118ABCF1@MON-EXCH55-01.Montreal.mdi.messier-dowty.snecma> You are right. I completely forgot to select "reply to all". So here it is to everyone. Thanks again, Eric Boucher *: (450) 434-3400 Ext :195 *: (450) 434-5876 *: eric.boucher at messier-dowty.com *:Messier-Dowty Inc, 13000 du Parc, St-Janvier, Mirabel (Qu?bec), Canada J7J 1P3 Veuillez noter le nouveau format des adresses courriel / Please note change of format to email addresses : eric.boucher at messier-dowty.com ((?tait | was) .ORG) Merci de mettre ? jour votre banque de contact. NOTICE - Ce courriel peut contenir des informations privil?gi?es, confidentielles ou de la propri?t? de Messier-Dowty Inc. Uniquement destin?es ? l'usage du destinataire. Si vous n'?tes pas le destinataire de ce courriel, nous vous informons que tout usage, diffusion, distribution ou reproduction de ce courriel est interdit. Si vous avez re?u ce courriel par erreur, nous vous remercions d'en informer Messier-Dowty Inc. imm?diatement et d'en effacer son contenu ainsi que tout document joint de votre syst?me informatique. Les opinions formul?es dans ce courriel sont celles des exp?diteurs et ne refl?tent pas n?cessairement la position de Messier-Dowty Inc. NOTICE - This e-mail message may contain privileged, confidential, or proprietary information intended only for the use of the intended recipient. If you are not the intended recipient of this e-mail, you are hereby notified that any use, dissemination, distribution or reproduction of this e-mail is prohibited. If you have received this e-mail in error, please notify Messier-Dowty Inc. immediately and delete this e-mail and all attachments from your computer system. Any views expressed in this e-mail are those of the individual sender and may not necessarily reflect the -----Message d'origine----- De : Tim Golden [mailto:tim.golden at viacom-outdoor.co.uk] Envoy? : 3 ao?t, 2005 04:01 ? : Boucher, Eric Objet : RE: SUSPECT: RE: [python-win32] Running remote command (like psexec.exe) Thanks very much for the information, Eric. I'll try to remember to put an update on my site warning people that this might be a problem. You might want to copy your email to this list (I think it came only to me) so that other people can see. TJG | -----Original Message----- | From: Boucher, Eric [mailto:eric.boucher at messier-dowty.com] | Sent: 02 August 2005 20:42 | To: Tim Golden | Subject: SUSPECT: RE: [python-win32] Running remote command (like | psexec.exe) | | | Thanks Tim, | | Your wrapper was exactly what I needed. Superb! But I had a | lot of trouble | make it working with python 2.4 under Windows XP SP2. The | problem was with | the build 203 of the win32 extensions. It doesn't work well | for me. For | those around with the same problem (which means you have trouble while | importing the wmi module), simply download the new version of | the windows | extensions (build 204) and delete everything in your python | gen_py folder | "C:\Python2x\Lib\site-packages\win32com\gen_py". After that, | the wmi module | works well with python 2.4 under Windows XP. Hope this will | help some of | you. ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. 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 fz.3 at arcor.de Wed Aug 3 17:06:50 2005 From: fz.3 at arcor.de (fz.3@arcor.de) Date: Wed, 3 Aug 2005 17:06:50 +0200 (CEST) Subject: [python-win32] Wrapping a wxPython window/application in an ActiveX control Message-ID: <3018267.1123081610937.JavaMail.ngmail@webmail-02.arcor-online.net> I have just posted following message to the wxPython-users list, but perhaps this list would be quicker with the answer :): Hi everyone, I found a lot of info on how to embed an ActiveX control in a wxPython app, but nothing about going the opposite way. The problem: We use toolkits (Agilent VEE and LabView, should you be interested) that can construct (relatively simple) GUIs. Both tools allow placing ActiveX controls on such GUIs. We have successed in embedding Python (as a DLL) in apps created using these toolkits and also in getting wxPython to run in this embedded environment. Any frames created in wxPython are completely seperate from the toolkit-gui, though. The question that comes to mind, therefore, is whether there is any way to wrap the wxPython Frame as an ActiveX control (possibly using pywin32), such that it can be placed on the GUI. Note that we do NOT need such ActiveX-wrapped wxPython frame to interact with the VEE/LabView application (it's application is written in Python, of course) - we simply want to be able to place the frame inside a 'foreign' GUI's frame. Any help would be much appreciated. Fritz Bosch Machen Sie aus 14 Cent spielend bis zu 100 Euro! Die neue Gaming-Area von Arcor - ?ber 50 Onlinespiele im Angebot. http://www.arcor.de/rd/emf-gaming-1 From niki at vintech.bg Wed Aug 3 17:16:08 2005 From: niki at vintech.bg (Niki Spahiev) Date: Wed, 03 Aug 2005 18:16:08 +0300 Subject: [python-win32] Wrapping a wxPython window/application in an ActiveX control In-Reply-To: <3018267.1123081610937.JavaMail.ngmail@webmail-02.arcor-online.net> References: <3018267.1123081610937.JavaMail.ngmail@webmail-02.arcor-online.net> Message-ID: <42F0DFB8.8060804@vintech.bg> > Any help would be much appreciated. IIRC there is ctypes based AcitveX demo. Maybe in venster. No wxPython though. HTH Niki Spahiev From timr at probo.com Wed Aug 3 18:59:32 2005 From: timr at probo.com (Tim Roberts) Date: Wed, 03 Aug 2005 09:59:32 -0700 Subject: [python-win32] Invoking InchesToPoints In-Reply-To: References: Message-ID: <42F0F7F4.3040500@probo.com> On Tue, 2 Aug 2005 11:43:08 -0700 (PDT), wrote: >Thank you for responding. > >I don't know why that's needed neither but that's what >Record Macro showed in Word. > > Sure, it makes (some) sense in Word, but if you're porting it to Python, forget about it. >Is it possible that it's not 72 all the time, >depending on the screen resolution and so forth? > > No. Pixels-per-inch can vary based on small vs large fonts, but points-per-inch is always 72, and twips-per-inch is always 1440. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kimwaic888-pythonwin32 at yahoo.com Wed Aug 3 20:44:41 2005 From: kimwaic888-pythonwin32 at yahoo.com (kimwaic888-pythonwin32@yahoo.com) Date: Wed, 3 Aug 2005 11:44:41 -0700 (PDT) Subject: [python-win32] Invoking InchesToPoints Message-ID: <20050803184442.95531.qmail@web51401.mail.yahoo.com> Thank you, Tim. Tim Roberts wrote: > On Tue, 2 Aug 2005 11:43:08 -0700 (PDT), > wrote: > > >>Thank you for responding. >> >>I don't know why that's needed neither but that's what >>Record Macro showed in Word. >> >> > > > Sure, it makes (some) sense in Word, but if you're porting it to Python, > forget about it. > > >>Is it possible that it's not 72 all the time, >>depending on the screen resolution and so forth? >> >> > > > > No. Pixels-per-inch can vary based on small vs large fonts, but > points-per-inch is always 72, and twips-per-inch is always 1440. > -- John Henry From sdementen at hotmail.com Thu Aug 4 12:46:33 2005 From: sdementen at hotmail.com (Sébastien de Menten) Date: Thu, 04 Aug 2005 10:46:33 +0000 Subject: [python-win32] returning COM objects from a COM server Message-ID: Hi, I have several classes that I would like to map to COM objects to make them accessible from Excel via COM. I have looked at the COM server interp.py supplied as example in the win32all package and I can access it easily from Excel. Now, if I add a new class Foo class Foo: def test(self): return 4 and a new funcion in this Interpreter class like def return_foo(self): return Foo() when I call from Excel the function return_foo() on the object Python.Interpreter, I get in the "Python trace collector" an exception: in _Invoke_ with 1002 1033 3 (4,) pythoncom error: Python error invoking COM method. exceptions.TypeError: Objects for SAFEARRAYS must be sequences (of sequences), or a buffer object. Evidently, Foo is not a COM Object. So how do I make it a COM Object ? I can register a new COM server "Python.Foo" and use def return_foo(self): return win32com.client.Dispatch("Python.Foo") but then: a) anybody could create it while I only want Python.Interpreter to do that b) it is not very elegant :-) So, is it possible to create new COM objects that map Python classes automatically ? Do they need to register ? Any example to advise ? BTW, why is not there a COMServer class in win32all that could enjoy metaclass facilities and inheritance to ease the work (I agree it is already quite easy but ...) ? Is it for historical reasons or is there a deep explanation ? tx Seb ps: could you reply to my address as I am not subscribed to the mailing list ? From mhammond at skippinet.com.au Thu Aug 4 13:03:40 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 4 Aug 2005 21:03:40 +1000 Subject: [python-win32] returning COM objects from a COM server In-Reply-To: Message-ID: > I have several classes that I would like to map to COM objects to > make them > accessible from Excel via COM. You need to use the win32com.server.util.wrap function. Note that the object must be an instance of a class that conforms to the usual win32com server rules - eg, _public_methods_ etc. No _reg_ attributes are necessary in this case. Do a quick grep for wrap in the win32com test dir. > when I call from Excel the function return_foo() on the object > Python.Interpreter, I get in the "Python trace collector" an exception: > > in _Invoke_ with 1002 1033 3 (4,) > pythoncom error: Python error invoking COM method. > exceptions.TypeError: Objects for SAFEARRAYS must be sequences (of > sequences), or a buffer object. That particular error is surprising. > So, is it possible to create new COM objects that map Python classes > automatically ? Do they need to register ? They do not need to register if they are only ever returned via wrap() > BTW, why is not there a COMServer class in win32all that could enjoy > metaclass facilities and inheritance to ease the work (I agree it > is already > quite easy but ...) ? Is it for historical reasons or is there a deep > explanation ? Purely historical reasons. Over the last few years Python has grown a number of new facilities win32com could take advantage of. As usual, contributions welcome ;) Mark From sdementen at hotmail.com Thu Aug 4 13:25:15 2005 From: sdementen at hotmail.com (Sébastien de Menten) Date: Thu, 04 Aug 2005 11:25:15 +0000 Subject: [python-win32] returning COM objects from a COM server In-Reply-To: Message-ID: AMAZING !! It is depressing to see how easy it is :-) Is there a Wiki for win32all or a living website (news, roadmap, TODO, ideas) ? best, Sebastien From mhammond at skippinet.com.au Thu Aug 4 14:50:20 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 4 Aug 2005 22:50:20 +1000 Subject: [python-win32] returning COM objects from a COM server In-Reply-To: Message-ID: > AMAZING !! > > It is depressing to see how easy it is :-) It depends on how you look at it - I consider the need to manually wrap objects a significant wart :) > Is there a Wiki for win32all or a living website (news, roadmap, TODO, > ideas) ? Nope - sourceforge has a few of those facilities, but they remain unused. The problem is how to keep them alive. As usual, contributions welcome ;) Mark From oleg_python at yahoo.de Thu Aug 4 17:41:45 2005 From: oleg_python at yahoo.de (Oleg Novychny) Date: Thu, 4 Aug 2005 17:41:45 +0200 (CEST) Subject: [python-win32] Ant: RE: Problems with Implementing Callback Python/C++-DLL In-Reply-To: Message-ID: <20050804154145.78935.qmail@web25703.mail.ukl.yahoo.com> --- Mark Hammond schrieb: > > So I?m not sure how can I ?register? > my_set_callback function in the > already > > started Python-Interpreter and to ?explain? my DLL > which Python-Function > is > > to call when the new values in my DLL were > calculated. > > I'm not sure I understand your problem. The tail of > the code you posted > looks like a standard Python module - although you > did not show the "module > init" code. Assuming this was a normal module, > Python code would be able to > say: > > import foo > foo.callback(some_func) > > Which is how my_set_callback will be called. > However, if you have no module > init code, there will be no entry point to the > function. How is your DLL > loaded by Python (or is it your DLL that loads > Python?). > > Mark It is Python that loads my DLL. For that purpose I implemented this SoundProcLib-Class in Python: from ctypes import* import sys class SoundProcLib(object): def __init__(self, library): self.library = library @cdecl(c_int, library, [c_int, c_int, c_int, c_int, c_int, c_ulong]) def StartProcessing(f1, f2, f3, f4, f5, ul1): if 0 == StartProcessing._api_(f1, f2, f3, f4, f5, ul1): raise WinError() return None self.StartProcessing = StartProcessing @cdecl(c_int, library, [POINTER(c_ulong), POINTER(c_double), POINTER(c_int), POINTER(c_int), POINTER(c_double), POINTER(c_int)]) def GetResults(): ulHz,dNoise,bAudio,bCrackFlag,dSNR,bBeep = c_ulong(), c_double(), c_int(), c_int(), c_double(), c_int() if 0 == GetResults._api_(byref(ulHz),byref(dNoise),byref(bAudio),byref(bCrackFlag),byref(dSNR),byref(bBeep)): raise WinError() return ulHz.value,dNoise.value,bAudio.value,bCrackFlag.value,dSNR.value,bBeep.value self.GetResults = GetResults @cdecl(c_int, library, [c_void_p]) def EndProcessing(): if 0 == EndProcessing._api_(None): raise WinError() return None self.EndProcessing = EndProcessing So my steps are: 1. I'm calling my DLL with StartProcessing() - function from this class. 2. I read the values out of my DLL with GetResults() It works without problems. The only thing is: I'm just not sure what is the right way to implement my wish: Calling my Python function GetResults() from inside of my DLL, when a certain event in my DLL is happend. Thanks a lot Oleg ___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de From mattb at columbia.edu Fri Aug 5 23:41:20 2005 From: mattb at columbia.edu (Matthew Bogosian) Date: Fri, 5 Aug 2005 14:41:20 -0700 Subject: [python-win32] Ugh...native Windows interactive Python 2.4 in Cygwin terminal Message-ID: <177c2ff380060a1b9c60bae6533140bc@columbia.edu> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I apologize sincerely and in advance if this problem has already been discussed. I have been unable to find any reference to anything similar in either the Python or Cygwin mailing lists, FAQs, etc. I am attempting to run the native Windows 2.4 binary distribution (i.e., c:\Python24\python.exe) interactively in a Cygwin terminal, and I am having a very difficult time of it. It seems that the terminal-based IO for the native Windows binary doesn't play well with the Cygwin shell/terminal (I'm guessing). If I open a DOS prompt, and invoke interactive python (by typing "c:\python24\python") everything works as advertised (i.e., the version and prompt are printed, and I can type commands and get responses). However, when I open a Cygwin shell and try the same (by typing "/cygdrive/c/python24/python"), python appears to just hang there. I can hit CTRL-C to kill it, but otherwise it is unresponsive. What is weird is that if I pipe it data (in non-interactive mode) it does just fine. For example, if, in Cygwin, I can do the following: > $ echo $SHELL > /bin/bash > > $ echo $CYGWIN > ntsec > > $ echo $TERM > xterm > > $ echo 'print 5 + 5' | /cygdrive/c/python24/python > 10 > > $ echo $? > 0 > > $ python > print 5 + 5 > hello? > anyone there? > ^C > > $ echo $? > 130 > > $ Unfortunately, I am *not* able to use the Cygwin version of Python for the project on which I am working. I *must* use the native Windows version. However, the inability to invoke it interactively in Cygwin has got me tied in knots. Any advice or help would be greatly appreciated. Once again, I apologize if this is already a well-known issue. -- Matt -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Darwin) iD8DBQFC890AnLpDzL5I7l8RAjBJAJsFU92LDnAGUlRNp0TAA3LoAN7uVQCeKgot N+i94Mlxrwq2ZF87N4agrmg= =Lnnj -----END PGP SIGNATURE----- From pjessop at gmail.com Sun Aug 7 18:16:01 2005 From: pjessop at gmail.com (Peter Jessop) Date: Sun, 7 Aug 2005 18:16:01 +0200 Subject: [python-win32] Ugh...native Windows interactive Python 2.4 in Cygwin termin In-Reply-To: References: <177c2ff380060a1b9c60bae6533140bc@columbia.edu> Message-ID: ---------- Forwarded message ---------- From: Peter Jessop Date: Aug 7, 2005 6:12 PM Subject: Re: [python-win32] Ugh...native Windows interactive Python 2.4 in Cygwin terminal To: Matthew Bogosian I have Cygwin installed here although I confess that I don't use it much and can probably be of little help and apologise if this is the case. However I tried the following bash-2.05b$ d:/Python24/python.exe Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win3 Type "help", "copyright", "credits" or "license" for more information. >>> print "Works here2 File "", line 1 print "Works here2 ^ SyntaxError: EOL while scanning single-quoted string >>> print "Works here" Works here >>> I don't know if this is of any help to you but it may just be a problem of your installation. Regards Peter Jessop -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050807/e15b96c5/attachment.htm From mhammond at skippinet.com.au Mon Aug 8 00:27:47 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 8 Aug 2005 08:27:47 +1000 Subject: [python-win32] Ugh...native Windows interactive Python 2.4 inCygwin terminal In-Reply-To: <177c2ff380060a1b9c60bae6533140bc@columbia.edu> Message-ID: > I apologize sincerely and in advance if this problem has already been > discussed. I have been unable to find any reference to anything similar > in either the Python or Cygwin mailing lists, FAQs, etc. Both cygwin and native Python also work fine for me under the default cygwin shell. If it is something strange about your specific shell, you could try executing "%comspec% -c python.exe" (where %comspec% is likely to be cmd.exe) Mark From rutt at bmi.osu.edu Sun Aug 7 21:12:53 2005 From: rutt at bmi.osu.edu (Benjamin Rutt) Date: Sun, 07 Aug 2005 15:12:53 -0400 Subject: [python-win32] build list of all tasks like Alt-TAB box Message-ID: <5vwtmxef2i.fsf@akron.bmi.ohio-state.edu> I am trying to write a replacement for Alt-TAB in Windows XP using python Win32 extensions. I am first just trying to build a list of all tasks that are in the taskbar; on Windows, these seem to be the same tasks that are listed in the Alt-TAB box. I pieced together the following code from various places: ----------------------------------------------------------------------------- from win32gui import * def windowEnumerationHandler(hwnd, resultList): '''Pass to win32gui.EnumWindows() to generate list of window handle, window text tuples.''' if IsWindowVisible(hwnd): txt = GetWindowText(hwnd) if (len(txt) > 0): resultList.append((hwnd, GetWindowText(hwnd))) windows = [] EnumChildWindows(GetDesktopWindow(), windowEnumerationHandler, windows) for w in windows: print "%10s %s" % (w[0], w[1]) ----------------------------------------------------------------------------- However, when it runs, it gives me more than the active applications: C:\home\rutt\dev\win32tasks>python tasks.py 65624 start 65628 2:45 PM 65632 Notification Area 65648 Running Applications 65652 Running Applications 1245338 C:\WINDOWS\system32\cmd.exe - python tasks.py 1508856 Emacs (Fundamental) tasks.py 1115660 TaskSwitchXP 1639818 FolderView 525314 Emacs (Group) *Group* 17761604 My eBay Selling: Items I'm Selling - Mozilla Firefox 1770594 XTerm akron:~/archive/papers 2884722 XTerm tg-login4:~ 4850694 PostMsg 2688224 FolderView 1114280 XTerm ruttlap:~/dev/win32tasks 656324 CodeGuru: PostMsg - Post a message to any window on the desktop - Mic rosoft Internet Explorer 2753618 Google 3408896 ActivePython 2.4 - Online Docs : Constants - Microsoft Internet Explo rer 1050106 Google 918526 Small Values of Cool: Driving win32 GUIs with Python, part 1 - Micros oft Internet Explorer 984590 Google 2164086 WINDOWINFO - Microsoft Internet Explorer 657032 Google 65660 Program Manager 65664 FolderView There are a few problems with the above output: 1) The first few Windows do not look like they correspond to any task bar entries at all. 2) "FolderView" is displayed for Windows Explorer open folders; I would really like to have the name as it exists in the title bar instead Does anyone know the appropriate functions to call to narrow down these window handles to just those that are present in the taskbar? Thanks, -- Benjamin Rutt From mhammond at skippinet.com.au Mon Aug 8 02:03:57 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 8 Aug 2005 10:03:57 +1000 Subject: [python-win32] build list of all tasks like Alt-TAB box In-Reply-To: <5vwtmxef2i.fsf@akron.bmi.ohio-state.edu> Message-ID: > Does anyone know the appropriate functions to call to narrow down > these window handles to just those that are present in the taskbar? Checking the window is a "top-level" window gives a better result for me. ie: if IsWindowVisible(hwnd) and not GetWindowLong(hwnd, win32con.GWL_STYLE) & win32con.WS_CHILD: Mark From bwinton at latte.ca Mon Aug 8 13:30:14 2005 From: bwinton at latte.ca (Blake Winton) Date: Mon, 08 Aug 2005 11:30:14 -0000 Subject: [python-win32] Python/Palm Parameter passing problems... Message-ID: <41013273.8020609@latte.ca> A non-text attachment was scrubbed... Name: not available Type: application/ms-tnef Size: 427 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20050808/80a9122e/attachment.bin From rutt at bmi.osu.edu Mon Aug 8 15:31:42 2005 From: rutt at bmi.osu.edu (Benjamin Rutt) Date: Mon, 08 Aug 2005 09:31:42 -0400 Subject: [python-win32] build list of all tasks like Alt-TAB box References: <5vwtmxef2i.fsf@akron.bmi.ohio-state.edu> Message-ID: <5vvf2glflt.fsf@akron.bmi.ohio-state.edu> "Mark Hammond" writes: >> Does anyone know the appropriate functions to call to narrow down >> these window handles to just those that are present in the taskbar? > > Checking the window is a "top-level" window gives a better result for me. > ie: > > if IsWindowVisible(hwnd) and not GetWindowLong(hwnd, win32con.GWL_STYLE) > & win32con.WS_CHILD: Thanks for the suggestion. I do have some problem executing this kind of code however. The callback seems to exit early, around the call to GetWindowLong(). The following code and output support this analysis: ----------------------------------------------------------------------------- import win32con from win32gui import * gwl_style = win32con.GWL_STYLE print 'GWL_STYLE', gwl_style def windowEnumerationHandler(hwnd, resultList): '''Pass to win32gui.EnumWindows() to generate list of window handle, window text tuples.''' if IsWindowVisible(hwnd): print 'hi1' val = GetWindowLong(hwnd, gwl_style) print 'hi2' txt = GetWindowText(hwnd) resultList.append((hwnd, txt)) print 'hi3' windows = [] EnumChildWindows(GetDesktopWindow(), windowEnumerationHandler, windows) for w in windows: print "%10s %s" % (w[0], w[1]) ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- C:\home\rutt\dev\win32tasks>python tasks.py GWL_STYLE -16 hi1 hi1 hi1 hi1 hi1 [...] hi1 hi1 C:\home\rutt\dev\win32tasks> ----------------------------------------------------------------------------- Any ideas what I might be doing wrong? FYI, I am using a older version of Python (2.0) and win32all (I downloaded one that went with the 2.0 release...Add/Remove programs shows "Python 2.0 combined Win32 extensions"). Also using Windows XP SP2. Thanks, -- Benjamin Rutt From jbrunen at datasolid.de Mon Aug 8 14:23:46 2005 From: jbrunen at datasolid.de (Johannes Brunen) Date: Mon, 8 Aug 2005 14:23:46 +0200 Subject: [python-win32] win32com and VS .Net Message-ID: <23D83A07C60A0E47AD964F74DA96940104BD3E@mail.datasolid.de> Hi, I have the following problem: I would like to control the MS Dev .Net 2003 Studio from a python script, i.e. I would like to open files, add files to projects etc. Has anyone successfully done something like this? Is it possible at all? I tried the makepy.py script on the 'Microsoft Development Environment 7.0 (7.0)' entry (to get a DTE interface), but all what I get is a list of constants. Looking into the OLE/View I did a expect a larger makepy.py generated file output. Any help would be appreciated With best regards Johannes ____________ Virus checked by G DATA AntiVirusKit Version: AVK 15.0.6489 from 08.08.2005 Virus news: www.antiviruslab.com From alex at moreati.org.uk Tue Aug 9 02:10:59 2005 From: alex at moreati.org.uk (Alex Willmer) Date: Tue, 09 Aug 2005 01:10:59 +0100 Subject: [python-win32] win32com and VS .Net In-Reply-To: <23D83A07C60A0E47AD964F74DA96940104BD3E@mail.datasolid.de> References: <23D83A07C60A0E47AD964F74DA96940104BD3E@mail.datasolid.de> Message-ID: <1123546259.7894.1.camel@localhost.localdomain> On Mon, 2005-08-08 at 14:23 +0200, Johannes Brunen wrote: > Hi, > > I have the following problem: > I would like to control the MS Dev .Net 2003 Studio from a python script, i.e. I would like to open files, add files to projects etc. > Has anyone successfully done something like this? Is it possible at all? I tried the makepy.py script on the > 'Microsoft Development Environment 7.0 (7.0)' entry (to get a DTE interface), but all what I get is a list of constants. > Looking into the OLE/View I did a expect a larger makepy.py generated file output. > > Any help would be appreciated It's a few years old, but this might provide some pointers: http://mail.python.org/pipermail/python-list/2001-December/076881.html Regards Alex From jbrunen at datasolid.de Tue Aug 9 09:20:35 2005 From: jbrunen at datasolid.de (Johannes Brunen) Date: Tue, 9 Aug 2005 09:20:35 +0200 Subject: [python-win32] win32com and VS .Net References: <23D83A07C60A0E47AD964F74DA96940104BD3E@mail.datasolid.de> <1123546259.7894.1.camel@localhost.localdomain> Message-ID: Hi Alex, thank you for your link. I will take look at it. However, I have already solved my problem by installing the last pythonCOM package. It was a bare technically problem. Below you can see my solution. With best regards Johannes """Access to the win32com.client.gencache generated type libraries of the MS .NET 2003 studio. Usage: import DevEnv.Support Env = DevEnv.Support.Studio() """ __version__ = '1.0' from win32com.client import gencache from win32com.client import Dispatch from win32com.client import constants class Modules: def __init__(self): self.__VStudio = gencache.EnsureModule('{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}', 0, 7, 0) def VStudio(self): return self.__VStudio class Studio: theModules = Modules() def __init__(self): self.__EnvDTE = Dispatch("VisualStudio.DTE") def DTE(self): return self.__EnvDTE def main(): "Test of the Support module" theStudio = Studio() EnvDTE = theStudio.DTE() print repr(EnvDTE) print EnvDTE.Name theFile = r"langext.dat" theWindow = EnvDTE.OpenFile(constants.vsViewKindTextView, theFile) print repr(theWindow) theWindow.Visible = 1 if __name__ == '__main__': main() "Alex Willmer" schrieb im Newsbeitrag news:1123546259.7894.1.camel at localhost.localdomain... > On Mon, 2005-08-08 at 14:23 +0200, Johannes Brunen wrote: >> Hi, >> >> I have the following problem: >> I would like to control the MS Dev .Net 2003 Studio from a python script, >> i.e. I would like to open files, add files to projects etc. >> Has anyone successfully done something like this? Is it possible at all? >> I tried the makepy.py script on the >> 'Microsoft Development Environment 7.0 (7.0)' entry (to get a DTE >> interface), but all what I get is a list of constants. >> Looking into the OLE/View I did a expect a larger makepy.py generated >> file output. >> >> Any help would be appreciated > > It's a few years old, but this might provide some pointers: > > http://mail.python.org/pipermail/python-list/2001-December/076881.html > > Regards > > Alex From rutt at bmi.osu.edu Tue Aug 9 15:17:24 2005 From: rutt at bmi.osu.edu (Benjamin Rutt) Date: Tue, 09 Aug 2005 09:17:24 -0400 Subject: [python-win32] build list of all tasks like Alt-TAB box References: <5vwtmxef2i.fsf@akron.bmi.ohio-state.edu> <5vvf2glflt.fsf@akron.bmi.ohio-state.edu> Message-ID: <5vmznr9rmj.fsf@akron.bmi.ohio-state.edu> Benjamin Rutt writes: > Any ideas what I might be doing wrong? FYI, I am using a older > version of Python (2.0) and win32all (I downloaded one that went with > the 2.0 release...Add/Remove programs shows "Python 2.0 combined Win32 > extensions"). Also using Windows XP SP2. Thanks, I think I figured it out. It must have been a problem with my using an older version of Python. When I installed version 2.4 of Python and Win32all alongside version 2.0, everything started to work. I continue to piece together the following code which seems to work, although I do not understand all of these flags: ----------------------------------------------------------------------------- from win32gui import * from win32con import * gwl_style = GWL_STYLE def windowEnumerationHandler(hwnd, resultList): '''Pass to win32gui.EnumWindows() to generate list of window handle, window\ text tuples.''' if IsWindowVisible(hwnd): val = GetWindowLong(hwnd, gwl_style) if val & WS_VISIBLE: if not val & WS_CHILD: if not val & WS_EX_TOOLWINDOW: if val & WS_EX_CONTROLPARENT: val = GetWindowLong(hwnd, gwl_style) txt = GetWindowText(hwnd) resultList.append((hwnd, txt)) windows = [] EnumChildWindows(GetDesktopWindow(), windowEnumerationHandler, windows) for w in windows: print "%10s %s" % (w[0], w[1]) ----------------------------------------------------------------------------- Does anyone happen to know why if the window handle is not an WS_EX_TOOLWINDOW and is an WS_EX_CONTROLPARENT, then it is one of the taskbar programs? Thanks, -- Benjamin Rutt From oleg_python at yahoo.de Wed Aug 10 12:55:40 2005 From: oleg_python at yahoo.de (Oleg Novychny) Date: Wed, 10 Aug 2005 12:55:40 +0200 (CEST) Subject: [python-win32] Python interpreter crashes after trying to callback a python function with PyObject_CallObject from a dll Message-ID: <20050810105540.25274.qmail@web25709.mail.ukl.yahoo.com> Hello guys, I?m still implementing my callback to python from my dll and the python interpreter crashes I have no idea atm why I use the calldll module for calling my c++-dll from my module calldllsound.py: import calldll import struct class CallSoundDLL: def __init__(self, library): self.library = library def myGetResults(a): print a #just for debugging calldll.call_foreign_function (self.addrGet,'llllll','i',(self.ulHz.address(), self.dNoise.address(), self.bAudio.address(),self.bCrackFlag.address(), self.dSNR.address(), self.bBeep.address())) def mySetCallback(self): calldll.call_foreign_function (self.addrCall,'O','',(self.myGetResults,)) def start(self): # --------------------------------------------------------------------------------------------- # Get the handle of the dll and the address of the function # --------------------------------------------------------------------------------------------- #Get the handle of the Dll handle = calldll.load_library (self.library) #Get the address of the functions self.addrStart = calldll.get_proc_address (handle, 'StartProcessing') self.addrEnd = calldll.get_proc_address (handle, 'EndProcessing') self.addrGet = calldll.get_proc_address (handle, 'GetResults') self.addrCall = calldll.get_proc_address (handle, 'my_set_callback') # --------------------------------------------------------------------------------------------- # Initialization # --------------------------------------------------------------------------------------------- self.ulHz = calldll.membuf(4) #unsigned long* self.dNoise = calldll.membuf(8) #double* self.bAudio = calldll.membuf(4) #int* self.bCrackFlag = calldll.membuf(4) #int* self.dSNR = calldll.membuf(8) #double* self.bBeep = calldll.membuf(4) #int* # --------------------------------------------------------------------------------------------- # Function calling # --------------------------------------------------------------------------------------------- args = (1,1,1,1,1,1000) calldll.call_foreign_function (self.addrStart,'iiiiik','i',args) So I?m starting my dll on such a way: >>> import calldllsound >>> obj = calldllsound.CallSoundDLL("soundproclib.dll") >>> obj.start() It works without any problems. But after the following command crashes the python interpreter...: >>> obj.mySetCallback() Here is my_set_callback function from my dll, which have to be called in the python function mySetCallback: static PyObject *my_callback = NULL; PyMODINIT_FUNC my_set_callback(PyObject *args) { PyObject *temp = args; Py_XINCREF(temp); /* Add a reference to new callback */ Py_XDECREF(my_callback); /* Dispose of previous callback */ my_callback = temp; /* Remember new callback */ Py_INCREF(Py_None); bPyCallBackFlag = true; }; and here is the part of my code from the same c++-file where I?m trying to call my python-function myGetResults: if (bPyCallBackFlag) { /* Time to call the callback */ ppyobjArgList = Py_BuildValue("(i)",123); //just for debugging // Here crashes the python interpreter, I found it out with // error logging: ppyobjResult = PyObject_CallObject(my_callback, ppyobjArgList); Py_DECREF(ppyobjResult); } Have anybody any idea why it doesn?t work? Thank you very much Oleg --------------------------------- Gesendet von Yahoo! Mail - Jetzt mit 1GB kostenlosem Speicher -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050810/44a65077/attachment-0001.htm From timr at probo.com Wed Aug 10 20:45:50 2005 From: timr at probo.com (Tim Roberts) Date: Wed, 10 Aug 2005 11:45:50 -0700 Subject: [python-win32] build list of all tasks like Alt-TAB box In-Reply-To: References: Message-ID: <42FA4B5E.3060006@probo.com> On Tue, 09 Aug 2005 09:17:24 -0400, Benjamin Rutt wrote: >Benjamin Rutt writes: > > So, you're from that OTHER OSU? (From an Oregon State University alumnus...) >----------------------------------------------------------------------------- >from win32gui import * >from win32con import * > >gwl_style = GWL_STYLE > >def windowEnumerationHandler(hwnd, resultList): > '''Pass to win32gui.EnumWindows() to generate list of window handle, window\ > text tuples.''' > if IsWindowVisible(hwnd): > val = GetWindowLong(hwnd, gwl_style) > if val & WS_VISIBLE: > if not val & WS_CHILD: > if not val & WS_EX_TOOLWINDOW: > if val & WS_EX_CONTROLPARENT: > val = GetWindowLong(hwnd, gwl_style) > txt = GetWindowText(hwnd) > resultList.append((hwnd, txt)) > >windows = [] >EnumChildWindows(GetDesktopWindow(), windowEnumerationHandler, windows) >for w in windows: > print "%10s %s" % (w[0], w[1]) >----------------------------------------------------------------------------- > >Does anyone happen to know why if the window handle is not an >WS_EX_TOOLWINDOW and is an WS_EX_CONTROLPARENT, then it is one of the >taskbar programs? Thanks, > > Google is your friend. WS_EX_TOOLWINDOW is used to create floating toolbars, which can exist outside of the parent app. You don't want those showing up as main windows. WS_EX_CONTROLPARENT essentially says "this window contains other controls". Getting rid of this probably gets rid of text-only windows, like tooltips and balloon help. The "spyxx.exe" tool can be used to poke around the window list to find these things. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From pylist at gnulinux.net Wed Aug 10 14:43:35 2005 From: pylist at gnulinux.net (pylist@gnulinux.net) Date: Wed, 10 Aug 2005 14:43:35 Subject: [python-win32] Python, Com and SafeArrays Message-ID: <20050810214335.18894.qmail@st17.startlogic.com> An embedded and charset-unspecified text was scrubbed... Name: not available Url: http://mail.python.org/pipermail/python-win32/attachments/20050810/71e2025b/attachment.diff From rutt at bmi.osu.edu Wed Aug 10 23:19:54 2005 From: rutt at bmi.osu.edu (Benjamin Rutt) Date: Wed, 10 Aug 2005 17:19:54 -0400 Subject: [python-win32] build list of all tasks like Alt-TAB box References: <42FA4B5E.3060006@probo.com> Message-ID: <5v7jet8p6t.fsf@akron.bmi.ohio-state.edu> Tim Roberts writes: > So, you're from that OTHER OSU? (From an Oregon State University > alumnus...) and, don't forget about that other other OSU, Oklahoma State. :-) > Google is your friend. WS_EX_TOOLWINDOW is used to create floating > toolbars, which can exist outside of the parent app. You don't want > those showing up as main windows. WS_EX_CONTROLPARENT essentially says > "this window contains other controls". Getting rid of this probably > gets rid of text-only windows, like tooltips and balloon help. thanks for the explanation. I of course I did google for these things, but found the explanations puzzling; not coming from a Windows background, I figured there was some hidden knowledge that I could pick up from this group; the WS_EX_TOOLWINDOW one sort of makes sense, but I did not see why being a window that contains other controls should exclude a window from the alt-TAB list; after all, for example, Web browsers contain other controls, such as text boxes, etc. > The "spyxx.exe" tool can be used to poke around the window list to >find these things. looks like that is not a free tool, apparently bundled with Microsoft Visual C++, so I guess I can not try that for now. -- Benjamin Rutt From mhammond at skippinet.com.au Thu Aug 11 00:45:59 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 11 Aug 2005 08:45:59 +1000 Subject: [python-win32] Python interpreter crashes after trying to callbacka python function with PyObject_CallObject from a dll In-Reply-To: <20050810105540.25274.qmail@web25709.mail.ukl.yahoo.com> Message-ID: > static PyObject *my_callback = NULL; > PyMODINIT_FUNC my_set_callback(PyObject *args) > { > PyObject *temp = args; > Py_XINCREF(temp); /* Add a reference to new callback */ > Py_XDECREF(my_callback); /* Dispose of previous callback */ > my_callback = temp; /* Remember new callback */ > Py_INCREF(Py_None); > bPyCallBackFlag = true; > }; That looks suspect: * PyMODINIT_FUNC is probably not what you want - this is not a "module init" function. * The first arg is always "self", with "args" being a second arg. * You Py_INCREF(Py_None), but don't return it. I'm surprised that compiles. Let's say "args" was NULL (as it probably will be - recall it is supposed to be "self", which generally *will* be NULL. It should be obvious how that would crash your code. Also, note that even if you get the correct "args" pointer to that function, it will be a tuple. Hence all code you will find uses PyArg_ParseTuple to get the individual items out. Your callback will be the first item in the tuple. > ppyobjResult = PyObject_CallObject(my_callback, ppyobjArgList); This will fail for that reason - my_callback will *not* be a callable object. I don't think either of the mailing lists you have sent this to are appropriate - the problems are not releated to win32, not are they related to C++. You really just need to look over the documentation on writing extension modules. Mark. From mhammond at skippinet.com.au Thu Aug 11 00:51:01 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 11 Aug 2005 08:51:01 +1000 Subject: [python-win32] Python, Com and SafeArrays In-Reply-To: <20050810214335.18894.qmail@st17.startlogic.com> Message-ID: > I've encountered a problem when trying to use Com in some > instances. There is a > method on a Com object called getData() which takes in 4 > paramaters ... all > pointers ... and fills them with data. I'm currently using > pointer() in ctypes on > the four args as they go in (like getData(pointer(one), > pointer(two)....)) but am > getting the following error: Assuming you are using win32com, you do not need to explicitly pass pointers around. You may need to run "makepy" for the COM object (the simplest way is to use win32com.client.gencache.EnsureDispatch instead of a simple win32com.client.Dispatch). If the params are all out (rather than in-out) you should not need to supply them at all, but the function will return them when you make the call. Mark From davidf at sjsoft.com Thu Aug 11 18:09:13 2005 From: davidf at sjsoft.com (David Fraser) Date: Thu, 11 Aug 2005 18:09:13 +0200 Subject: [python-win32] Ugh...native Windows interactive Python 2.4 in Cygwin terminal In-Reply-To: <177c2ff380060a1b9c60bae6533140bc@columbia.edu> References: <177c2ff380060a1b9c60bae6533140bc@columbia.edu> Message-ID: <42FB7829.5080102@sjsoft.com> Matthew Bogosian wrote: >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > >I apologize sincerely and in advance if this problem has already been >discussed. I have been unable to find any reference to anything similar >in either the Python or Cygwin mailing lists, FAQs, etc. > >I am attempting to run the native Windows 2.4 binary distribution >(i.e., c:\Python24\python.exe) interactively in a Cygwin terminal, and >I am having a very difficult time of it. It seems that the >terminal-based IO for the native Windows binary doesn't play well with >the Cygwin shell/terminal (I'm guessing). > >If I open a DOS prompt, and invoke interactive python (by typing >"c:\python24\python") everything works as advertised (i.e., the version >and prompt are printed, and I can type commands and get responses). >However, when I open a Cygwin shell and try the same (by typing >"/cygdrive/c/python24/python"), python appears to just hang there. I >can hit CTRL-C to kill it, but otherwise it is unresponsive. What is >weird is that if I pipe it data (in non-interactive mode) it does just >fine. For example, if, in Cygwin, I can do the following: > > > >>$ echo $SHELL >>/bin/bash >> >>$ echo $CYGWIN >>ntsec >> >>$ echo $TERM >>xterm >> >>$ echo 'print 5 + 5' | /cygdrive/c/python24/python >>10 >> >>$ echo $? >>0 >> >>$ python >>print 5 + 5 >>hello? >>anyone there? >>^C >> >>$ echo $? >>130 >> >>$ >> >> > >Unfortunately, I am *not* able to use the Cygwin version of Python for >the project on which I am working. I *must* use the native Windows >version. However, the inability to invoke it interactively in Cygwin >has got me tied in knots. > >Any advice or help would be greatly appreciated. Once again, I >apologize if this is already a well-known issue. > > Not sure if you got this sorted out. It works fine for me but things to try include using -i as a commandline switch to Python and setting CYGWIN to tty Cheers David From timr at probo.com Thu Aug 11 19:07:16 2005 From: timr at probo.com (Tim Roberts) Date: Thu, 11 Aug 2005 10:07:16 -0700 Subject: [python-win32] build list of all tasks like Alt-TAB box In-Reply-To: References: Message-ID: <42FB85C4.9010002@probo.com> On Wed, 10 Aug 2005 17:19:54 -0400, Benjamin Rutt wrote: >thanks for the explanation. I of course I did google for these >things, but found the explanations puzzling; not coming from a Windows >background, I figured there was some hidden knowledge that I could >pick up from this group; the WS_EX_TOOLWINDOW one sort of makes sense, >but I did not see why being a window that contains other controls >should exclude a window from the alt-TAB list; after all, for example, >Web browsers contain other controls, such as text boxes, etc. > > Ah, but they AREN'T excluded! The code only INCLUDES windows that have WS_EX_CONTROLPARENT set. >>> The "spyxx.exe" tool can be used to poke around the window list to >>>find these things. >> >> > >looks like that is not a free tool, apparently bundled with Microsoft >Visual C++, so I guess I can not try that for now. > It used to be part of the Platform SDK, which is freely downloadable. I don't know if that is still the case. Borland also has an excellent tool for this kind of spelunking called "winsight.exe"; it is possible you might find an older version living somewhere in the dusty back rooms of the Internet. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From rutt at bmi.osu.edu Thu Aug 11 23:35:40 2005 From: rutt at bmi.osu.edu (Benjamin Rutt) Date: Thu, 11 Aug 2005 17:35:40 -0400 Subject: [python-win32] build list of all tasks like Alt-TAB box References: <42FB85C4.9010002@probo.com> Message-ID: <5vy8786tsj.fsf@akron.bmi.ohio-state.edu> Tim Roberts writes: > Ah, but they AREN'T excluded! The code only INCLUDES windows that have > WS_EX_CONTROLPARENT set. Whoops, you are absolutely right, sorry. I deserve a few lashes of a whip now. :( >>>> The "spyxx.exe" tool can be used to poke around the window list to >>>>find these things. >>> >>> >> >>looks like that is not a free tool, apparently bundled with Microsoft >>Visual C++, so I guess I can not try that for now. >> > > > It used to be part of the Platform SDK, which is freely downloadable. I > don't know if that is still the case. Borland also has an excellent > tool for this kind of spelunking called "winsight.exe"; it is possible > you might find an older version living somewhere in the dusty back rooms > of the Internet. Thanks, I'll try the Platform SDK, I can't find winsight.exe. -- Benjamin Rutt From simon.brunning at gmail.com Fri Aug 12 13:34:25 2005 From: simon.brunning at gmail.com (Simon Brunning) Date: Fri, 12 Aug 2005 12:34:25 +0100 Subject: [python-win32] build list of all tasks like Alt-TAB box In-Reply-To: <42FB85C4.9010002@probo.com> References: <42FB85C4.9010002@probo.com> Message-ID: <8c7f10c60508120434315d1ed1@mail.gmail.com> On 8/11/05, Tim Roberts wrote: > >>> The "spyxx.exe" tool can be used to poke around the window list to > >>>find these things. > > > >looks like that is not a free tool, apparently bundled with Microsoft > >Visual C++, so I guess I can not try that for now. > > It used to be part of the Platform SDK, which is freely downloadable. I > don't know if that is still the case. Borland also has an excellent > tool for this kind of spelunking called "winsight.exe"; it is possible > you might find an older version living somewhere in the dusty back rooms > of the Internet. See also Winspector: http://www.windows-spy.com/. -- Cheers, Simon B, simon at brunningonline.net, http://www.brunningonline.net/simon/blog/ From ryan_p79 at yahoo.com Fri Aug 12 17:20:09 2005 From: ryan_p79 at yahoo.com (ryan pinto) Date: Fri, 12 Aug 2005 08:20:09 -0700 (PDT) Subject: [python-win32] closing processes Message-ID: <20050812152009.91686.qmail@web52008.mail.yahoo.com> hi - need some help, Looking for some way to close processes which are open. Is there any way that a process can be detected if its running and then closed. Ryan __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From Jim.Vickroy at noaa.gov Fri Aug 12 17:37:57 2005 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri, 12 Aug 2005 09:37:57 -0600 Subject: [python-win32] closing processes In-Reply-To: <20050812152009.91686.qmail@web52008.mail.yahoo.com> References: <20050812152009.91686.qmail@web52008.mail.yahoo.com> Message-ID: <42FCC255.4080406@noaa.gov> ryan pinto wrote: >hi - need some help, > >Looking for some way to close processes which are >open. Is there any way that a process can be detected >if its running and then closed. > >Ryan > >__________________________________________________ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com >_______________________________________________ >Python-win32 mailing list >Python-win32 at python.org >http://mail.python.org/mailman/listinfo/python-win32 > > Have you looked at section "6.1.5 Process Management" in the Python Library Reference or, alternately, the win32process module? HTH -- jv From firemoth at gmail.com Tue Aug 16 00:59:53 2005 From: firemoth at gmail.com (Timothy Fitz) Date: Mon, 15 Aug 2005 15:59:53 -0700 Subject: [python-win32] COM Release Message-ID: <972ec5bd0508151559187013b@mail.gmail.com> Is there an explicit way to Release a COM object? The iTunes COM api raises an event right before it closes, and if my application doesn't release the COM object in response, iTunes will hang for 5 seconds, and then prompt the user if they want to force it to close (very ugly!) From mhammond at skippinet.com.au Tue Aug 16 01:35:13 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 16 Aug 2005 09:35:13 +1000 Subject: [python-win32] COM Release In-Reply-To: <972ec5bd0508151559187013b@mail.gmail.com> Message-ID: You need to release all Python references to any COM objects in use. Generally this can simply mean setting the object to None, thereby releasing any reference the object had. pythoncom._GetInterfaceCount() will tell you how many COM references still exist and aid you in tracking them down. Mark > -----Original Message----- > From: python-win32-bounces at python.org > [mailto:python-win32-bounces at python.org]On Behalf Of Timothy Fitz > Sent: Tuesday, 16 August 2005 9:00 AM > To: python-win32 at python.org > Subject: [python-win32] COM Release > > > Is there an explicit way to Release a COM object? > > The iTunes COM api raises an event right before it closes, and if my > application doesn't release the COM object in response, iTunes will > hang for 5 seconds, and then prompt the user if they want to force it > to close (very ugly!) > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From ouli at eastcom.com Tue Aug 16 10:03:02 2005 From: ouli at eastcom.com (ouli) Date: Tue, 16 Aug 2005 16:3:2 +0800 Subject: [python-win32] use python windows as Delphi's child window Message-ID: Hi Is there anyone use python windows as Delphi's child window? Is it possible? best regards ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇouli ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇouli at eastcom.com ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇ2005-08-16 From billburns at pennswoods.net Wed Aug 17 06:07:32 2005 From: billburns at pennswoods.net (Bill Burns) Date: Wed, 17 Aug 2005 00:07:32 -0400 Subject: [python-win32] Python Win32 Licensing Message-ID: <4302B804.6050208@pennswoods.net> I have some questions regarding the Python Win32 packages and licensing. I've 'Googled' for an answer and searched the Python Win32 archives but haven't come up with anything. I have the GPL'ed versions of QT 3.3.4 and Pyqt 3.13 installed on my Windows box (compiled with MinGW). I've created a GUI app (using the above) that prints plot files (*.plt). This app uses win32print. As I understand it, since I've used GLP'ed Qt & Pyqt, if I were to distribute my app, it would have to be under the GPL as well. My question is, would it be acceptable/allowable to use win32print within my GPL'ed application? If I use py2exe, the 'dist' folder contains pywintypes24.dll and win32print.pyd. Would these libraries be able to be distributed with the app, as well? I apologize for the licensing questions especially if this is not the right forum. I just want to make sure that I do the right thing. I do *not* want to distribute something if it is specifically *not* allowed. I've only been doing this as hobby and I'm not a programmer so this is another reason as to why I'm unsure of the correct answers. I would certainly distribute the source code with the program and include any needed copyright notices for the libraries used, if required. At this time I do *not* want to distribute the app, but if I clean it up and get everything working correctly, I may want to in the near future. I suspect that with the recent release of QT 4 GPL for Windows and with the coming release of Pyqt 4 GPL for Windows, these types of questions will come up more often. Thank you for your help, Bill Burns From mhammond at skippinet.com.au Wed Aug 17 10:52:41 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 17 Aug 2005 18:52:41 +1000 Subject: [python-win32] Python Win32 Licensing In-Reply-To: <4302B804.6050208@pennswoods.net> Message-ID: > I have some questions regarding the Python Win32 packages and licensing. > I've 'Googled' for an answer and searched the Python Win32 archives but > haven't come up with anything. There are 3 License.txt file in the distribution. IIRC, these were just MIT-style templates and have very few restrictions on redistribution. In the future these are likely to be re-licensed under the PSA licence - but the intent is that they have no more restrictions than Python itself. > My question is, would it be acceptable/allowable to use win32print > within my GPL'ed application? I think so, but IANAL. I believe nothing in the pywin32 licenses prevent this and it is my intention that it be OK. I can't comment on if it is OK from the GPL's POV though. I hope that helps. The short answer is that *I* won't try and sue you! :) Mark From billburns at pennswoods.net Wed Aug 17 12:48:48 2005 From: billburns at pennswoods.net (Bill Burns) Date: Wed, 17 Aug 2005 06:48:48 -0400 Subject: [python-win32] Python Win32 Licensing In-Reply-To: References: Message-ID: <43031610.8030809@pennswoods.net> >>I have some questions regarding the Python Win32 packages and licensing. >>I've 'Googled' for an answer and searched the Python Win32 archives but >>haven't come up with anything. > > > There are 3 License.txt file in the distribution. IIRC, these were just > MIT-style templates and have very few restrictions on redistribution. In > the future these are likely to be re-licensed under the PSA licence - but > the intent is that they have no more restrictions than Python itself. > > >>My question is, would it be acceptable/allowable to use win32print >>within my GPL'ed application? > > > I think so, but IANAL. I believe nothing in the pywin32 licenses prevent > this and it is my intention that it be OK. I can't comment on if it is OK > from the GPL's POV though. > > I hope that helps. The short answer is that *I* won't try and sue you! :) > Mark, Thank you for the reply, I appreciate it! I guess I need to look into the GPL compatibility 'side of things'. According to the FSF, the current Python license is compatible and I believe the MIT-style license is as well. Thank you for the *excellent* win32 packages!! You have done some great work!! Bill From javier at jarava.com Tue Aug 16 22:16:51 2005 From: javier at jarava.com (Javier Jarava) Date: Tue, 16 Aug 2005 22:16:51 +0200 Subject: [python-win32] [Fwd: Re: wmi module error on ActivePython 2.4.1 Build 245] Message-ID: <430249B3.1010705@jarava.com> As per the request of Tim Golden, I'm cc-ing this email to the list ;) -------- Original Message -------- Subject: Re: wmi module error on ActivePython 2.4.1 Build 245 Date: Tue, 16 Aug 2005 19:56:00 +0100 From: Tim Golden To: Javier Jarava References: <430235A2.1070408 at jarava.com> Javier Jarava wrote: > Hi! > > Just installed (or, rather, re-installed) your wmi module on my new > computer: > > I unzipped to c:\tmp\wmp-py, run "python setup.py install". > > I open a new python shell, and I get: > > ActivePython 2.4.1 Build 245 (ActiveState Corp.) based on > Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import wmi > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\Lib\site-packages\wmi.py", line 137, in ? > win32com.client.gencache.EnsureDispatch (obj._oleobj_) > File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line > 541, in EnsureDispatch > mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], > bForDemand=bForDemand) > File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line > 398, in EnsureModule > module = GetModuleForTypelib(typelibCLSID, lcid, major, minor) > File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line > 263, in GetModuleForTypelib > mod = _GetModule(modName) > File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line > 634, in _GetModule > mod = __import__(mod_name) > File > "C:\Python24\lib\site-packages\win32com\gen_py\565783C6-CB41-11D1-8B02-00600806D9B6x0x1x2\__init__.py", > > line 260 > '{D6BDAFB2-9435-491F-BB87-6AA0F0BC31A2}' : 'SWbemObjectEx', > ^ > SyntaxError: invalid syntax Thanks for the info. I've got no idea what the problem might be, unfortunately. I remember someone saying recently that they were having problems with some build of pywin32 (which is the most likely prospect) but I don't remember what. Could you copy the email to the python-win32 list? Maybe someone there can spot the problem. I don't think it's specific to wmi. TJG From javier at jarava.com Tue Aug 16 22:17:40 2005 From: javier at jarava.com (Javier Jarava) Date: Tue, 16 Aug 2005 22:17:40 +0200 Subject: [python-win32] [Fwd: Re: wmi module error on ActivePython 2.4.1 Build 245] Message-ID: <430249E4.8070800@jarava.com> As a follow-up to my previous mail to the list: I've tried to use Tim's "new" 0,6b module and it seems to work OK... JJ -------- Original Message -------- Subject: Re: wmi module error on ActivePython 2.4.1 Build 245 Date: Tue, 16 Aug 2005 22:11:07 +0200 From: Javier Jarava To: Javier Jarava CC: tim.golden at iname.com References: <430235A2.1070408 at jarava.com> Hi!! Just wanted to telll you that dowloading the 0.6b module, copying on top of wmi.py and re-running "python make install" seems to have solved the problems. At least, "import wmi" doesn't bomb now. Will give it a whirl, to see if all seems to be OK. Just my 0,002 Javier Javier Jarava wrote: > Hi! > > Just installed (or, rather, re-installed) your wmi module on my new > computer: > > I unzipped to c:\tmp\wmp-py, run "python setup.py install". > > I open a new python shell, and I get: > > ActivePython 2.4.1 Build 245 (ActiveState Corp.) based on > Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit (Intel)] > on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import wmi > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\Lib\site-packages\wmi.py", line 137, in ? > win32com.client.gencache.EnsureDispatch (obj._oleobj_) > File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", > line 541, in EnsureDispatch > mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], > bForDemand=bForDemand) > File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", > line 398, in EnsureModule > module = GetModuleForTypelib(typelibCLSID, lcid, major, minor) > File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", > line 263, in GetModuleForTypelib > mod = _GetModule(modName) > File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", > line 634, in _GetModule > mod = __import__(mod_name) > File > "C:\Python24\lib\site-packages\win32com\gen_py\565783C6-CB41-11D1-8B02-00600806D9B6x0x1x2\__init__.py", > > line 260 > '{D6BDAFB2-9435-491F-BB87-6AA0F0BC31A2}' : 'SWbemObjectEx', > ^ > SyntaxError: invalid syntax > > > The "odd" thing is that I've used the same .zip on differen computers, > w/o any problems. > > System info: > > Host Name: MERCURY > OS Name: Microsoft Windows XP Professional > OS Version: 5.1.2600 Service Pack 2 Build 2600 > OS Manufacturer: Microsoft Corporation > OS Configuration: Standalone Workstation > OS Build Type: Uniprocessor Free > Registered Owner: Secuware S.L. > Registered Organization: Secuware S.L. > Original Install Date: 12/05/2005, 15:20:26 > System Up Time: 6 Days, 3 Hours, 5 Minutes, 12 Seconds > System Manufacturer: Hewlett-Packard > System Model: HP Compaq nx8220 (PG828ET#ABE) > System type: X86-based PC > Processor(s): 1 Processor(s) Installed. > [01]: x86 Family 6 Model 13 Stepping 8 > GenuineIntel ~1861 Mhz > BIOS Version: HP - 28040520 > Windows Directory: C:\WINDOWS > System Directory: C:\WINDOWS\system32 > Boot Device: \Device\HarddiskVolume1 > System Locale: en-us;English (United States) > Input Locale: es;Spanish (Traditional Sort) > Time Zone: (GMT+01:00) Brussels, Copenhagen, Madrid, > Paris > Total Physical Memory: 1.023 MB > Available Physical Memory: 408 MB > Virtual Memory: Max Size: 2.048 MB > Virtual Memory: Available: 2.008 MB > Virtual Memory: In Use: 40 MB > Page File Location(s): C:\pagefile.sys > NetWork Card(s): 4 NIC(s) Installed. > [01]: Intel(R) PRO/Wireless 2200BG Network > Connection > Connection Name: WLAN > Status: Media disconnected > [02]: 1394 Net Adapter > Connection Name: IEEE1394 > DHCP Enabled: Yes > DHCP Server: N/A > IP address(es) > [03]: VMware Virtual Ethernet Adapter for > VMnet1 > Connection Name: VMnet1 (HOST_ONLY) > DHCP Enabled: No > IP address(es) > [01]: 192.168.101.1 > [04]: VMware Virtual Ethernet Adapter for > VMnet8 > Connection Name: VMnet8 (NAT) > DHCP Enabled: No > IP address(es) > [01]: 192.168.110.1 > > Hope this helps... > > TIA > > Javier Jarava > From billburns at pennswoods.net Thu Aug 18 03:13:31 2005 From: billburns at pennswoods.net (Bill Burns) Date: Wed, 17 Aug 2005 21:13:31 -0400 Subject: [python-win32] Python Win32 Licensing In-Reply-To: <43035543.5030308@vintech.bg> References: <4302B804.6050208@pennswoods.net> <43035543.5030308@vintech.bg> Message-ID: <4303E0BB.3040706@pennswoods.net> > Hello Bill, > >> I have some questions regarding the Python Win32 packages and licensing. >> I've 'Googled' for an answer and searched the Python Win32 archives but >> haven't come up with anything. >> >> I have the GPL'ed versions of QT 3.3.4 and Pyqt 3.13 installed on my >> Windows box (compiled with MinGW). > > > What is this GPL QT 3.3.4 for Windows? Where can i find it? > I have only heard for GPL QT 4 for Windows. > > TIA > Hi Niki, The QT version that I'm talking about is the GPL'ed version of QT 3.x.x that has been ported to run on Windows. I believe this port was started by the KDE developers, but please don't quote me on that! This port is *not* from Trolltech. Using this port (along with MinGW) you can compile QT 3.x.x on a Windows machine and wind up with a GPL'ed version of QT running on Windows. You will need to have MinGW or an MS compiler installed on your machine to do this. I don't know if binaries are available. I compiled everything from source using MinGW. Here are some links that you can check out: http://kde-cygwin.sourceforge.net/qt3-win32/compile-mingw.php http://kde-cygwin.sourceforge.net/qt3-win32/index.php http://qtwin.sourceforge.net/index.php/Main_Page http://kscraft.sourceforge.net/convert_xhtml.php?doc=pyqt-windows-install.xhtml Bill From upadhyay at gmail.com Thu Aug 18 09:48:27 2005 From: upadhyay at gmail.com (Amit Upadhyay) Date: Thu, 18 Aug 2005 13:18:27 +0530 Subject: [python-win32] Python Win32 Licensing In-Reply-To: <4303E0BB.3040706@pennswoods.net> References: <4302B804.6050208@pennswoods.net> <43035543.5030308@vintech.bg> <4303E0BB.3040706@pennswoods.net> Message-ID: <349edb3805081800486827190f@mail.gmail.com> On 8/18/05, Bill Burns wrote: > You will need to have MinGW or an MS compiler installed on your machine > to do this. I don't know if binaries are available. I compiled > everything from source using MinGW. > > Here are some links that you can check out: > > http://kde-cygwin.sourceforge.net/qt3-win32/compile-mingw.php > > http://kde-cygwin.sourceforge.net/qt3-win32/index.php > > http://qtwin.sourceforge.net/index.php/Main_Page And check this: http://www.quadgames.com/download/pythonqt/PyQtGPL10.exe -- Amit Upadhyay Blog: http://www.rootshell.be/~upadhyay +91-9867-359-701 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050818/39dd8189/attachment.htm From theller at python.net Fri Aug 19 23:45:22 2005 From: theller at python.net (Thomas Heller) Date: Fri, 19 Aug 2005 23:45:22 +0200 Subject: [python-win32] comtypes prelease available Message-ID: I have uploaded an early preview release for comtypes. As you might know, comtypes is a new COM library for Python, based on the ctypes package. There is not yet any documentation, but I hope that at least some of the unittests provided give an impression how it is supposed to be used. There are also some docstrings in the comtypes/client/__init__.py module, which contains the high level functions to use. Highlights: - access *custom* interfaces easily. This works best if they provide type information - automatic typelib wrapper generation. This even should work in frozen executables. - event support. - comtypes is supposed to provide good support for Limitations: - there is currently *no* server side support. You cannot yet write COM servers in comtypes, although I hope that can follow soon. - custom interfaces work best (IUnkown based or IDispatch based). Pure dispinterface support is somewhat limited (but then there is pywin32, if you need that). Enjoy, Thomas SF project page: http://sourceforge.net/projects/comtypes/ Download page: http://sourceforge.net/project/showfiles.php?group_id=115265 Requires ctypes.0.9.8, which is also available for download at this page. From rutt at bmi.osu.edu Sun Aug 21 22:31:49 2005 From: rutt at bmi.osu.edu (Benjamin Rutt) Date: Sun, 21 Aug 2005 16:31:49 -0400 Subject: [python-win32] keep tkinter window always on top Message-ID: <5v7jef9glm.fsf@akron.bmi.ohio-state.edu> Does anyone know how to keep a tkinter window always on top, despite attempts to focus other windows? Here is my failed attempt. I've tried both tkinter-only and win32-specific solutions. For this code, the window does stay in front of the dos box it's launched from if I try to focus the dos box, but that's the only one it stays in front of. Thanks, Benjamin #!/usr/bin/env python from Tkinter import * import win32ui, win32con, win32gui root = None reps = 0 def show(): # try everything to keep this window on top root.lift() root.focus_force() hwnd = root.winfo_id() pycwnd = win32ui.CreateWindowFromHandle(hwnd) pycwnd.ShowWindow(win32con.SW_RESTORE) pycwnd.ShowWindow(win32con.SW_SHOWNORMAL) pycwnd.BringWindowToTop() win32gui.SetFocus(hwnd) win32gui.BringWindowToTop(hwnd) def reshow(): global reps reps += 1 print 'reshow(%d)' % (reps) show() if reps < 100: root.after(100, reshow) else: root.destroy() root = Tk() root.config(width=400, height=400) show() root.after(100, reshow) root.mainloop() From mhammond at skippinet.com.au Mon Aug 22 00:44:12 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 22 Aug 2005 08:44:12 +1000 Subject: [python-win32] keep tkinter window always on top In-Reply-To: <5v7jef9glm.fsf@akron.bmi.ohio-state.edu> Message-ID: > Does anyone know how to keep a tkinter window always on top, despite > attempts to focus other windows? Here is my failed attempt. I've > tried both tkinter-only and win32-specific solutions. For this code, > the window does stay in front of the dos box it's launched from if I > try to focus the dos box, but that's the only one it stays in front > of. Thanks, Benjamin Try something like: import win32gui win32gui.SetWindowPos(hWnd, win32con.HWND_TOPMOST, 0,0,0,0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE) Mark From rutt at bmi.osu.edu Mon Aug 22 02:03:17 2005 From: rutt at bmi.osu.edu (Benjamin Rutt) Date: Sun, 21 Aug 2005 20:03:17 -0400 Subject: [python-win32] keep tkinter window always on top References: <5v7jef9glm.fsf@akron.bmi.ohio-state.edu> Message-ID: <5vvf1y96t6.fsf@akron.bmi.ohio-state.edu> "Mark Hammond" writes: >> Does anyone know how to keep a tkinter window always on top, despite >> attempts to focus other windows? Here is my failed attempt. I've >> tried both tkinter-only and win32-specific solutions. For this code, >> the window does stay in front of the dos box it's launched from if I >> try to focus the dos box, but that's the only one it stays in front >> of. Thanks, Benjamin > > Try something like: > > import win32gui > win32gui.SetWindowPos(hWnd, win32con.HWND_TOPMOST, 0,0,0,0, > win32con.SWP_NOMOVE | win32con.SWP_NOSIZE) Argh, it turns out that I needed to do hwnd = int(eval(root.wm_frame())) not hwnd = root.winfo_id() So much for trusting the first code for "tkinter root window->window handle" I come across on the net. :) Thanks, it almost works now. Just one last problem, while it is always on top, it doesn't always have the input focus. Any recipes for that? That is, I want it to steal the focus if it doesn't have it. Thanks, -- Benjamin Rutt From rutt at bmi.osu.edu Mon Aug 22 01:28:34 2005 From: rutt at bmi.osu.edu (Benjamin Rutt) Date: Sun, 21 Aug 2005 19:28:34 -0400 Subject: [python-win32] keep tkinter window always on top References: <5v7jef9glm.fsf@akron.bmi.ohio-state.edu> Message-ID: <5v3bp2amzh.fsf@akron.bmi.ohio-state.edu> "Mark Hammond" writes: >> Does anyone know how to keep a tkinter window always on top, despite >> attempts to focus other windows? Here is my failed attempt. I've >> tried both tkinter-only and win32-specific solutions. For this code, >> the window does stay in front of the dos box it's launched from if I >> try to focus the dos box, but that's the only one it stays in front >> of. Thanks, Benjamin > > Try something like: > > import win32gui > win32gui.SetWindowPos(hWnd, win32con.HWND_TOPMOST, 0,0,0,0, > win32con.SWP_NOMOVE | win32con.SWP_NOSIZE) Hmm, that didn't work either. Below is the full program I used. Do you think the fact that it's being run from a tkinter callback is why it isn't working? Like maybe tkinter is stealing/inhibiting these Windows API calls while it's running the callbacks? Running WinXP SP2, python 2.4.1, win32all build 204 here. #!/usr/bin/env python from Tkinter import * import win32ui, win32con, win32gui root = None reps = 0 def show(): hwnd = root.winfo_id() win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 0,0,0,0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE) def reshow(): global reps reps += 1 print 'reshow(%d)' % (reps) show() if reps < 100: root.after(100, reshow) else: root.destroy() root = Tk() root.config(width=400, height=400) show() root.after(100, reshow) root.mainloop() From kevin.white at nextpage.com Mon Aug 22 20:09:24 2005 From: kevin.white at nextpage.com (Kevin White) Date: Mon, 22 Aug 2005 12:09:24 -0600 Subject: [python-win32] Possibility of calling static functions using window/thread handles? Message-ID: <60282EBF66822F4DB75DC39F52D028CB5D9FF2@ex11.nextpage.int> I don't know much about Windows API programming, so this may be a laughable question. Is it possible to use the win32process.CreateProcess() function to launch a program then somehow use the returned window/thread handle to invoke a static method. My guess is that the process would have to somehow magically be converted back to its native class/object and I don't know if that's really feasible. Thoughts? Kevin White -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050822/636a377f/attachment.htm From gagenellina at softlab.com.ar Tue Aug 23 09:27:10 2005 From: gagenellina at softlab.com.ar (Gabriel Genellina) Date: Tue, 23 Aug 2005 04:27:10 -0300 Subject: [python-win32] Possibility of calling static functions using window/thread handles? In-Reply-To: <60282EBF66822F4DB75DC39F52D028CB5D9FF2@ex11.nextpage.int> References: <60282EBF66822F4DB75DC39F52D028CB5D9FF2@ex11.nextpage.int> Message-ID: <6.2.1.2.0.20050823040022.02d63c70@192.168.0.115> At Monday 22/8/2005 15:09, Kevin White wrote: >I don't know much about Windows API programming, so this may be a >laughable question. Is it possible to use the >win32process.CreateProcess() function to launch a program then somehow use >the returned window/thread handle to invoke a static method. My guess is >that the process would have to somehow magically be converted back to its >native class/object and I don't know if that's really feasible. Thoughts? I don't believe you could do that without some form of inter process communication, like a named pipe, or DDE. (try the DDE demo) Gabriel Genellina Softlab SRL From pjessop at gmail.com Tue Aug 23 12:33:27 2005 From: pjessop at gmail.com (Peter Jessop) Date: Tue, 23 Aug 2005 12:33:27 +0200 Subject: [python-win32] Null provokes unicode error. Message-ID: Good day all: I have a trivial problem that I would be grateful for help with. I am running python 2.4.1 with Python for Windows extensions build 204. When I run the following script after returning some lines correctly I find the following error. 'Traceback (most recent call last): File "C:\Scripts\Script2.py", line 4, in ? print objChild.Name + '\t' + objChild.Description TypeError: coercing to Unicode: need string or buffer, NoneType found' This happens when the description value is null. How do I avoid this problem? Code import win32com.client objContainer = win32com.client.GetObject("LDAP://cn=users,dc=agri,dc=local") for objChild in objContainer: print objChild.Name + '\t' + objChild.Description Thanks Peter Jessop -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050823/63c51da7/attachment.htm From upadhyay at gmail.com Tue Aug 23 12:50:15 2005 From: upadhyay at gmail.com (Amit Upadhyay) Date: Tue, 23 Aug 2005 16:20:15 +0530 Subject: [python-win32] Null provokes unicode error. In-Reply-To: References: Message-ID: <349edb3805082303504f51293d@mail.gmail.com> > > This happens when the description value is null. > > How do I avoid this problem? You can not add string to None, >>> "ASd"+None Traceback (most recent call last): File "", line 1, in ? TypeError: cannot concatenate 'str' and 'NoneType' objects >>> try something like: import win32com.client > objContainer = win32com.client.GetObject(" > LDAP://cn=users,dc=agri,dc=local") > for objChild in objContainer: > if not objChild.Description: objChild.Description = '' > print objChild.Name + '\t' + objChild.Description > -- Amit Upadhyay Blog: http://www.rootshell.be/~upadhyay +91-9867-359-701 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050823/0c489764/attachment.htm From simon.brunning at gmail.com Tue Aug 23 13:32:30 2005 From: simon.brunning at gmail.com (Simon Brunning) Date: Tue, 23 Aug 2005 12:32:30 +0100 Subject: [python-win32] Null provokes unicode error. In-Reply-To: References: Message-ID: <8c7f10c60508230432733a4719@mail.gmail.com> On 8/23/05, Peter Jessop wrote: > 'Traceback (most recent call last): > File "C:\Scripts\Script2.py", line 4, in ? > print objChild.Name + '\t' + objChild.Description > TypeError: coercing to Unicode: need string or buffer, NoneType found' Try: print objChild.Name, '\t', objChild.Description -- Cheers, Simon B, simon at brunningonline.net, http://www.brunningonline.net/simon/blog/ From pjessop at gmail.com Tue Aug 23 14:38:30 2005 From: pjessop at gmail.com (Peter Jessop) Date: Tue, 23 Aug 2005 14:38:30 +0200 Subject: [python-win32] Null provokes unicode error. Message-ID: Amit, Simon Thanks for the help Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050823/1caed0fc/attachment.htm From billburns at pennswoods.net Wed Aug 24 04:30:32 2005 From: billburns at pennswoods.net (Bill Burns) Date: Tue, 23 Aug 2005 22:30:32 -0400 Subject: [python-win32] Retreive paper width from printer Message-ID: <430BDBC8.7060700@pennswoods.net> Is it possible to retrieve the paper width from a printer? To be more specific, I have a Savin 2400WD (wide format printer). It is used for printing blueprints. This printer holds two (2) 500' rolls of paper. On the two (2) rolls, there could be any two (2) combinations of the following sizes (widths) >>> 24", 30" or 36". I'd like to be able to retrieve which two (2) paper sizes are currently loaded (before I send a print job to it). I've made a program using Python and the Windows extensions to print out the blueprints (and that works great), but if the wrong size paper is in the machine (when I send a job in) it's obviously not so great :-( Does anyone know if it's possible to get this info? I'm using: Windows 2000 Pro & XP Pro Python 2.4 Pywin32 Build 204 Thanks, Bill From rwupole at msn.com Thu Aug 25 04:10:59 2005 From: rwupole at msn.com (Roger Upole) Date: Wed, 24 Aug 2005 22:10:59 -0400 Subject: [python-win32] Re: Retreive paper width from printer Message-ID: You should be able to get that info from the DEVMODE returned by win32print.GetPrinter using level 2. Depending on how your printer driver handles paper settings, look at either FormName, PaperSize, DefaultSource, or PaperLength and PaperWidth. Many printers also have an option to hold jobs if the paper specified doesn't match the currently mounted form. (but again this is highly dependent on the printer driver) hth Roger > Is it possible to retrieve the paper width from a printer? > > To be more specific, I have a Savin 2400WD (wide format printer). It is > used for printing blueprints. This printer holds two (2) 500' rolls of > paper. On the two (2) rolls, there could be any two (2) combinations of > the following sizes (widths) >>> 24", 30" or 36". > > I'd like to be able to retrieve which two (2) paper sizes are > currently loaded (before I send a print job to it). > > I've made a program using Python and the Windows extensions to print out > the blueprints (and that works great), but if the wrong size paper is in > the machine (when I send a job in) it's obviously not so great :-( > > Does anyone know if it's possible to get this info? > > I'm using: > Windows 2000 Pro & XP Pro > Python 2.4 > Pywin32 Build 204 > > Thanks, > > Bill From billburns at pennswoods.net Thu Aug 25 05:44:00 2005 From: billburns at pennswoods.net (Bill Burns) Date: Wed, 24 Aug 2005 23:44:00 -0400 Subject: [python-win32] Retreive paper width from printer In-Reply-To: References: Message-ID: <430D3E80.5010207@pennswoods.net> [Roger] You should be able to get that info from the DEVMODE returned by win32print.GetPrinter using level 2. Depending on how your printer driver handles paper settings, look at either FormName, PaperSize, DefaultSource, or PaperLength and PaperWidth. Many printers also have an option to hold jobs if the paper specified doesn't match the currently mounted form. (but again this is highly dependent on the printer driver) [Bill] Roger, Thank you! You sent me right in the direction I needed to go! With your help and a little 'googling', I put the following method into my program (just for testing). def printerProperties(self): pHandle = win32print.OpenPrinter(self.currentPrinter()) properties = win32print.GetPrinter(pHandle, 2) pDevModeObj = properties["pDevMode"] print pDevModeObj.FormName print pDevModeObj.PaperSize print pDevModeObj.DefaultSource print pDevModeObj.PaperLength print pDevModeObj.PaperWidth win32print.ClosePrinter(pHandle) The above prints out the information I wanted (and then some). Thanks again for your help! Bill From weiner at tu-harburg.de Thu Aug 25 14:01:04 2005 From: weiner at tu-harburg.de (Thomas Weiner) Date: Thu, 25 Aug 2005 14:01:04 +0200 Subject: [python-win32] NTFS: editing properties of a file Message-ID: <430DB300.3030901@tu-harburg.de> Hi all, is it possible to read and edit the extended properties of a file on NTFS drives? For example: with the explorer you get properties like Title, Author, Subject, Category etc by right clicking. I want to use and edit these fields programmaticly. In pythonwin I've found methods for Office files (which store the informations above differently) and for the version strings of dll and exe, but nothing for other files. Thanks, Thomas From wschneider at ra.rockwell.com Thu Aug 25 16:24:35 2005 From: wschneider at ra.rockwell.com (Wolfgang Schneider) Date: Thu, 25 Aug 2005 16:24:35 +0200 Subject: [python-win32] Installing a Python script as service Message-ID: Hi We have the following problem when we try to install a Python script as Win32 service: The Python script is located in a path that contains the substring "_demonstrator". When installing the Python service for this script, we get the error message, the the file "PythonService_d.exe" isn't found. We don't have this file in our Python installation. First investigations led us to the following lines at win32serviceutil.py: def LocatePythonServiceExe(exeName = None): # Try and find the specified EXE somewhere. If specifically registered, # use it. Otherwise look down sys.path, and the global PATH environment. if exeName is None: if win32service.__file__.find("_d")>=0: exeName = "PythonService_d.exe" else: exeName = "PythonService.exe" ... This function is called to find the executable for the Python service to store it at registry when the Python service is installed. The call to find("_d") returns with >0 in our case, because our path contains the substring "_demonstrator". I don't understand what the meaning of this lines is. Why is the decission for correct PythonService exe made on the substring "_d"? This is not very save, I think. Can anybody explain this? An easy workaround is to avoid the substring "_d" in the path to the Python script that should be installed as PythonService. But is it realy intended to forbid "_d" substrings in paths for PythonServices when we don't want to run in PythonService_d.exe? How can this be ensured in real world? Maybe there should be another criteria for the decision which PythonService exe is taken. Regards, Wolfgang -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050825/2620044f/attachment.htm From simon.bayling at rockford-uk.com Thu Aug 25 13:09:24 2005 From: simon.bayling at rockford-uk.com (Simon Bayling) Date: Thu, 25 Aug 2005 12:09:24 +0100 Subject: [python-win32] Problem with COM/ADO using SQL Stored Procedure with OUTPUT parameter Message-ID: <21C26FAFCF3043478BC68FEDB6717D9C0F8218@rn-exch-001.newport.rockford-uk.com> Hello, I am unable to get the value of an OUTPUT parameter from a SQL Server stored procedure - but only when accessing it with ADO using Python and COM. I also can't find any good Google answers on the topic (mostly, a post by one Steve Holden who had the same problem, and that was left unresolved). As it seems to be a problem between PyWin32/COM and ADO, rather than with SQL or ADO, and I have seen COM/ADO posts in this archive, I thought I would try here next. Can any of you suggest anything, please? SQL Stored Procedure: CREATE PROCEDURE [dbo].[log_item] @name varchar(150), @row_id int OUTPUT AS BEGIN INSERT INTO my_log VALUES (@name, GETDATE(), NULL) SELECT @row_id = SCOPE_IDENTITY() END This works in the SQL Query Analyzer: declare @row_id int exec log_item "abcd", @row_id output select @row_id > 1146 This also works from VBScript using code adapted from step 4 here: http://authors.aspalliance.com/stevesmith/articles/sprocs.asp I can create a command, add two parameters, execute the command, and get a valid value returned in the second parameter. I can't get it to work from Python. Literal translations of the VBScript return None. The stored procedure is being called, rows are inserted into the database, but the value isn't getting back to my Python script. The Simplest example I can create that demonstrates the problem is: from win32com.client import Dispatch, constants conn = Dispatch("ADODB.Connection") conn.ConnectionString = "Provider=SQLOLEDB.1;Data Source=server;uid=user;pwd=pass;database=test" conn.Open() cmd = Dispatch('ADODB.Command') cmd.ActiveConnection = conn cmd.CommandText = "log_item" cmd.CommandType = 4 # =adCmdStoredProc param1 = cmd.CreateParameter('@name', 200, 1, 150) # adVarChar, adParamInput, size param1.Value = "abcd" cmd.Parameters.Append(param1) row_param = cmd.CreateParameter('@row_id', 3, 2) # adInteger, adParamOutput cmd.Parameters.Append(row_param) result = cmd.Execute() print row_param.Name, row_param.Value row_id = cmd.Parameters.Item("@row_id") print "row_id: ", row_id, "Value: ", row_id.Value It just prints "None" afterwards. I have seen suggestions to try setting cmd.Prepared = True, and this has no apparent effect. I have tried changing it to be an InputOutput parameter, and sending a value in. This time, I just get the same value out again. I have checked with cmd.Parameters.Refresh, and that tells me the stored procedure needs the two parameters I am expecting. It doesn't make any difference to whether it works or not though. (Oh, and Windows XP, Python 2.4.1, PythonWin build 204, and I have run MakePy on Microsoft ActiveX Data Objects 2.8) I'm now quite stumped, and would appreciate any further suggestions before I give up and resort to a cursor and run "insert into" then "select max(row_id) from" to get the same effect. Cheers, Simon. This email originates from IT Group UK Limited. With subsidiary companies: Rockford IT Limited Rockford Electronics Limited Registered Office: 2A New Street Newport Shropshire TF10 7AX UK Company Registered in England: 4263503 Tel: 01952 812 290 (Technical Centre) Tel: 0871 871 2778 (Head Office) From rwupole at msn.com Thu Aug 25 22:24:42 2005 From: rwupole at msn.com (Roger Upole) Date: Thu, 25 Aug 2005 16:24:42 -0400 Subject: [python-win32] NTFS: editing properties of a file References: <430DB300.3030901@tu-harburg.de> Message-ID: StgOpenStorageEx allows you to access the NTFS extended document properties. Take a look at \win32com\test\testStorage.py for examples of how it's used from Python. hth Roger Thomas Weiner wrote: > Hi all, > > is it possible to read and edit the extended properties of a file on > NTFS drives? For example: with the explorer you get properties like > Title, Author, Subject, Category etc by right clicking. I want to use > and edit these fields programmaticly. > > In pythonwin I've found methods for Office files (which store the > informations above differently) and for the version strings of dll and > exe, but nothing for other files. > > Thanks, > Thomas From troy at studyshare.net Fri Aug 26 19:33:52 2005 From: troy at studyshare.net (Troy Farrell) Date: Fri, 26 Aug 2005 12:33:52 -0500 (CDT) Subject: [python-win32] win32com: HTTP Post with WebBrowser.Navigate() Message-ID: <43307.69.151.18.34.1125077632.squirrel@esft.net> Hello List! I am trying to use win32com to automate Internet Explorer. I am able to instanciate my COM object, and even control IE, but using WebBrowser.Navigate() to execute an HTTP POST request fails; the browser always makes a GET request. The MS KB article on doing this with VB is here: http://support.microsoft.com/default.aspx?kbid=174923 Possibly related bug here: http://support.microsoft.com/default.aspx?scid=kb;en-us;322122 I have tried to model my Python after this code, but to no avail: ---Being Python Code--- from pythoncom import Missing import win32com.client class Events: def OnDocumentComplete(self, pDisp=Missing, URL=Missing): """Fired when the document being navigated to reaches ReadyState_Complete.""" if URL == "about:blank": self.Navigate( dURL, Missing, Missing, PostData, Headers ) # Prepare Internet Explorer ie = win32com.client.DispatchWithEvents( "InternetExplorer.Application.1", Events ) dURL = "http://server/cgi-bin/test.sh" Data = "TEST=SUCCESS" PostData = list( Data ) Headers = "Content-Type: application/x-www-form-urlencoded\n\r" # show it to the user ie.Visible = True ie.Navigate( "about:blank" ) ---End Python Code--- Every time, the broser makes a GET request to the URL. Can anyone point me in the right direction? Thanks. Troy Farrell From troy at studyshare.net Fri Aug 26 21:29:37 2005 From: troy at studyshare.net (Troy Farrell) Date: Fri, 26 Aug 2005 14:29:37 -0500 (CDT) Subject: [python-win32] win32com: HTTP Post with WebBrowser.Navigate() In-Reply-To: <43307.69.151.18.34.1125077632.squirrel@esft.net> References: <43307.69.151.18.34.1125077632.squirrel@esft.net> Message-ID: <54691.69.151.18.34.1125084577.squirrel@esft.net> I've made some progress. I finally coerced IE to POST, but the data it posts is ugly binary data, not what I thought I sent in PostData: ---Begin Python Code--- import win32com.client # Prepare Internet Explorer ie = win32com.client.Dispatch( "InternetExplorer.Application.1" ) dURL = "http://server/cgi-bin/test.sh" Flags = 0 Huh = "" Data = "TEST=SUCCESS" PostData = [ Data ] Headers = "Content-Type: application/x-www-form-urlencoded\r\n" # show it to the user ie.Visible = True ie.Navigate( dURL, Flags, Huh, PostData, Headers ) ---End Python Code--- Where a the QUERY_STRING would be posted, "TEST=SUCCESS" in the example above, I'm getting wierd binary data: POST /cgi-bin/test/sh HTTP/1.1 Accept: */* Accept-Language: en-us,ru;q=0.8,fr;q=0.5,et;q=0.3 Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.50215) Host: server Content-Length: 16 Connection: Keep-Alive Cache-Control: no-cache .........}...... The POSTed data formatted in a python array: [ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x7d, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00 ] I suspect this is due to a disagreement between Python and COM over the PostData argument. In more than one place on support.microsoft.com and MSDN I have seen this: """ The post data specified by PostData is passed as a SAFEARRAY Data Type structure. The VARIANT should be of type VT_ARRAY and point to a SAFEARRAY Data Type. The SAFEARRAY Data Type should be of element type VT_UI1, dimension one, and have an element count equal to the number of bytes of post data. """ This was mentioned long ago on the python list: http://mail.python.org/pipermail/python-list/2002-July/113260.html Does anyone know how I might go about fixing this argument? This is where I mention that I have little/no COM experience outside of python. Thanks. Troy > Hello List! > > I am trying to use win32com to automate Internet Explorer. I am able to > instanciate my COM object, and even control IE, but using > WebBrowser.Navigate() to execute an HTTP POST request fails; the browser > always makes a GET request. The MS KB article on doing this with VB is > here: > http://support.microsoft.com/default.aspx?kbid=174923 > > Possibly related bug here: > http://support.microsoft.com/default.aspx?scid=kb;en-us;322122 > > I have tried to model my Python after this code, but to no avail: > > ---Being Python Code--- > > from pythoncom import Missing > import win32com.client > > class Events: > def OnDocumentComplete(self, pDisp=Missing, URL=Missing): > """Fired when the document being navigated to reaches > ReadyState_Complete.""" > if URL == "about:blank": > self.Navigate( dURL, Missing, Missing, PostData, Headers ) > > > # Prepare Internet Explorer > ie = win32com.client.DispatchWithEvents( "InternetExplorer.Application.1", > Events ) > > dURL = "http://server/cgi-bin/test.sh" > Data = "TEST=SUCCESS" > PostData = list( Data ) > Headers = "Content-Type: application/x-www-form-urlencoded\n\r" > > # show it to the user > ie.Visible = True > ie.Navigate( "about:blank" ) > > ---End Python Code--- > > Every time, the broser makes a GET request to the URL. Can anyone point > me in the right direction? > > Thanks. > Troy Farrell From mark.mclarnon at gmail.com Fri Aug 26 22:13:52 2005 From: mark.mclarnon at gmail.com (mark mclarnon) Date: Fri, 26 Aug 2005 16:13:52 -0400 Subject: [python-win32] process listing without COM/WMI Message-ID: <25373858050826131328a0cc1c@mail.gmail.com> I am in serious need of the ability to query the list of running process to check and see if an EXE (that I choose) is running under Python 2.4.1. I found an example to do this at the following url: http://tgolden.sc.sabren.com/python/wmi_cookbook.html and a similar example that uses GetObject('winmgmts:') but I recieve errors when I try to use these methods. I would like to use a 'pure' python approach as I see the win32process enumProcesses call. Has anyone done this? mark From rwupole at msn.com Sat Aug 27 00:23:41 2005 From: rwupole at msn.com (Roger Upole) Date: Fri, 26 Aug 2005 18:23:41 -0400 Subject: [python-win32] process listing without COM/WMI Message-ID: Here's a post from a few months back with some code to do that. http://mail.python.org/pipermail/python-win32/2005-February/002943.html Roger "mark mclarnon" wrote: >I am in serious need of the ability to query the list of running > process to check and see if an EXE (that I choose) is running under > Python 2.4.1. I found an example to do this at the following url: > > http://tgolden.sc.sabren.com/python/wmi_cookbook.html > > and a similar example that uses GetObject('winmgmts:') but I recieve > errors when I try to use these methods. I would like to use a 'pure' > python approach as I see the win32process enumProcesses call. > > Has anyone done this? > > mark From rwupole at msn.com Sat Aug 27 03:51:00 2005 From: rwupole at msn.com (Roger Upole) Date: Fri, 26 Aug 2005 21:51:00 -0400 Subject: [python-win32] Installing a Python script as service References: Message-ID: The intent is to register the service to run in debug mode if you're currently running a debug build. By convention, pyd's and exe's have _d appended to them for a debug build, so you'd have win32service_d.pyd. It would be more reliable to use os.path.splitext and check that the last 2 chars are _d rather than doing .find on the whole path. hth Roger Hi We have the following problem when we try to install a Python script as Win32 service: The Python script is located in a path that contains the substring "_demonstrator". When installing the Python service for this script, we get the error message, the the file "PythonService_d.exe" isn't found. We don't have this file in our Python installation. First investigations led us to the following lines at win32serviceutil.py: def LocatePythonServiceExe(exeName = None): # Try and find the specified EXE somewhere. If specifically registered, # use it. Otherwise look down sys.path, and the global PATH environment. if exeName is None: if win32service.__file__.find("_d")>=0: exeName = "PythonService_d.exe" else: exeName = "PythonService.exe" ... This function is called to find the executable for the Python service to store it at registry when the Python service is installed. The call to find("_d") returns with >0 in our case, because our path contains the substring "_demonstrator". I don't understand what the meaning of this lines is. Why is the decission for correct PythonService exe made on the substring "_d"? This is not very save, I think. Can anybody explain this? An easy workaround is to avoid the substring "_d" in the path to the Python script that should be installed as PythonService. But is it realy intended to forbid "_d" substrings in paths for PythonServices when we don't want to run in PythonService_d.exe? How can this be ensured in real world? Maybe there should be another criteria for the decision which PythonService exe is taken. Regards, Wolfgang ------------------------------------------------------------------------------ _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050826/3367955b/attachment.html From rwupole at msn.com Sat Aug 27 05:46:22 2005 From: rwupole at msn.com (Roger Upole) Date: Fri, 26 Aug 2005 23:46:22 -0400 Subject: [python-win32] Re: win32com: HTTP Post with WebBrowser.Navigate() Message-ID: Try PostData=buffer(Data). hth Roger Troy Farrell wrote: > I've made some progress. I finally coerced IE to POST, but the data it > posts is ugly binary data, not what I thought I sent in PostData: > > ---Begin Python Code--- > import win32com.client > > # Prepare Internet Explorer > ie = win32com.client.Dispatch( "InternetExplorer.Application.1" ) > > dURL = "http://server/cgi-bin/test.sh" > Flags = 0 > Huh = "" > Data = "TEST=SUCCESS" > PostData = [ Data ] > Headers = "Content-Type: application/x-www-form-urlencoded\r\n" > > # show it to the user > ie.Visible = True > ie.Navigate( dURL, Flags, Huh, PostData, Headers ) > > ---End Python Code--- > > Where a the QUERY_STRING would be posted, "TEST=SUCCESS" in the example > above, I'm getting wierd binary data: > > POST /cgi-bin/test/sh HTTP/1.1 > Accept: */* > Accept-Language: en-us,ru;q=0.8,fr;q=0.5,et;q=0.3 > Content-Type: application/x-www-form-urlencoded > Accept-Encoding: gzip, deflate > User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR > 1.1.4322; .NET CLR 2.0.50215) > Host: server > Content-Length: 16 > Connection: Keep-Alive > Cache-Control: no-cache > > .........}...... > > The POSTed data formatted in a python array: > [ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x7d, 0x19, 0x00, > 0x00, 0x00, 0x00, 0x00 ] > > I suspect this is due to a disagreement between Python and COM over the > PostData argument. In more than one place on support.microsoft.com and > MSDN I have seen this: > """ > The post data specified by PostData is passed as a SAFEARRAY Data Type > structure. The VARIANT should be of type VT_ARRAY and point to a SAFEARRAY > Data Type. The SAFEARRAY Data Type should be of element type VT_UI1, > dimension one, and have an element count equal to the number of bytes of > post data. > """ > > This was mentioned long ago on the python list: > http://mail.python.org/pipermail/python-list/2002-July/113260.html > > Does anyone know how I might go about fixing this argument? This is where > I mention that I have little/no COM experience outside of python. > > Thanks. > Troy > From mhammond at skippinet.com.au Sat Aug 27 06:08:05 2005 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 27 Aug 2005 14:08:05 +1000 Subject: [python-win32] Installing a Python script as service In-Reply-To: Message-ID: Oops - I missed the original - thanks Roger! I've now changed that check to: if os.path.splitext(win32service.__file__)[0].endswith("_d"): Mark -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Roger Upole Sent: Saturday, 27 August 2005 11:51 AM To: python-win32 at python.org Subject: Re: [python-win32] Installing a Python script as service The intent is to register the service to run in debug mode if you're currently running a debug build. By convention, pyd's and exe's have _d appended to them for a debug build, so you'd have win32service_d.pyd. It would be more reliable to use os.path.splitext and check that the last 2 chars are _d rather than doing .find on the whole path. hth Roger Hi We have the following problem when we try to install a Python script as Win32 service: The Python script is located in a path that contains the substring "_demonstrator". When installing the Python service for this script, we get the error message, the the file "PythonService_d.exe" isn't found. We don't have this file in our Python installation. First investigations led us to the following lines at win32serviceutil.py: def LocatePythonServiceExe(exeName = None): # Try and find the specified EXE somewhere. If specifically registered, # use it. Otherwise look down sys.path, and the global PATH environment. if exeName is None: if win32service.__file__.find("_d")>=0: exeName = "PythonService_d.exe" else: exeName = "PythonService.exe" ... This function is called to find the executable for the Python service to store it at registry when the Python service is installed. The call to find("_d") returns with >0 in our case, because our path contains the substring "_demonstrator". I don't understand what the meaning of this lines is. Why is the decission for correct PythonService exe made on the substring "_d"? This is not very save, I think. Can anybody explain this? An easy workaround is to avoid the substring "_d" in the path to the Python script that should be installed as PythonService. But is it realy intended to forbid "_d" substrings in paths for PythonServices when we don't want to run in PythonService_d.exe? How can this be ensured in real world? Maybe there should be another criteria for the decision which PythonService exe is taken. Regards, Wolfgang ---------------------------------------------------------------------------- _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20050827/df70eb80/attachment-0001.htm From pylist at gnulinux.net Sat Aug 27 23:31:29 2005 From: pylist at gnulinux.net (pylist@gnulinux.net) Date: Sat, 27 Aug 2005 14:31:29 -0700 Subject: [python-win32] More COM Problems Message-ID: <20050827213138.E530E1E4003@bag.python.org> I still can't seem to get this to work correctly. Here is the code I am testing with: --- import win32com.client from win32com.client import gencache, Dispatch import os, sys from win32com.shell import shell import win32com.client.dynamic print "Creating late-bound Optix object" xl = win32com.client.dynamic.Dispatch("Optix.Application") print "The Optix object is", `xl` gencache.EnsureModule('{4BD66BC4-4AA0-11CF-A13A-00A024140CAD}', 0, 1, 2) optix = Dispatch("Optix.Application") print optix sys.exit(0) --- The output is: Creating late-bound Optix object The Optix object is The actual above gencache statement was not copied from the makepy utility as it could not find Optix.Application (or the classid) so I just ran it on another object and replaced it's classid with Optix's classid. I have noticed that Optix.Application is not in the TypeLib list inside of makepy utility though it does show up under all onjects in MS's OLE Browser. Another odd thing is that I can use Optix.Application in python (to some degree) but can't use it for what I need sense makepy/gencache doesn't seem to make anything. Please Help! :-) Steve Milner From rwupole at msn.com Sun Aug 28 12:14:59 2005 From: rwupole at msn.com (Roger Upole) Date: Sun, 28 Aug 2005 06:14:59 -0400 Subject: [python-win32] Re: Problem with COM/ADO using SQL Stored Procedure with OUTPUT parameter Message-ID: I don't have a Sql Server to work with, but I can get an Oracle stored procedure to return an output parameter with your code. Will Sql server let you select a procedure result ? In other words, could you use something like 'select log_item(?)' to return the result in a record set ? hth Roger Simon Bayling wrote: > Hello, > > I am unable to get the value of an OUTPUT parameter from a SQL > Server stored procedure - but only when accessing it with ADO using > Python and COM. I also can't find any good Google answers on the topic > (mostly, a post by one Steve Holden who had the same problem, and that > was left unresolved). > > As it seems to be a problem between PyWin32/COM and ADO, rather than > with SQL or ADO, and I have seen COM/ADO posts in this archive, I > thought I would try here next. Can any of you suggest anything, please? > > SQL Stored Procedure: > > CREATE PROCEDURE [dbo].[log_item] > @name varchar(150), @row_id int OUTPUT > AS > > BEGIN > INSERT INTO my_log VALUES (@name, GETDATE(), NULL) > SELECT @row_id = SCOPE_IDENTITY() > END > > This works in the SQL Query Analyzer: > > declare @row_id int > exec log_item "abcd", @row_id output > select @row_id > > > 1146 > > This also works from VBScript using code adapted from step 4 here: > http://authors.aspalliance.com/stevesmith/articles/sprocs.asp > > I can create a command, add two parameters, execute the command, and get > a valid value returned in the second parameter. > > > I can't get it to work from Python. Literal translations of the VBScript > return None. The stored procedure is being called, rows are inserted > into the database, but the value isn't getting back to my Python script. > The Simplest example I can create that demonstrates the problem is: > > from win32com.client import Dispatch, constants > > conn = Dispatch("ADODB.Connection") > conn.ConnectionString = "Provider=SQLOLEDB.1;Data > Source=server;uid=user;pwd=pass;database=test" > conn.Open() > > cmd = Dispatch('ADODB.Command') > cmd.ActiveConnection = conn > cmd.CommandText = "log_item" > cmd.CommandType = 4 # =adCmdStoredProc > > param1 = cmd.CreateParameter('@name', 200, 1, 150) # adVarChar, > adParamInput, size > param1.Value = "abcd" > cmd.Parameters.Append(param1) > > row_param = cmd.CreateParameter('@row_id', 3, 2) # adInteger, > adParamOutput > cmd.Parameters.Append(row_param) > > result = cmd.Execute() > > print row_param.Name, row_param.Value > row_id = cmd.Parameters.Item("@row_id") > print "row_id: ", row_id, "Value: ", row_id.Value > > > > It just prints "None" afterwards. > I have seen suggestions to try setting cmd.Prepared = True, and this has > no apparent effect. > I have tried changing it to be an InputOutput parameter, and sending a > value in. This time, I just get the same value out again. > I have checked with cmd.Parameters.Refresh, and that tells me the stored > procedure needs the two parameters I am expecting. It doesn't make any > difference to whether it works or not though. > > (Oh, and Windows XP, Python 2.4.1, PythonWin build 204, and I have run > MakePy on Microsoft ActiveX Data Objects 2.8) > > I'm now quite stumped, and would appreciate any further suggestions > before I give up and resort to a cursor and run "insert into" then > "select max(row_id) from" to get the same effect. > > Cheers, > Simon. > > > This email originates from IT Group UK Limited. > > With subsidiary companies: > > Rockford IT Limited > Rockford Electronics Limited > > Registered Office: > 2A New Street > Newport > Shropshire > TF10 7AX > UK > > Company Registered in England: 4263503 > > Tel: 01952 812 290 (Technical Centre) > Tel: 0871 871 2778 (Head Office) From jpaulofarias at gmail.com Sun Aug 28 15:56:59 2005 From: jpaulofarias at gmail.com (=?ISO-8859-1?Q?Jo=E3o_Paulo_Fernandes_Farias?=) Date: Sun, 28 Aug 2005 10:56:59 -0300 Subject: [python-win32] Using IE embeded in a PyGTK application Message-ID: Hi! This is my first message to this list. ;-) I would like to know if it is possible to embed IE into a PyGTK application, or Mozilla. All I want is a webbrowser in my application which I can control. I think it should be possible with COM, but I don't know how to do it. Thanks, -- Jo?o Paulo Farias jpaulofarias at gmail.com Python/C/C++ Developer From troy at studyshare.net Mon Aug 29 14:59:05 2005 From: troy at studyshare.net (Troy Farrell) Date: Mon, 29 Aug 2005 07:59:05 -0500 (CDT) Subject: [python-win32] win32com: HTTP Post with WebBrowser.Navigate() In-Reply-To: <54691.69.151.18.34.1125084577.squirrel@esft.net> References: <43307.69.151.18.34.1125077632.squirrel@esft.net> <54691.69.151.18.34.1125084577.squirrel@esft.net> Message-ID: <18543.69.151.18.34.1125320345.squirrel@esft.net> >Try PostData=buffer(Data). > > hth > Roger Roger, this is exactly the solution I needed. Thanks! For future reference, the working code is below: ---Begin Python Code--- import win32com.client # Prepare Internet Explorer ie = win32com.client.Dispatch( "InternetExplorer.Application.1" ) URL = "http://server/cgi-bin/test.sh" Flags = 0 TargetFrame = "" Data = "this=that&test=big%20success" PostData = buffer( Data ) Headers = "Content-Type: application/x-www-form-urlencoded\r\n" # show it to the user ie.Visible = True ie.Navigate( URL, Flags, TargetFrame, PostData, Headers ) ---End Python Code--- From leske at online.de Tue Aug 30 11:03:56 2005 From: leske at online.de (Christophe Leske) Date: Tue, 30 Aug 2005 11:03:56 +0200 Subject: [python-win32] win32com, pythoncom In-Reply-To: <18543.69.151.18.34.1125320345.squirrel@esft.net> References: <43307.69.151.18.34.1125077632.squirrel@esft.net> <54691.69.151.18.34.1125084577.squirrel@esft.net> <18543.69.151.18.34.1125320345.squirrel@esft.net> Message-ID: <431420FC.5070400@online.de> ok, so i wade through all the available documentation about this, but didn't find anything. Does anyone know how one is supposed to implement an interface in PythonCom, or how to acquire one which is NOT immediately available from the control? What i am after is a sample on how an interface which will be passed to another control is actually being implemented in Pythoncom. Since the interface is passed on to the other application/control/whatever, we need to pass something on - a pointer probably. How is this actually done? What about "standard" interfaces, like IUnknown, IDispatch, and so on, are these automatically provided by PythonCom? And how about the other way round? I got an activeX control here, which i can wrap using MakePy. I got a wrapper class for it, but i cannot get to the Interfaces i am supposed to acquire for the programming. I get to the Interfaces in order to register my control with the application, but then i need to get to OTHER interfaces in order to continue my work. Yet there is no such wrapped method or way to get to them, i already wade through the generated class. If anyone wants to check out what i am talking about, get yourself the Google Desktop 2.0 SDK, and see the developer's forum on the site. I can register my own, pythonmade control by the means of: reg = gds.GoogleDesktopRegistrar() compDesc = ["Title",TITLE, "Description",DESCRIPTION, "Icon",GDS_ICON] registration = reg.StartComponentRegistration(MYGUID, compDesc) registrar_progid="GoogleDesktop.DisplayPluginRegistration" registration=reg.GetRegistrationInterface(registrar_progid); registration.RegisterPlugin(MYGUID, 0) reg.FinishComponentRegistration(); Works fine. But then what? Meaning, where is the flow of the application going? I guess that it tries to acquire an interface from my control, so i need to implement something for this - but what? A class? A method? How do i pass the interface on? Thanks for any insights, Christophe Leske