From johann.abraham at gmail.com Mon Sep 4 23:19:04 2006 From: johann.abraham at gmail.com (Johann Abraham) Date: Mon, 4 Sep 2006 14:19:04 -0700 Subject: [python-win32] Exchange event Message-ID: <9a7a0cc50609041419w25f7524bib5bf3d39dfd03bd3@mail.gmail.com> I wrote a small application for an exchange server to catch asynchronous save email invents on a particular exchange inbox. Everything was working fine until a co-working pointed out that if two emails are sent to the inbox very quickly in succession (ie. automated), the application doesn't process the first email. I know the email event is caught because the Url prints properly, but none of the Message Object data will print out. I've included my OnSave function below and an example of the trace collecter output, as you can see in the trace collecter output self.InEmail.From doesn't print out the correct "jabraham at kelsan.com" . I've spent a few days on this already so if anybody knows what I'm doing wrong, I'd really appreciate your help. Johann The process is: class AutoPilot: _public_methods_ = IExStoreSyncEvents_methods _com_interfaces_ = ['IExStoreAsyncEvents'] _reg_clsid_ = "{D7CDBFB7-7B49-4EA4-9F8E-47152ED86991}" _reg_progid_ = "AutoPilot" _reg_desc_ = "QCM AutoPilot Response System" # IExStoreSyncEvents interfaces def OnSave(self, pEventInfo, strUrl, lFlags): 'Called by a store when an item is saved.' self.ActionRequired = 'None' self.Confirmation = 'No' print strUrl self.InEmail = Dispatch("CDO.Message") self.InEmail.DataSource.Open(strUrl,None,0x1,-1,0x800000,"","") print '****From' print self.InEmail.From print '******' The trace collecter shows: Object with win32trace dispatcher created (object=None) in ._QueryInterface_ with unsupported IID IMarshal ({00000003-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID {0000001B-0000-0000-C000-000000000046} ({0000001B-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID IStdMarshalInfo ({00000018-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID IExternalConnection ({00000019-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID {4C1E39E1-E3E3-4296-AA86-EC938D896E92} ({4C1E39E1-E3E3-4296-AA86-EC938D896E92}) Object with win32trace dispatcher created (object=None) in ._QueryInterface_ with unsupported IID IMarshal ({00000003-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID {0000001B-0000-0000-C000-000000000046} ({0000001B-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID IStdMarshalInfo ({00000018-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID IExternalConnection ({00000019-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID {4C1E39E1-E3E3-4296-AA86-EC938D896E92} ({4C1E39E1-E3E3-4296-AA86-EC938D896E92}) in ._QueryInterface_ with unsupported IID {1C733A30-2A1C-11CE-ADE5-00AA0044773D} ({1C733A30-2A1C-11CE-ADE5-00AA0044773D}) file://./backofficestorage/kelsan.com/MBX/qcm-autopilot/Inbox/none-21.EML in ._QueryInterface_ with unsupported IID {1C733A30-2A1C-11CE-ADE5-00AA0044773D} ({1C733A30-2A1C-11CE-ADE5-00AA0044773D}) file://./backofficestorage/kelsan.com/MBX/qcm-autopilot/Inbox/none-22.EML ****From ****** ****From "jabraham at kelsan.com" ****** -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060904/30c1fef3/attachment.html From mhammond at skippinet.com.au Tue Sep 5 05:44:14 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 5 Sep 2006 13:44:14 +1000 Subject: [python-win32] Exchange event In-Reply-To: <9a7a0cc50609041419w25f7524bib5bf3d39dfd03bd3@mail.gmail.com> Message-ID: <27c901c6d09d$8e9b40a0$050a0a0a@enfoldsystems.local> The only thing I can suggest is to ensure that both notifications come on the same thread. If 2 different threads call OnSave on the same object, then self.InEmail will not be reliable (although it still isn't clear how that would cause an empty subject). From your code, it seems storing InEmail in self isn't necessary anyway... Otherwise, try searching outside the Python universe - you may find the problem described and explained by someone using the exact same technique but using a different language. Mark -----Original Message----- From: python-win32-bounces+mhammond=keypoint.com.au at python.org [mailto:python-win32-bounces+mhammond=keypoint.com.au at python.org]On Behalf Of Johann Abraham Sent: Tuesday, 5 September 2006 7:19 AM To: python-win32 Subject: [python-win32] Exchange event I wrote a small application for an exchange server to catch asynchronous save email invents on a particular exchange inbox. Everything was working fine until a co-working pointed out that if two emails are sent to the inbox very quickly in succession (ie. automated), the application doesn't process the first email. I know the email event is caught because the Url prints properly, but none of the Message Object data will print out. I've included my OnSave function below and an example of the trace collecter output, as you can see in the trace collecter output self.InEmail.From doesn't print out the correct "jabraham at kelsan.com" . I've spent a few days on this already so if anybody knows what I'm doing wrong, I'd really appreciate your help. Johann The process is: class AutoPilot: _public_methods_ = IExStoreSyncEvents_methods _com_interfaces_ = ['IExStoreAsyncEvents'] _reg_clsid_ = "{D7CDBFB7-7B49-4EA4-9F8E-47152ED86991}" _reg_progid_ = "AutoPilot" _reg_desc_ = "QCM AutoPilot Response System" # IExStoreSyncEvents interfaces def OnSave(self, pEventInfo, strUrl, lFlags): 'Called by a store when an item is saved.' self.ActionRequired = 'None' self.Confirmation = 'No' print strUrl self.InEmail = Dispatch("CDO.Message ") self.InEmail.DataSource.Open(strUrl,None,0x1,-1,0x800000,"","") print '****From' print self.InEmail.From print '******' The trace collecter shows: Object with win32trace dispatcher created (object=None) in ._QueryInterface_ with unsupported IID IMarshal ({00000003-0000-0000-C000-000000000046}) in < emailFramework.AutoPilot instance at 0x00A5F0D0>._QueryInterface_ with unsupported IID {0000001B-0000-0000-C000-000000000046} ({0000001B-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID IStdMarshalInfo ({00000018-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID IExternalConnection ({00000019-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID {4C1E39E1-E3E3-4296-AA86-EC938D896E92} ({4C1E39E1-E3E3-4296-AA86-EC938D896E92}) Object with win32trace dispatcher created (object=None) in ._QueryInterface_ with unsupported IID IMarshal ({00000003-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID {0000001B-0000-0000-C000-000000000046} ({0000001B-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID IStdMarshalInfo ({00000018-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID IExternalConnection ({00000019-0000-0000-C000-000000000046}) in ._QueryInterface_ with unsupported IID {4C1E39E1-E3E3-4296-AA86-EC938D896E92} ({4C1E39E1-E3E3-4296-AA86-EC938D896E92}) in ._QueryInterface_ with unsupported IID {1C733A30-2A1C-11CE-ADE5-00AA0044773D} ({1C733A30-2A1C-11CE-ADE5-00AA0044773D}) file://./backofficestorage/kelsan.com/MBX/qcm-autopilot/Inbox/none- 21.EML in ._QueryInterface_ with unsupported IID {1C733A30-2A1C-11CE-ADE5-00AA0044773D} ({1C733A30-2A1C-11CE-ADE5-00AA0044773D}) file://./backofficestorage/kelsan.com/MBX/qcm-autopilot/Inbox/none- 22.EML ****From ****** ****From "jabraham at kelsan.com" ****** -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060905/a0a64396/attachment.html From Matthias.Wolf at al-lighting.com Thu Sep 7 15:54:40 2006 From: Matthias.Wolf at al-lighting.com (Wolf, Matthias ALRT/ELD) Date: Thu, 7 Sep 2006 15:54:40 +0200 Subject: [python-win32] win32net Message-ID: <7ED3CA664474C84891E0DD86162C70F20120B4C0@dereu1nexc3.al-lighting.com> Hallo, I try to print every member of a windows doamin-group, the username as well as the group name. But I just receive the usernames and no groupnames, where is my fault? Here is a small codesnip from a large script of attemps. codesnip: ################################################################### import win32net dict = win32net.NetGroupGetUsers(r'\\domain.com', 'GROUP', 1) for line in dict[0]: print line ######################################################################## #### Thanks a lot of any hint, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060907/3f381f4d/attachment.htm From timr at probo.com Thu Sep 7 20:05:49 2006 From: timr at probo.com (Tim Roberts) Date: Thu, 07 Sep 2006 11:05:49 -0700 Subject: [python-win32] win32net In-Reply-To: <7ED3CA664474C84891E0DD86162C70F20120B4C0@dereu1nexc3.al-lighting.com> References: <7ED3CA664474C84891E0DD86162C70F20120B4C0@dereu1nexc3.al-lighting.com> Message-ID: <45005F7D.90705@probo.com> Wolf, Matthias ALRT/ELD wrote: > Hallo, > > I try to print every member of a windows doamin-group, the username as > well as the group > name. But I just receive the usernames and no groupnames, where is my > fault? > > Here is a small codesnip from a large script of attemps. > > > codesnip: > ################################################################### > > import win32net > > dict = win32net.NetGroupGetUsers(r/'\\domain.com'/,/ 'GROUP'/, 1) > for line in dict[0]: > print line > > ############################################################################ > > I'm not sure what you were expecting. That request asks for all of the users in group "GROUP". The group name is "GROUP", because that's what you specified. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From querdenker at mtsi.de Fri Sep 8 00:29:04 2006 From: querdenker at mtsi.de (querdenker) Date: Fri, 08 Sep 2006 00:29:04 +0200 Subject: [python-win32] win32net In-Reply-To: <7ED3CA664474C84891E0DD86162C70F20120B4C0@dereu1nexc3.al-lighting.com> References: <7ED3CA664474C84891E0DD86162C70F20120B4C0@dereu1nexc3.al-lighting.com> Message-ID: <45009D30.309@mtsi.de> Wolf, Matthias ALRT/ELD wrote: > Hallo, > > I try to print every member of a windows doamin-group, the username as > well as the group > name. But I just receive the usernames and no groupnames, where is my > fault? > > Here is a small codesnip from a large script of attemps. > > > codesnip: > ################################################################### > > import win32net > > dict = win32net.NetGroupGetUsers(r/'\\domain.com'/,/ 'GROUP'/, 1) > for line in dict[0]: > print line > > ############################################################################ > > > > Thanks a lot of any hint, Matthias > > If you can hold your feets until tomorrow (CEST) i'll post an example when i am back at work. I have just finished a script which does exactly that part in addition to some more things Marcus syl, From mhammond at skippinet.com.au Fri Sep 8 08:22:58 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 8 Sep 2006 16:22:58 +1000 Subject: [python-win32] win32net In-Reply-To: <7ED3CA664474C84891E0DD86162C70F20120B4C0@dereu1nexc3.al-lighting.com> Message-ID: <33bf01c6d30f$3b5da1c0$050a0a0a@enfoldsystems.local> Try something like: >>> import win32net >>> win32net.NetGroupGetUsers(win32net.NetGetAnyDCName(), 'domain users', 1) Mark -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Wolf, Matthias ALRT/ELD Sent: Thursday, 7 September 2006 11:55 PM To: python-win32 at python.org Subject: [python-win32] win32net Hallo, I try to print every member of a windows doamin-group, the username as well as the group name. But I just receive the usernames and no groupnames, where is my fault? Here is a small codesnip from a large script of attemps. codesnip: ################################################################### import win32net dict = win32net.NetGroupGetUsers(r'\\domain.com', 'GROUP', 1) for line in dict[0]: print line ############################################################################ Thanks a lot of any hint, Matthias -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 4044 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20060908/1d770999/attachment.bin From timr at probo.com Fri Sep 8 18:27:40 2006 From: timr at probo.com (Tim Roberts) Date: Fri, 08 Sep 2006 09:27:40 -0700 Subject: [python-win32] win32net In-Reply-To: <7ED3CA664474C84891E0DD86162C70F20120B4C3@dereu1nexc3.al-lighting.com> References: <7ED3CA664474C84891E0DD86162C70F20120B4C3@dereu1nexc3.al-lighting.com> Message-ID: <450199FC.3080406@probo.com> Wolf, Matthias ALRT/ELD wrote: >Thanks for your answer! > >You are right, but in the group 'GROUP' are users and groups and I want to receive both. Probably I need something like "win32net.NetGroupGetGroups" instead of "win32net.NetGroupGetUsers". Is there any possible way to realise this? > > According to the MSDN documentation, NetGroupGetUsers is used to list the members of a "global group", and a "global group" can only contain domain users. It cannot contain other groups. Local groups can contain other groups, but you use NetLocalGroupGetMembers to examine those. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From robin at reportlab.com Fri Sep 8 18:49:42 2006 From: robin at reportlab.com (Robin Becker) Date: Fri, 08 Sep 2006 17:49:42 +0100 Subject: [python-win32] isapi + django Message-ID: <45019F26.70203@chamonix.reportlab.co.uk> I thought I'd check here in case anyone has already connected django to IIS. I tried the PyISAPIe, but it doesn't do what django needs and I guess I should have looked around at win32 before doing that. It seems the isapi stuff will do what I want and there's already a model of mapping the ISAPI stuff to a python dispatcher at http://moinmoin.wikiwikiweb.de/MoinMoin_ISAPI Does anyone know if that works as advertised? I'm really not familiar with ISAPI terminology, but I can sort of follow that program. Am I right in thinking that the install phase somehow creates the dll etc etc? -- Robin Becker From torerik81 at gmail.com Fri Sep 8 18:58:44 2006 From: torerik81 at gmail.com (=?ISO-8859-1?Q?Tor_Erik_S=F8nvisen?=) Date: Fri, 08 Sep 2006 18:58:44 +0200 Subject: [python-win32] Get CPU usage of single process in Windows Message-ID: <4501A144.9010900@gmail.com> Hi, This should be possible as Taskmanager tracks CPU usage for every process... Anyone know how it can be done? regards From sidnei at enfoldsystems.com Fri Sep 8 19:23:23 2006 From: sidnei at enfoldsystems.com (Sidnei da Silva) Date: Fri, 8 Sep 2006 14:23:23 -0300 Subject: [python-win32] isapi + django In-Reply-To: <45019F26.70203@chamonix.reportlab.co.uk> References: <45019F26.70203@chamonix.reportlab.co.uk> Message-ID: <20060908172323.GX9622@cotia> On Fri, Sep 08, 2006 at 05:49:42PM +0100, Robin Becker wrote: | I thought I'd check here in case anyone has already connected django to IIS. You could try http://isapi-wsgi.python-hosting.com/ if django can be run as a WSGI app (which I believe it can). -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 From primmer at google.com Fri Sep 8 19:37:31 2006 From: primmer at google.com (David Primmer) Date: Fri, 08 Sep 2006 10:37:31 -0700 Subject: [python-win32] isapi + django In-Reply-To: <20060908172323.GX9622@cotia> References: <45019F26.70203@chamonix.reportlab.co.uk> <20060908172323.GX9622@cotia> Message-ID: <4501AA5B.4060203@google.com> I spent a lot of time working on this recently. http://pylonshq.com/project/pylonshq/wiki/ServePylonsWithIIS is uses isapi_wsgi davep Sidnei da Silva wrote: > On Fri, Sep 08, 2006 at 05:49:42PM +0100, Robin Becker wrote: > | I thought I'd check here in case anyone has already connected django to IIS. > > You could try http://isapi-wsgi.python-hosting.com/ if django can be > run as a WSGI app (which I believe it can). > From timr at probo.com Fri Sep 8 19:53:54 2006 From: timr at probo.com (Tim Roberts) Date: Fri, 08 Sep 2006 10:53:54 -0700 Subject: [python-win32] Get CPU usage of single process in Windows In-Reply-To: <4501A144.9010900@gmail.com> References: <4501A144.9010900@gmail.com> Message-ID: <4501AE32.9030302@probo.com> Tor Erik S?nvisen wrote: >Hi, > >This should be possible as Taskmanager tracks CPU usage for every >process... Anyone know how it can be done? > > TaskManager and perfmon get this information from the Win32 performance counters. Unfortunately, the performance counter API is a bit verbose. Python-Win32 does include a wrapper library, win32pdh, but I admit I've never used it. Still, that should give you enough Google search terms to find the information... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mhammond at skippinet.com.au Sat Sep 9 02:36:41 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 9 Sep 2006 10:36:41 +1000 Subject: [python-win32] isapi + django In-Reply-To: <45019F26.70203@chamonix.reportlab.co.uk> Message-ID: <389301c6d3a8$05659e30$050a0a0a@enfoldsystems.local> Hi Robin, > I thought I'd check here in case anyone has already connected > django to IIS. > > > I tried the PyISAPIe, but it doesn't do what django needs and > I guess I should > have looked around at win32 before doing that. > > It seems the isapi stuff will do what I want and there's > already a model of > mapping the ISAPI stuff to a python dispatcher at > > http://moinmoin.wikiwikiweb.de/MoinMoin_ISAPI > > Does anyone know if that works as advertised? It should. The isapi extensions in pywin32 are quite stable and very much alive. I'd be happy to help address any ISAPI specific issues that are found. > I'm really not > familiar with ISAPI > terminology, but I can sort of follow that program. Am I > right in thinking that > the install phase somehow creates the dll etc etc? Yeah - pywin32 comes with an ISAPI 'stub'. When a specific extension is installed, that stub is copied and delegates to a Python module with the same name. In the pywin32 isapi/samples directory, you will find a trivial little 'proxy' application you can experiment with. Mark. From robin at reportlab.com Mon Sep 11 13:03:26 2006 From: robin at reportlab.com (Robin Becker) Date: Mon, 11 Sep 2006 12:03:26 +0100 Subject: [python-win32] isapi + IIS 6 In-Reply-To: <45019F26.70203@chamonix.reportlab.co.uk> References: <45019F26.70203@chamonix.reportlab.co.uk> Message-ID: <4505427E.9050802@chamonix.reportlab.co.uk> Robin Becker wrote: > I thought I'd check here in case anyone has already connected django to IIS. > > Well I thought I'd give the isapi module a twirl as it seemed it would be easy, but with IIS 6 running on a virtual Win Server 2003 Web edition I fell at the first hurdle. The hosted environment is as standard as I can make it (apart from being on a virtual machine). Did the advanced.py install dance and see that a virtual folder has appeared and that there's a new application in the extension pool. I recycled the applications and restarted the server, but no matter I cannot get the right page to appear at http://localhost/AdvancedPythonSample/ Just in case I checked and made sure that the IWAM_XXX and IUSR_XXX accounts for the machine both had read and execute permissions, but am unable to get the expected result. As an experiment I tried the same thing on another machine with IIS 5.1, but there I get the following error when running the install C:\Python\Lib\site-packages\isapi\samples>advanced.py install Configured Virtual Directory: AdvancedPythonSample Traceback (most recent call last): File "C:\Python\Lib\site-packages\isapi\samples\advanced.py", line 174, in ? custom_arg_handlers = custom_arg_handlers) File "C:\Python\Lib\site-packages\isapi\install.py", line 556, in HandleCommandLine InstallModule(conf_module_name, params, options) File "C:\Python\Lib\site-packages\isapi\install.py", line 478, in InstallModule Install(params, options) File "C:\Python\Lib\site-packages\isapi\install.py", line 390, in Install AddExtensionFiles(params, options) File "C:\Python\Lib\site-packages\isapi\install.py", line 321, in AddExtensionFiles options) File "C:\Python\Lib\site-packages\isapi\install.py", line 301, in _AddExtensionFile ob.AddExtensionFile(module, File "C:\Python\Lib\site-packages\win32com\client\dynamic.py", line 489, in __getattr__ raise AttributeError, "%s.%s" % (self._username_, attr) AttributeError: IIS://LocalHost/W3SVC.AddExtensionFile despite this it seems that the application produces a page. However, no matter what I try I cannot get the page to say anything other than "This module has been imported 0 times". removeing the pyc's and or editing the .py seemed to have no effect. Anyone had better luck with IIS 6? -- Robin Becker From primmer at google.com Mon Sep 11 19:35:01 2006 From: primmer at google.com (David Primmer) Date: Mon, 11 Sep 2006 10:35:01 -0700 Subject: [python-win32] isapi + IIS 6 In-Reply-To: <4505427E.9050802@chamonix.reportlab.co.uk> References: <45019F26.70203@chamonix.reportlab.co.uk> <4505427E.9050802@chamonix.reportlab.co.uk> Message-ID: <45059E45.90706@google.com> Robin Becker wrote: > Robin Becker wrote: >> I thought I'd check here in case anyone has already connected django to IIS. > > despite this it seems that the application produces a page. However, no matter > what I try I cannot get the page to say anything other than "This module has > been imported 0 times". removeing the pyc's and or editing the .py seemed to > have no effect. > > Anyone had better luck with IIS 6? The message above means that the app is working. The page reload counter script does not work but the ISAPI dll is displaying a page. Don't know about your other problems. I've been able to get IIS + ISAPI to work in IIS6 on Win2k3R2. davep From cmenge at gmail.com Mon Sep 11 21:24:19 2006 From: cmenge at gmail.com (Christian Menge) Date: Mon, 11 Sep 2006 15:24:19 -0400 Subject: [python-win32] Adobe Flash MX & Python Message-ID: Hey Guys, We have been C developers for years and have decided to try a couple projects using Python. I'm very excited about the potential gains we mayl achieve using this language. We have a couple .SWF files that I want to play with a Python application. I've installed Python for Windows and did some reading about the COM controls. I've been able to import a Flash COM object but not having much success making the movie PLAY. I also found an article detailing how to use wxPython with Flash...but I was wondering if it was possible to NOT use wxPython. Are there any samples that I could use to get my Flash movie up and running? Cheers! Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060911/ca1858b1/attachment.htm From robin at reportlab.com Mon Sep 11 21:54:46 2006 From: robin at reportlab.com (Robin Becker) Date: Mon, 11 Sep 2006 19:54:46 +0000 Subject: [python-win32] isapi + IIS 6 In-Reply-To: <45059E45.90706@google.com> References: <45019F26.70203@chamonix.reportlab.co.uk> <4505427E.9050802@chamonix.reportlab.co.uk> <45059E45.90706@google.com> Message-ID: <4505BF06.1040200@jessikat.plus.net> David Primmer wrote: > Robin Becker wrote: >> Robin Becker wrote: >>> I thought I'd check here in case anyone has already connected django to IIS. >> despite this it seems that the application produces a page. However, no matter >> what I try I cannot get the page to say anything other than "This module has >> been imported 0 times". removeing the pyc's and or editing the .py seemed to >> have no effect. >> >> Anyone had better luck with IIS 6? > > The message above means that the app is working. The page reload counter > script does not work but the ISAPI dll is displaying a page. > > Don't know about your other problems. I've been able to get IIS + ISAPI > to work in IIS6 on Win2k3R2. > > davep ..... Thanks Dave, I think I figured out the problem with II6. There's an additional tab in IIS mmc called Extensions and I had to add the _advanced.dll there and enable it before the AdvancedPythonSample folder would work. -- Robin Becker From timr at probo.com Mon Sep 11 21:55:14 2006 From: timr at probo.com (Tim Roberts) Date: Mon, 11 Sep 2006 12:55:14 -0700 Subject: [python-win32] Adobe Flash MX & Python In-Reply-To: References: Message-ID: <4505BF22.5070800@probo.com> Christian Menge wrote: > Hey Guys, > > We have been C developers for years and have decided to try a couple > projects using Python. I'm very excited about the potential gains we > mayl achieve using this language. > > We have a couple .SWF files that I want to play with a Python > application. I've installed Python for Windows and did some reading > about the COM controls. I've been able to import a Flash COM object > but not having much success making the movie PLAY. I also found an > article detailing how to use wxPython with Flash...but I was wondering > if it was possible to NOT use wxPython. > > Are there any samples that I could use to get my Flash movie up and > running? Flash needs a window to play in. wxPython is probably the easiest way to get that window, but you can also create windows using win32ui and PythonWin. PythonWin is a relatively thin layer around MFC. If you've done MFC for years, that might feel more comfortable. There are samples in the python-win32 distribution. However, in the long term, I suspect you'd be happier with wxPython... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From wattana at asiabiznetworks.com Tue Sep 12 03:50:21 2006 From: wattana at asiabiznetworks.com (Wattana) Date: Tue, 12 Sep 2006 08:50:21 +0700 Subject: [python-win32] python with SAP CTI Message-ID: <000501c6d60d$cf534e60$cf00000a@WATTANA> Dear All, In a couple of year i have been involve with many programming language. Finally i found Python the Batteries included. I love it. I finished many programming with Python. For this moment i have to do the integration on SAP, SAPPhone with Telephony Hardware (CTI). If you have any exprerience with RFC on SAP please help me. Thank you Wattana -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060912/96587b0b/attachment.htm From cmenge at gmail.com Tue Sep 12 04:49:07 2006 From: cmenge at gmail.com (Christian Menge) Date: Mon, 11 Sep 2006 22:49:07 -0400 Subject: [python-win32] IMPORT path Message-ID: Guys, I have a simple script that will create a window and print "Hello World". What I want to do is import this script into another script which control may program. The problem I'm having is with the Import path. When I move my "Hello World" script away from the development directories the path gets lost and Python can not find the modules. As a C++ developer I would simply compile my project statically....which includes all of the libraries in one place/package. How do I do this with Python? Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060911/26ad6390/attachment.html From bwmetz at att.com Tue Sep 12 05:06:39 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Mon, 11 Sep 2006 22:06:39 -0500 Subject: [python-win32] IMPORT path In-Reply-To: Message-ID: <01D5341D04A2E64AB9B34576904733670270C566@OCCLUST01EVS1.ugd.att.com> For argument's sake, let's say your new code is saved as HelloWorld.py in a directory named modules, which is a sub-directory under your main project files directory. Some may disagree, but using a single directory like this for all your custom modules is a good method. import sys sys.path.append("./modules") import HelloWorld Bobby -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Christian Menge Sent: Monday, September 11, 2006 7:49 PM To: python-win32 at python.org Subject: [python-win32] IMPORT path Guys, I have a simple script that will create a window and print "Hello World". What I want to do is import this script into another script which control may program. The problem I'm having is with the Import path. When I move my "Hello World" script away from the development directories the path gets lost and Python can not find the modules. As a C++ developer I would simply compile my project statically....which includes all of the libraries in one place/package. How do I do this with Python? Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060911/cab99eb3/attachment.htm From mhammond at skippinet.com.au Tue Sep 12 06:52:01 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 12 Sep 2006 14:52:01 +1000 Subject: [python-win32] isapi + IIS 6 In-Reply-To: <4505427E.9050802@chamonix.reportlab.co.uk> Message-ID: <41a001c6d627$303bc590$050a0a0a@enfoldsystems.local> > what I try I cannot get the page to say anything other than > "This module has > been imported 0 times". removeing the pyc's and or editing > the .py seemed to > have no effect. This was due to IIS6 providing "unlimited length style" filenames (eg, "\\?\c:\etc") I've recently fixed that in the source here so will be fixed in the next release. In the mean time, you may want to check your sys.path[0] entry - it is likely to also be a path in such a format. Simply ripping the first 4 chars from that path entry should work (and indeed is what my patch does). The AttributeError should have been fixed in pywin32 build 205 - we now catch and ingore that AttributeError, so you may like to upgrade pywin32 versions... Cheers, Mark From robin at reportlab.com Tue Sep 12 11:33:25 2006 From: robin at reportlab.com (Robin Becker) Date: Tue, 12 Sep 2006 10:33:25 +0100 Subject: [python-win32] isapi + IIS 6 In-Reply-To: <41a001c6d627$303bc590$050a0a0a@enfoldsystems.local> References: <41a001c6d627$303bc590$050a0a0a@enfoldsystems.local> Message-ID: <45067EE5.7080603@chamonix.reportlab.co.uk> Mark Hammond wrote: >...... > This was due to IIS6 providing "unlimited length style" filenames (eg, > "\\?\c:\etc") I've recently fixed that in the source here so will be fixed > in the next release. In the mean time, you may want to check your > sys.path[0] entry - it is likely to also be a path in such a format. Simply > ripping the first 4 chars from that path entry should work (and indeed is > what my patch does). > > The AttributeError should have been fixed in pywin32 build 205 - we now > catch and ingore that AttributeError, so you may like to upgrade pywin32 > versions... ....... duh I saw the funny filename in the trace output, but it didn't click. Anyhow, I guess the main problem will be figuring out what to do about the extra "Web Services Extension" tab in IIS 6. Strangely I think that filters work without extra complication, but an extension needs an extra step ie entering and enabling in the WSE list. -- Robin Becker From mhammond at skippinet.com.au Tue Sep 12 15:14:00 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 12 Sep 2006 23:14:00 +1000 Subject: [python-win32] isapi + IIS 6 In-Reply-To: <45067EE5.7080603@chamonix.reportlab.co.uk> Message-ID: <42e001c6d66d$5006cc80$050a0a0a@enfoldsystems.local> > Anyhow, I guess the main problem will be figuring out what to > do about the extra > "Web Services Extension" tab in IIS 6. Strangely I think that > filters work > without extra complication, but an extension needs an extra > step ie entering and > enabling in the WSE list. Can you please try with the latest pywin32? The samples work find for me, and I am regularly using these extensions with IIS6. If you continue to have trouble I'll help dig deeper... Mark. From gagsl-p32 at yahoo.com.ar Tue Sep 12 23:22:50 2006 From: gagsl-p32 at yahoo.com.ar (Gabriel Genellina) Date: Tue, 12 Sep 2006 18:22:50 -0300 Subject: [python-win32] IMPORT path In-Reply-To: References: Message-ID: <7.0.1.0.0.20060912182010.058dc880@yahoo.com.ar> At Monday 11/9/2006 23:49, Christian Menge wrote: >I have a simple script that will create a window and print "Hello >World". What I want to do is import this script into another script >which control may program. The problem I'm having is with the Import >path. When I move my "Hello World" script away from the development >directories the path gets lost and Python can not find the modules. Reading the Python tutorial may help http://docs.python.org/tut/tut.html, specially about packages. Gabriel Genellina Softlab SRL __________________________________________________ Pregunt?. Respond?. Descubr?. Todo lo que quer?as saber, y lo que ni imaginabas, est? en Yahoo! Respuestas (Beta). ?Probalo ya! http://www.yahoo.com.ar/respuestas From kenchanningphd at gmail.com Wed Sep 13 23:10:20 2006 From: kenchanningphd at gmail.com (Ken Channing) Date: Wed, 13 Sep 2006 14:10:20 -0700 Subject: [python-win32] How to implement a COM interface (that is not part of a COM class) Message-ID: Hi -- the COM object I'm working on has a number of methods I am able to use fairly well by following the various win32com examples around. However, one of the methods' arguments takes a callback that "implements an interface" (I'm new to win COM terminology but I think this phrase has a specific context when applied here -- my guess is an 'interface' is similar to a 'template' in C++?). I searched for examples of implementing callbacks such as this one: class ContextEvents(win32com.client.getevents("SAPI.SpSharedRecoContext")): """Called when a word/phrase is successfully recognized - ie it is found in a currently open grammar with a sufficiently high confidence""" def OnRecognition(self, StreamNumber, StreamPosition, RecognitionType, Result): newResult = win32com.client.Dispatch(Result) print "You said: ",newResult.PhraseInfo.GetText() However, in my case, the interface is not associated with any class that I can find, so I can't use DispatchWithEvents or getevents to get an object to subclass from. (When I try to use getevents on the clsid of the interface from the makepy generated file, it returns None) I think the post here outlines a similar problem: http://mail.python.org/pipermail/python-win32/2004-May/001990.html Is there some obvious way to do this that I'm missing? In the VB version of the program I'm trying to re-implement in python, it seems to be able to implement the interface by simply calling "Implements Foo" and subclassing by "Private Sub Foo_OnSomeEvent(..." Thanks for any help! From goodger at python.org Thu Sep 14 21:42:06 2006 From: goodger at python.org (David Goodger) Date: Thu, 14 Sep 2006 15:42:06 -0400 Subject: [python-win32] creating a long-running Python COM server Message-ID: <4335d2c40609141242g30ba0c34tcb8295b581ebdece@mail.gmail.com> I'm trying to figure out how to create a COM server as part of a Python GUI app, such that an Excel client can connect to the *already running* instance of the server in the app. IOW, I want Excel to talk to the existing Python process, and not start a new one. BTW, I know very little about win32com; please excuse any mistakes in terminology. I have a copy of the "Python Programming on Win32" book [1], and searched the web and the python-win32 archives, but I am unable to find the information I need. Any pointers (page nos, URLs, example code)? Thanks. [1] A borrowed copy; I can't get one of my own (Amazon.ca can't find me one). Does anyone know of a new edition any time soon? -- David Goodger From goodger at python.org Thu Sep 14 22:22:13 2006 From: goodger at python.org (David Goodger) Date: Thu, 14 Sep 2006 16:22:13 -0400 Subject: [python-win32] creating a long-running Python COM server In-Reply-To: <4335d2c40609141242g30ba0c34tcb8295b581ebdece@mail.gmail.com> References: <4335d2c40609141242g30ba0c34tcb8295b581ebdece@mail.gmail.com> Message-ID: <4335d2c40609141322j6e23ea0fua747d49751566bfd@mail.gmail.com> I wrote: > I'm trying to figure out how to create a COM server as part of a > Python GUI app, such that an Excel client can connect to the *already > running* instance of the server in the app. IOW, I want Excel to talk > to the existing Python process, and not start a new one. This may clarify my issue. I found this in the VB help: ' Test to see if there is a copy of Microsoft Excel already running. On Error Resume Next ' Getobject function called without the first argument returns a ' reference to an instance of the application. If the application isn't ' running, an error occurs. Set MyXL = Getobject(, "Excel.Application") If Err.Number <> 0 Then ExcelWasNotRunning = True I'd like to do the same thing with my app. How can I register the COM server and/or tell Windows that my application is now running so that I get the same behavior as the above? I don't want an instance of my server class created in a new Python process; I want the existing, running Python process. -- David Goodger From mhammond at skippinet.com.au Fri Sep 15 00:58:25 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 15 Sep 2006 08:58:25 +1000 Subject: [python-win32] creating a long-running Python COM server In-Reply-To: <4335d2c40609141322j6e23ea0fua747d49751566bfd@mail.gmail.com> Message-ID: <4b8701c6d851$4c201780$050a0a0a@enfoldsystems.local> Basically, you must: * Arrange for your process to be started * In your process, create a COM server object - ie, create an object with the _public_methods_ etc attributes, then use win32com.server.wrap to wrap it * Call pythoncom.RegisterActiveObject passing it this object. That should be enough to have GetObject attach to your instance. Mark > -----Original Message----- > From: python-win32-bounces at python.org > [mailto:python-win32-bounces at python.org]On Behalf Of David Goodger > Sent: Friday, 15 September 2006 6:22 AM > To: python-win32 at python.org > Subject: Re: [python-win32] creating a long-running Python COM server > > > I wrote: > > I'm trying to figure out how to create a COM server as part of a > > Python GUI app, such that an Excel client can connect to > the *already > > running* instance of the server in the app. IOW, I want > Excel to talk > > to the existing Python process, and not start a new one. > > This may clarify my issue. I found this in the VB help: > > ' Test to see if there is a copy of Microsoft Excel > already running. > On Error Resume Next > ' Getobject function called without the first argument returns a > ' reference to an instance of the application. If the > application isn't > ' running, an error occurs. > Set MyXL = Getobject(, "Excel.Application") > If Err.Number <> 0 Then ExcelWasNotRunning = True > > I'd like to do the same thing with my app. How can I register the COM > server and/or tell Windows that my application is now running so that > I get the same behavior as the above? I don't want an instance of my > server class created in a new Python process; I want the existing, > running Python process. > > -- > David Goodger > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From rwupole at msn.com Fri Sep 15 05:02:40 2006 From: rwupole at msn.com (Roger Upole) Date: Thu, 14 Sep 2006 23:02:40 -0400 Subject: [python-win32] Re: How to implement a COM interface (that is not part Message-ID: Ken Channing wrote: > Hi -- the COM object I'm working on has a number of methods I am able > to use fairly well by following the various win32com examples around. > > However, one of the methods' arguments takes a callback that > "implements an interface" (I'm new to win COM terminology but I think > this phrase has a specific context when applied here -- my guess is an > 'interface' is similar to a 'template' in C++?). > > I searched for examples of implementing callbacks such as this one: > > class ContextEvents(win32com.client.getevents("SAPI.SpSharedRecoContext")): > """Called when a word/phrase is successfully recognized - > ie it is found in a currently open grammar with a sufficiently high > confidence""" > def OnRecognition(self, StreamNumber, StreamPosition, > RecognitionType, Result): > newResult = win32com.client.Dispatch(Result) > print "You said: ",newResult.PhraseInfo.GetText() > > However, in my case, the interface is not associated with any class > that I can find, > so I can't use DispatchWithEvents or getevents to get an object to > subclass from. (When I try to use getevents on the clsid of the > interface from the makepy generated file, it returns None) > > I think the post here outlines a similar problem: > http://mail.python.org/pipermail/python-win32/2004-May/001990.html > > Is there some obvious way to do this that I'm missing? > In the VB version of the program I'm trying to re-implement in python, > it seems to be able to > implement the interface by simply calling "Implements Foo" and subclassing by > "Private Sub Foo_OnSomeEvent(..." > > Thanks for any help! You should be able to implement it just as you would a small COM server. Basically, your class would need to specify the interface with _com_interfaces_=[iid of Foo] and define an event method. def OnSomeEvent(self,.....): Roger From garthk at gmail.com Fri Sep 15 05:28:45 2006 From: garthk at gmail.com (Garth T Kidd) Date: Fri, 15 Sep 2006 13:28:45 +1000 Subject: [python-win32] iTunes 7 vs Juice: ugly! In-Reply-To: <8aeed5d00609140403g78f6c938ve0bb0608065762b4@mail.gmail.com> References: <8aeed5d00609140403g78f6c938ve0bb0608065762b4@mail.gmail.com> Message-ID: <8aeed5d00609142028o2e7d5f62m76c70df321af1bbb@mail.gmail.com> Ladies and gentlemen of the jury, I throw myself on your mercy. Can anyone help me nut out what happened to the COM interface to iTunes with the iTunes 7 upgrade? iface = "iTunes.Application" iTunes = win32com.client.dynamic.Dispatch(iface) iTunes.Stop() ... used to work just fine. Now we get AttributeError for everything. I'm trying both static and dynamic dispatch, with no success, yet the makepy output shows lots of familiar interfaces. I'd much appreciate ANY help anyone can offer with this one. We don't necessarily have that much in the way of market-share with Juice, but with the size of the market there are still tens of thousands of users I'd prefer not to leave in the lurch... Yours, Garth. From davidnicolson1 at hotmail.com Fri Sep 15 07:08:09 2006 From: davidnicolson1 at hotmail.com (David Nicolson) Date: Fri, 15 Sep 2006 15:08:09 +1000 Subject: [python-win32] iTunes 7 vs Juice: ugly! In-Reply-To: <8aeed5d00609142028o2e7d5f62m76c70df321af1bbb@mail.gmail.com> References: <8aeed5d00609140403g78f6c938ve0bb0608065762b4@mail.gmail.com> <8aeed5d00609142028o2e7d5f62m76c70df321af1bbb@mail.gmail.com> Message-ID: Hi Garth, I've been developing a py2exe app that dispatches a COM object since iTunes 4 and I've seen this problem a bit. I'm not exactly sure what causes it, I think in certain circumstances the iTunes installer can fail to register the type library. Reinstalling iTunes usually solves the problem. It also seems as though win32com and py2exe are more sensitive to this. Dave On 15/09/2006, at 1:28 PM, Garth T Kidd wrote: > Ladies and gentlemen of the jury, I throw myself on your mercy. > > Can anyone help me nut out what happened to the COM interface to > iTunes with the iTunes 7 upgrade? > > iface = "iTunes.Application" > iTunes = win32com.client.dynamic.Dispatch(iface) > iTunes.Stop() > > ... used to work just fine. Now we get AttributeError for everything. > I'm trying both static and dynamic dispatch, with no success, yet the > makepy output shows lots of familiar interfaces. > > I'd much appreciate ANY help anyone can offer with this one. We don't > necessarily have that much in the way of market-share with Juice, but > with the size of the market there are still tens of thousands of users > I'd prefer not to leave in the lurch... > > Yours, > Garth. From DFeiock at ameripath.com Fri Sep 15 16:13:49 2006 From: DFeiock at ameripath.com (Feiock, Dennis) Date: Fri, 15 Sep 2006 09:13:49 -0500 Subject: [python-win32] Change BIOS Settings - Enable WOL Message-ID: <9D4F7EF13ED8B5428EF6DF9FF0EADC55EFDEE7@TXCLMAIL01.ameripath.local> I was wondering if there is a way for Python to access the WOL bios settings on a Win32 system and enable it. Either by directly accessing the information, or using WMI/etc. to process the change. Previously, I thought that direct BIOS access in Windows NT+ could not be done. However, from what appears to be here: http://support2.jp.dell.com/docs/software/smdccu/1.2/ug/dccuusg.htm It looks like Dell at least has worked around that. At the very least, I suppose I could try to detect the Make/Model via WMI and do a system call to a 3rd party app such as DCCU to process the change. I would prefer not to do that though, since it seems that other vendor's solutions such as IBM's (http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-414 72) is not nearly as clean (it requires booting off a floppy and rebooting and such). Any help would be appreciated! - DF -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060915/35b8a002/attachment.htm From tim.golden at viacom-outdoor.co.uk Fri Sep 15 16:45:19 2006 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri, 15 Sep 2006 15:45:19 +0100 Subject: [python-win32] Change BIOS Settings - Enable WOL Message-ID: [Feiock, Dennis] | I was wondering if there is a way for Python to access the | WOL bios settings on a Win32 system and enable it. Either by | directly accessing the information, or using WMI/etc. to | process the change. It's not looking likely with WMI. The Win32_BIOS class offers only a dozen-and-a-half properties and no methods (on my WinXP box). I honestly can't see any solution other than call out to 3rd party routines. I've checked the WMI Google Group http://groups.google.com/group/microsoft.public.win32.programmer.wmi which is usually a good source of info, but there's nothing obvious jumping out. By all means try posting there to see if any of the real WMI experts have any insight. 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 goodger at python.org Fri Sep 15 22:51:46 2006 From: goodger at python.org (David Goodger) Date: Fri, 15 Sep 2006 16:51:46 -0400 Subject: [python-win32] creating a long-running Python COM server In-Reply-To: <4b8701c6d851$4c201780$050a0a0a@enfoldsystems.local> References: <4335d2c40609141322j6e23ea0fua747d49751566bfd@mail.gmail.com> <4b8701c6d851$4c201780$050a0a0a@enfoldsystems.local> Message-ID: <4335d2c40609151351x404ca6a4sf4e1308e100aca41@mail.gmail.com> On 9/14/06, Mark Hammond wrote: > Basically, you must: > * Arrange for your process to be started > * In your process, create a COM server object - ie, create an object with > the _public_methods_ etc attributes, then use win32com.server.wrap to wrap > it > * Call pythoncom.RegisterActiveObject passing it this object. > > That should be enough to have GetObject attach to your instance. Thanks for the clues. I had trouble getting my app to do anything in response to COM messages, but some further digging revealed pythoncom.PumpWaitingMessages, which the event loop could poll or or it could run in a separate thread. I will write this up as a recipe in the Python Cookbook; any comments on my code (attached)? Thanks again! -- David Goodger -------------- next part -------------- A non-text attachment was scrubbed... Name: comtest.py Type: text/x-python Size: 2449 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20060915/6c9f6926/attachment.py From mhammond at skippinet.com.au Sun Sep 17 11:39:41 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 17 Sep 2006 19:39:41 +1000 Subject: [python-win32] creating a long-running Python COM server In-Reply-To: <4335d2c40609151351x404ca6a4sf4e1308e100aca41@mail.gmail.com> Message-ID: <52a501c6da3d$34115850$050a0a0a@enfoldsystems.local> > I will write this up as a recipe in the Python Cookbook; any comments > on my code (attached)? The 'busy loop' looks ugly to my eyes. It can be solved by importing win32gui, then changing the Quit method to: def Quit(self): win32gui.PostQuitMessage(0) and the entire busy loop gets replaced with: pythoncom.PumpMessages() That obviously breaks the 'loops' variable though. I also changed the if __name__ block to: if __name__ == '__main__': register() main() unregister() That way, running it as a script "does the right thing" in a single step. Cheers, Mark From fuzzyman at voidspace.org.uk Tue Sep 19 01:08:14 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 19 Sep 2006 00:08:14 +0100 Subject: [python-win32] Pythonwin Message-ID: <450F26DE.9030109@voidspace.org.uk> Hello all, I'm trying to get Pythonwin working with Movable Python. The first step was to try using a pure Python version of the executable. (Code reproduced below). This appears to work (both for installed Python and Movable Python) - however their are various minor problems I need to resolve. I don't mind maintaining a patched version, but would appreciate some clues. :-) The first issue is that the run script dialog doesn't appear- instead the file open dialog appears, and re-appears when closed. This happens whenever the python version is run - whether from normal Python or Movable Python. I've isolated the problem (well - at least partly) to the 'scriptutils.py' file. It is in the line 'if dlg.DoModal() != win32con.IDOK:' (I've messed up line numbers sorry) in the 'RunScript' function. When dlg.DoModal is called, DlgRunScript.OnBrowse is activated somehow... The Python version of the executable is : import sys import win32ui # importing 'intpyapp' automatically registers an app object. from pywin.framework import intpyapp # Remove this script name from sys.argv, else Pythonwin will try and open it! sys.argv = sys.argv[:-1] # Get the MFC "app" object and boot it up. app = win32ui.GetApp() app.InitInstance() app.Run() app.ExitInstance() All the best, Michael Foord http://www.voidspace.org.uk/python/movpy/ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.12.5/450 - Release Date: 18/09/2006 From mhammond at skippinet.com.au Tue Sep 19 04:33:14 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 19 Sep 2006 12:33:14 +1000 Subject: [python-win32] Pythonwin In-Reply-To: <450F26DE.9030109@voidspace.org.uk> Message-ID: <05a601c6db93$f5bc6d80$050a0a0a@enfoldsystems.local> > The first issue is that the run script dialog doesn't appear- instead > the file open dialog appears, and re-appears when closed. > This happens > whenever the python version is run - whether from normal Python or > Movable Python. I can't repro this - if I start Pythonwin via that script, then click on the 'run' icon in the toolbar, I see the 'run script' dialog correctly shown. Cheers, Mark From derickvn at gmail.com Tue Sep 19 10:16:57 2006 From: derickvn at gmail.com (Derick Van Niekerk) Date: Tue, 19 Sep 2006 10:16:57 +0200 Subject: [python-win32] Module not found weirdness Message-ID: <32dab3890609190116u1bd8f962q20329218566142eb@mail.gmail.com> When I execute the code here http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355593 I get the following traceback: Traceback (most recent call last): File "C:\Documents and Settings\Derick\Desktop\test.py", line 73, in ? frame = TestFrame () File "C:\Documents and Settings\Derick\Desktop\test.py", line 23, in __init__ self.nextWnd = win32clipboard.SetClipboardViewer (self.hwnd) pywintypes.error: (126, 'SetClipboardViewer', 'The specified module could not be found.') Script terminated. I have run dependency walker and found that all the dlls load fine. The other win32clipboard functions work fine as well, like getting and setting the clipboard contents. I have found that SetClipboardViewer ( self.hwnd) should be in user32.dll but I have the same version installed as on my PC at work where the program runs without a problem. The strange thing is that all the other functions I tried work fine, which would indicate that I might be using an old version of some dll - the function might not exist in the module dll I'm using. user32 doesn't seem at fault though since it is the same on both PC's... What could be the problem? Google couldn't teach me anything on this problem This code doesn't work: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355593 But this does - even though it uses the same module: import win32clipboard as w import win32con def getText(): w.OpenClipboard() d=w.GetClipboardData(win32con.CF_TEXT) w.CloseClipboard() return d def setText(aType,aString): w.OpenClipboard() w.EmptyClipboard() w.SetClipboardData(aType,aString) w.CloseClipboard() -d- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060919/cdb7448f/attachment.html From fuzzyman at voidspace.org.uk Tue Sep 19 11:30:33 2006 From: fuzzyman at voidspace.org.uk (Fuzzyman) Date: Tue, 19 Sep 2006 10:30:33 +0100 Subject: [python-win32] Pythonwin In-Reply-To: <05a601c6db93$f5bc6d80$050a0a0a@enfoldsystems.local> References: <05a601c6db93$f5bc6d80$050a0a0a@enfoldsystems.local> Message-ID: <450FB8B9.4060908@voidspace.org.uk> Mark Hammond wrote: >>The first issue is that the run script dialog doesn't appear- instead >>the file open dialog appears, and re-appears when closed. >>This happens >>whenever the python version is run - whether from normal Python or >>Movable Python. >> >> > >I can't repro this - if I start Pythonwin via that script, then click on the >'run' icon in the toolbar, I see the 'run script' dialog correctly shown. > > Curious - I'll try it on another computer. The 'run script' feature definitely doesn't work with Movable Python, but I expect that's because it isn't using 'sys.executable' to find the interpreter. (I suspect it uses the registry to locate the version of Python - but I may be wrong. I expect to have to make a few modifications to Pythonwin.) Thanks for trying this Mark. Michael Foord http://www.voidspace.org.uk/python/index.shtml >Cheers, > >Mark > > > > From gh at gregor-horvath.com Tue Sep 19 13:27:17 2006 From: gh at gregor-horvath.com (Gregor Horvath) Date: Tue, 19 Sep 2006 13:27:17 +0200 Subject: [python-win32] Service: path to .py script Message-ID: <450FD415.10601@gregor-horvath.com> Hi, I have a testservice.py (see below). I installed the service successfully. (via commandlineoption install) The problem is that it runs only when it is in c:\windows\system32 or in the python path. I added the desired path (Y:\) to the PYTHONPATH environment variable for the system account and rebooted. When I start command line python and do a import testservice everything is fine. Starting the service with the script only in Y:\ gives the error in the event log: Python could not import the service's module exceptions.ImportError: No module named testservice Thanks for your help. -- Greg testservice.py: import win32serviceutil, win32service import servicemanager import win32api import win32event import sys class TestPipeService(win32serviceutil.ServiceFramework): _svc_name_ = "MDE Dispatcher" _svc_display_name_ = "MDE-Dispatcher" _svc_description_ = "Dispatches machine events from the Siemens ODC to registrered MDE clients (windows) over the network via XML-RPC" def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) def SvcDoRun(self): # Write an event log record - in debug mode we will also # see this message printed. servicemanager.LogMsg( servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, '') ) while 1: win32api.Sleep(2) rc = win32event.WaitForSingleObject(self.hWaitStop, 2000) if rc == win32event.WAIT_OBJECT_0: break # Write another event log record. servicemanager.LogMsg( servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STOPPED, (self._svc_name_, " TEST ") ) if __name__=='__main__': win32serviceutil.HandleCommandLine(TestPipeService) From timr at probo.com Tue Sep 19 18:58:40 2006 From: timr at probo.com (Tim Roberts) Date: Tue, 19 Sep 2006 09:58:40 -0700 Subject: [python-win32] Module not found weirdness In-Reply-To: <32dab3890609190116u1bd8f962q20329218566142eb@mail.gmail.com> References: <32dab3890609190116u1bd8f962q20329218566142eb@mail.gmail.com> Message-ID: <451021C0.8090606@probo.com> Derick Van Niekerk wrote: > When I execute the code here > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355593 I get > the following traceback: > > Traceback (most recent call last): > File "C:\Documents and Settings\Derick\Desktop\test.py", line 73, in ? > frame = TestFrame () > File "C:\Documents and Settings\Derick\Desktop\test.py", line 23, in > __init__ > self.nextWnd = win32clipboard.SetClipboardViewer (self.hwnd) > pywintypes.error: (126, 'SetClipboardViewer', 'The specified module > could not be found.') > Script terminated. > > I have run dependency walker and found that all the dlls load fine. You ran dependency walker on which file? > The other win32clipboard functions work fine as well, like getting and > setting the clipboard contents. I have found that SetClipboardViewer ( > self.hwnd) should be in user32.dll but I have the same version > installed as on my PC at work where the program runs without a problem. How are you running this? Are you running it from a command line, or from inside an IDE, or double-clicking on the desktop, or what? Which version of Python? Remember that, using Python 2.4 as an example, python24.dll and pywintypes24.dll must be present in the DLL search path, and that the environment variables for a proess started by Explorer are not necessarily the same as the variables for a command-line shell. Is it possible you have multiple copies of Python installed, and that the Explorer file association is pointing to the wrong one? If you go to a cmd shell and do "assoc .py" and then "ftype python.file" (assuming that's what assoc said), does it point to the path you expect? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From shahmed at sfwmd.gov Tue Sep 19 21:09:11 2006 From: shahmed at sfwmd.gov (Ahmed, Shakir) Date: Tue, 19 Sep 2006 15:09:11 -0400 Subject: [python-win32] Fatal Error Message-ID: <14A2A120D369B6469BB154B2D2DC34D205A3184D@EXCHVS01.ad.sfwmd.gov> I am running a script and getting the following error, any idea is highly appreciated. The script is mainly a loop work for sixteen time and raises the error on 10th cycle. NO free BITSYS Channels (BITCHN) Thanks Shakir From gagsl-p32 at yahoo.com.ar Tue Sep 19 22:00:19 2006 From: gagsl-p32 at yahoo.com.ar (Gabriel Genellina) Date: Tue, 19 Sep 2006 17:00:19 -0300 Subject: [python-win32] Fatal Error In-Reply-To: <14A2A120D369B6469BB154B2D2DC34D205A3184D@EXCHVS01.ad.sfwmd .gov> References: <14A2A120D369B6469BB154B2D2DC34D205A3184D@EXCHVS01.ad.sfwmd.gov> Message-ID: <7.0.1.0.0.20060919165809.039afda0@yahoo.com.ar> At Tuesday 19/9/2006 16:09, Ahmed, Shakir wrote: >I am running a script and getting the following error, any idea is >highly appreciated. > >The script is mainly a loop work for sixteen time and raises the error >on 10th cycle. > > >NO free BITSYS Channels (BITCHN) This is not a Python error, it's generated by your script... Gabriel Genellina Softlab SRL __________________________________________________ Pregunt?. Respond?. Descubr?. Todo lo que quer?as saber, y lo que ni imaginabas, est? en Yahoo! Respuestas (Beta). ?Probalo ya! http://www.yahoo.com.ar/respuestas From derickvn at gmail.com Wed Sep 20 00:15:07 2006 From: derickvn at gmail.com (Derick Van Niekerk) Date: Wed, 20 Sep 2006 00:15:07 +0200 Subject: [python-win32] Module not found weirdness In-Reply-To: <451021C0.8090606@probo.com> References: <32dab3890609190116u1bd8f962q20329218566142eb@mail.gmail.com> <451021C0.8090606@probo.com> Message-ID: <32dab3890609191515o31ed4c02v9cda003e88a7b285@mail.gmail.com> > > You ran dependency walker on which file? I ran it on python.exe, pressed F7, then loaded my .py file by specifying the filename in the arguments field. > The other win32clipboard functions work fine as well, like getting and > > setting the clipboard contents. I have found that SetClipboardViewer ( > > self.hwnd) should be in user32.dll but I have the same version > > installed as on my PC at work where the program runs without a problem. > > > How are you running this? Are you running it from a command line, or > from inside an IDE, or double-clicking on the desktop, or what? Which > version of Python? Remember that, using Python 2.4 as an example, > python24.dll and pywintypes24.dll must be present in the DLL search > path, and that the environment variables for a proess started by > Explorer are not necessarily the same as the variables for a > command-line shell. I get the same errors whether I run it via the comand line, desktop double-click (quick read to see the errors) or SPE (my IDE of choice). The dlls are found, the problem is with the SetClipboardViewer function - which, I assume is a module inside a dll (user32.dll, I believe). I might be assuming too much - It could be something else entirely, but it seems to only affect SetClipboardViewer. Is there any way I could have broken the clipboard view chain in a way that doesn't fix itself after a restart? Is it possible you have multiple copies of Python installed, and that > the Explorer file association is pointing to the wrong one? If you go > to a cmd shell and do "assoc .py" and then "ftype python.file" (assuming > that's what assoc said), does it point to the path you expect? Nope. Only python 2.4.3 is installed. I upgraded from 2.4.2 hoping it would solve the problem. Following the instructions you gave me in your last paragraph doesn't show me anything unexpected. The path seems to be correct. Puzzling. -d- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060920/a39748d8/attachment.htm From sjmachin at lexicon.net Wed Sep 20 00:20:31 2006 From: sjmachin at lexicon.net (John Machin) Date: Wed, 20 Sep 2006 08:20:31 +1000 Subject: [python-win32] Fatal Error In-Reply-To: <14A2A120D369B6469BB154B2D2DC34D205A3184D@EXCHVS01.ad.sfwmd.gov> References: <14A2A120D369B6469BB154B2D2DC34D205A3184D@EXCHVS01.ad.sfwmd.gov> Message-ID: <45106D2F.5000405@lexicon.net> On 20/09/2006 5:09 AM, Ahmed, Shakir wrote: > > I am running a script and getting the following error, any idea is > highly appreciated. > > The script is mainly a loop work for sixteen time and raises the error > on 10th cycle. > > > NO free BITSYS Channels (BITCHN) > Dear Shakir, It is a good idea when asking questions about problems like this to (1) say what efforts you have made to find a solution yourself (2) show a snippet of the code and the error details (e.g. Python traceback). I suspect the answer to (1) is "not much". A little googling leads me to the impression that you have been struck by a known but unfixed bug in a commercial product. According to posts in forums on the vendor's web site, the bug appears to happen when the software is accessed via COM from any language (e.g. Visual Basic as well as Python) -- so it's not a Python problem. Your e-mail address suggests that you are working for a U.S. state government agency, which has presumably paid a licence fee for the product. In that case I suggest you avail yourself of whatever support options are available from the product vendor. HTH, John From timr at probo.com Wed Sep 20 00:43:35 2006 From: timr at probo.com (Tim Roberts) Date: Tue, 19 Sep 2006 15:43:35 -0700 Subject: [python-win32] Module not found weirdness In-Reply-To: <32dab3890609191515o31ed4c02v9cda003e88a7b285@mail.gmail.com> References: <32dab3890609190116u1bd8f962q20329218566142eb@mail.gmail.com> <451021C0.8090606@probo.com> <32dab3890609191515o31ed4c02v9cda003e88a7b285@mail.gmail.com> Message-ID: <45107297.30404@probo.com> Derick Van Niekerk wrote: > You ran dependency walker on which file? > > > I ran it on python.exe, pressed F7, then loaded my .py file by > specifying the filename in the arguments field. You might try running the dependency walker on site-packages/win32/win32clipboard.pyd just in case, but I suspect you won't find anything. > How are you running this? Are you running it from a command line, or > from inside an IDE, or double-clicking on the desktop, or what? > > > I get the same errors whether I run it via the comand line, desktop > double-click (quick read to see the errors) > or SPE (my IDE of choice). The dlls are found, the problem is with the > SetClipboardViewer > function - which, I assume is a module inside a dll (user32.dll, I > believe). I might be assuming too > much - It could be something else entirely, but it seems to only > affect SetClipboardViewer. win32clipboard.SetClipboardViewer is a function inside of win32clipboard.pyd, which is a DLL in the Python directory. It, eventually, calls SetClipboardViewer inside of user32.dll. User32.dll has been a part of Windows since 1992; I'm 100% confident you'll find the problem in the Python wrapper somewhere. On a whim, can you try checksumming the DLL? I'm running pywin32-204. If you have the same version, you should get the same number: C:\Apps\Python24\Lib>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import binascii >>> hex(binascii.crc32(file('site-packages/win32/win32clipboard.pyd').read())) '-0x17a3560a' >>> > Is there any way I could have broken the clipboard view chain in a way > that doesn't fix itself after a restart? No, that's all in-memory. If it were me, I'd load up Python.exe in a C debugger and single-step through the function call, but then I'm not like most people... I did try the cookbook script here, and it works fine. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From rwupole at msn.com Wed Sep 20 01:26:31 2006 From: rwupole at msn.com (Roger Upole) Date: Tue, 19 Sep 2006 19:26:31 -0400 Subject: [python-win32] Module not found weirdness Message-ID: Derick Van Niekerk wrote: > When I execute the code here > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355593 I get the > following traceback: > > Traceback (most recent call last): > File "C:\Documents and Settings\Derick\Desktop\test.py", line 73, in ? > frame = TestFrame () > File "C:\Documents and Settings\Derick\Desktop\test.py", line 23, in > __init__ > self.nextWnd = win32clipboard.SetClipboardViewer (self.hwnd) > pywintypes.error: (126, 'SetClipboardViewer', 'The specified module could > not be found.') > Script terminated. > > I have run dependency walker and found that all the dlls load fine. The > other win32clipboard functions work fine as well, like getting and setting > the clipboard contents. I have found that SetClipboardViewer ( self.hwnd) > should be in user32.dll but I have the same version installed as on my PC at > work where the program runs without a problem. > > The strange thing is that all the other functions I tried work fine, which > would indicate that I might be using an old version of some dll - the > function might not exist in the module dll I'm using. user32 doesn't seem at > fault though since it is the same on both PC's... > > What could be the problem? Google couldn't teach me anything on this problem > > This code doesn't work: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355593 > > But this does - even though it uses the same module: > > import win32clipboard as w > import win32con > > def getText(): > w.OpenClipboard() > d=w.GetClipboardData(win32con.CF_TEXT) > w.CloseClipboard() > return d > > def setText(aType,aString): > w.OpenClipboard() > w.EmptyClipboard() > w.SetClipboardData(aType,aString) > w.CloseClipboard() > Since you're getting pywintypes.error rather than an import error, the function is actually called. Most likely the app that created the window (wxPython) isn't responding correctory. You might want to check if you have the same version of wx on both machines. Roger From andrewdied at gmail.com Wed Sep 20 01:43:36 2006 From: andrewdied at gmail.com (Andrew Diederich) Date: Tue, 19 Sep 2006 17:43:36 -0600 Subject: [python-win32] How to launch acrobat with data Message-ID: <866061062.20060919174336@gmail.com> Hello python-win32, I'm storing some Adobe forms (application/vnd.fdf) in a database. Using ADODBAPI I've been able to pull the data out. Does anyone know how I can launch Adobe Acrobat with the data? Here's how I get the data: >>> import adodbapi >>> conn = adodbapi.connect('Driver={SQL Server};Data Source=dbServer,1433;Initial Catalog=theDatabase;User ID=theUser;Password=thePassword;') >>> curs=conn.corsor() >>> curs.execute('''select documentID, BLOBcol from mytable where documentID=5;''') >>> answer=curs.fetchall() And answer is: >>> answer ((u'5', ),) I can get just the FDF data, of course. >>> print answer[0][1] %+++-1.2 /FDF << /Fields [ << /T (All_Activity_ActivityID)/V /Off >> << /T (All_ Does anyone know how to launch Acrobat with data? I'm very behind the power curve on windows programming, so I'm not really even sure how to search through windows to discover how to Dispatch correctly. I searched the registry for applicatoin/vnd.fdf, and found HKCR\.fdf, which had AcroExch.FDFDoc, and PDFs look to be AcroExch.Document, but how I would use, say, win32com.client.Dispatch to launch Acrobat with some data (or even launch Acrobat)? Thanks for the help. -- Best regards, Andrew Diederich From mhammond at skippinet.com.au Wed Sep 20 01:48:05 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 20 Sep 2006 09:48:05 +1000 Subject: [python-win32] Service: path to .py script In-Reply-To: <450FD415.10601@gregor-horvath.com> Message-ID: <0b4701c6dc46$0ec5bfe0$050a0a0a@enfoldsystems.local> Is Y: a mappyed network drive? If so, the problem will be that the mapping does not exist for the service account (and if you are using LocalSystem, it will not be possible/sensible to add it) Mark > -----Original Message----- > From: python-win32-bounces+mhammond=keypoint.com.au at python.org > [mailto:python-win32-bounces+mhammond=keypoint.com.au at python.org]On > Behalf Of Gregor Horvath > Sent: Tuesday, 19 September 2006 9:27 PM > To: python-win32 at python.org > Subject: [python-win32] Service: path to .py script > > > Hi, > > I have a testservice.py (see below). I installed the service > successfully. (via commandlineoption install) > The problem is that it runs only when it is in > c:\windows\system32 or in > the python path. > I added the desired path (Y:\) to the PYTHONPATH environment variable > for the system account and rebooted. > When I start command line python and do a import testservice > everything > is fine. > Starting the service with the script only in Y:\ gives the > error in the > event log: > > Python could not import the service's module > > exceptions.ImportError: No module named testservice > > Thanks for your help. > > -- > Greg > > testservice.py: > > import win32serviceutil, win32service > import servicemanager > import win32api > import win32event > import sys > > class TestPipeService(win32serviceutil.ServiceFramework): > _svc_name_ = "MDE Dispatcher" > _svc_display_name_ = "MDE-Dispatcher" > _svc_description_ = "Dispatches machine events from the > Siemens ODC > to registrered MDE clients (windows) over the network via XML-RPC" > def __init__(self, args): > win32serviceutil.ServiceFramework.__init__(self, args) > self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) > > def SvcStop(self): > self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) > win32event.SetEvent(self.hWaitStop) > > > def SvcDoRun(self): > # Write an event log record - in debug mode we will also > # see this message printed. > servicemanager.LogMsg( > servicemanager.EVENTLOG_INFORMATION_TYPE, > servicemanager.PYS_SERVICE_STARTED, > (self._svc_name_, '') > ) > > while 1: > win32api.Sleep(2) > rc = win32event.WaitForSingleObject(self.hWaitStop, 2000) > if rc == win32event.WAIT_OBJECT_0: > break > > > # Write another event log record. > servicemanager.LogMsg( > servicemanager.EVENTLOG_INFORMATION_TYPE, > servicemanager.PYS_SERVICE_STOPPED, > (self._svc_name_, " TEST ") > ) > > > if __name__=='__main__': > win32serviceutil.HandleCommandLine(TestPipeService) > > > > > > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From gh at gregor-horvath.com Wed Sep 20 08:03:51 2006 From: gh at gregor-horvath.com (Gregor Horvath) Date: Wed, 20 Sep 2006 08:03:51 +0200 Subject: [python-win32] Service: path to .py script In-Reply-To: <0b4701c6dc46$0ec5bfe0$050a0a0a@enfoldsystems.local> References: <0b4701c6dc46$0ec5bfe0$050a0a0a@enfoldsystems.local> Message-ID: <4510D9C7.5050004@gregor-horvath.com> Mark Hammond schrieb: > Is Y: a mappyed network drive? If so, the problem will be that the mapping > does not exist for the service account (and if you are using LocalSystem, it > will not be possible/sensible to add it) Thanks a lot. This was indeed the problem. -- Greg From derickvn at gmail.com Wed Sep 20 09:04:00 2006 From: derickvn at gmail.com (Derick Van Niekerk) Date: Wed, 20 Sep 2006 09:04:00 +0200 Subject: [python-win32] Module not found weirdness In-Reply-To: <45107297.30404@probo.com> References: <32dab3890609190116u1bd8f962q20329218566142eb@mail.gmail.com> <451021C0.8090606@probo.com> <32dab3890609191515o31ed4c02v9cda003e88a7b285@mail.gmail.com> <45107297.30404@probo.com> Message-ID: <32dab3890609200004u6580306y4880218e58b06295@mail.gmail.com> > > You might try running the dependency walker on > site-packages/win32/win32clipboard.pyd just in case, but I suspect you > won't find anything. I don't know how...yet :) win32clipboard.SetClipboardViewer is a function inside of > win32clipboard.pyd, which is a DLL in the Python directory. It, > eventually, calls SetClipboardViewer inside of user32.dll. User32.dll > has been a part of Windows since 1992; I'm 100% confident you'll find > the problem in the Python wrapper somewhere. > > On a whim, can you try checksumming the DLL? I'm running pywin32-204. > If you have the same version, you should get the same number: I'm using pywin32-206. I'm using the exact same python packages on my machine at work as on my machine a home - I installed it on both PC's using the same files on my USB thumb drive...So if it is a problem with the dlls, it must have happened *after* I installed it. I'm not ruling out a virus yet, but that is a strange attack for a virus to follow :-/ Of course it might just be a fluke corruption on one of the files that could only possibly happen to me because of bad karma and planets being perfectly positioned or something. I'm going to try a fresh reinstall of all things python tonight. It's very frustrating not to be able to replicate the error on another machine. > Is there any way I could have broken the clipboard view chain in a way > > that doesn't fix itself after a restart? > > > No, that's all in-memory. If it were me, I'd load up Python.exe in a C > debugger and single-step through the function call, but then I'm not > like most people... *blink blink*. A bit over my head at this time... I did try the cookbook script here, and it works fine. As it does with every other machine I've tried it on, and every person on #python that tested it. I can't even find anything remotely similar to my problem on Google - so chances are it's some freak situation I created on my PC. I tried running some clipboard managers at home (Clippy and Clipmagic - both nice programs by the way) and they don't seem to have a problem recieving the clipboard draw event, so I am sure you are right about it having nothing to do with the windows dll. It *has* to be in the python wrapper... Anyway, if my reinstall of python doesn't work - I'll do a reinstall of Windows. A dirty job but somebody has to do it. If nothing else, it has therapeutic value...fdisk. No compromise. -d- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060920/a9acf26d/attachment.html From derickvn at gmail.com Wed Sep 20 09:09:54 2006 From: derickvn at gmail.com (Derick Van Niekerk) Date: Wed, 20 Sep 2006 09:09:54 +0200 Subject: [python-win32] Module not found weirdness In-Reply-To: References: Message-ID: <32dab3890609200009s5670170bwf6f96448dc623589@mail.gmail.com> > > Since you're getting pywintypes.error rather than an import error, > the function is actually called. Most likely the app that created the > window (wxPython) isn't responding correctory. You might want to > check if you have the same version of wx on both machines. I never even thought of that... I installed from the same files originally, but I think I might've upgraded the wx version on my work machine. I'm trying a reinstall tonight. -d- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060920/a1006c57/attachment.htm From brant at mac.com Thu Sep 21 00:03:54 2006 From: brant at mac.com (Brant Sears) Date: Wed, 20 Sep 2006 15:03:54 -0700 Subject: [python-win32] Trying to run an external program Message-ID: <5107423.1158789834244.JavaMail.brant@mac.com> Hi. I'm new to Python and I am trying to use it on Windows XP. I am trying to use it to replicate the same thing that I do on Linux and Mac via shell scripting (Batch files aren't powerful enough, so I've decided to try to use Python.) What I want to do is execute a program and have the results of the execution assigned to a variable. According to the documentation the way to do this is as follows: import commands x = commands.getstatusoutput('dir') This should assign "x" to be the output of the command "dir". However, when I run this (or any other command), x ends up being: (1, "'{' is not recognized as an internal or external command,\noperable program or batch file.") >From looking through the documentation, I'm believing that the implementation of commands.getstatusoutput is actually some multi-step thing that starts with issuing the bracket character that is being choked on. This leads me to believe that Python or perhaps just the commands module is not setup correctly on my computer. I installed Python using the Python2-5.msi link that I found at: http://www.python.org/download/releases/2.5/ I left everything the default during installation, so Python was installed to C:\Python25. The only other thing I did was add this PATH variable on my computer. Any ideas on what I might do to troubleshoot this? Thanks! Brant Sears From sjmachin at lexicon.net Thu Sep 21 01:21:48 2006 From: sjmachin at lexicon.net (John Machin) Date: Thu, 21 Sep 2006 09:21:48 +1000 Subject: [python-win32] Trying to run an external program In-Reply-To: <5107423.1158789834244.JavaMail.brant@mac.com> References: <5107423.1158789834244.JavaMail.brant@mac.com> Message-ID: <4511CD0C.3030305@lexicon.net> On 21/09/2006 8:03 AM, Brant Sears wrote: > Hi. I'm new to Python and I am trying to use it on Windows XP. I am trying to use it to replicate the same thing that I do on Linux and Mac via shell scripting (Batch files aren't powerful enough, so I've decided to try to use Python.) > > What I want to do is execute a program and have the results of the execution assigned to a variable. According to the documentation the way to do this is as follows: > > import commands > x = commands.getstatusoutput('dir') > > This should assign "x" to be the output of the command "dir". However, when I run this (or any other command), x ends up being: > > (1, "'{' is not recognized as an internal or external command,\noperable program or batch file.") Actually, the output is defined to be a tuple (exitstatus, command_result). The exitstatus is 1, and the "is not recognised" thing is the result of the command, which was evidently "{" (!!) > >>From looking through the documentation, I'm believing that the implementation of commands.getstatusoutput is actually some multi-step thing that starts with issuing the bracket character that is being choked on. This leads me to believe that Python or perhaps just the commands module is not setup correctly on my computer. > > I installed Python using the Python2-5.msi link that I found at: > http://www.python.org/download/releases/2.5/ > > I left everything the default during installation, so Python was installed to C:\Python25. The only other thing I did was add this PATH variable on my computer. > > Any ideas on what I might do to troubleshoot this? > (1) Read the manual: "Availability: Unix" (2) Read line 25 of the source code (c:\python25\lib\commands.py) Others may know of canned Python solutions for Windows; all I can suggest is to write something like the (very short) commands module, using the functions in the subprocess module. HTH, John From rwupole at msn.com Thu Sep 21 01:22:17 2006 From: rwupole at msn.com (Roger Upole) Date: Wed, 20 Sep 2006 19:22:17 -0400 Subject: [python-win32] Trying to run an external program Message-ID: Brant Sears wrote: > Hi. I'm new to Python and I am trying to use it on Windows XP. I am trying to use it to replicate the same thing that I do on > Linux and Mac via shell scripting (Batch files aren't powerful enough, so I've decided to try to use Python.) > > What I want to do is execute a program and have the results of the execution assigned to a variable. According to the > documentation the way to do this is as follows: > > import commands > x = commands.getstatusoutput('dir') > > This should assign "x" to be the output of the command "dir". However, when I run this (or any other command), x ends up > being: > > (1, "'{' is not recognized as an internal or external command,\noperable program or batch file.") > >>From looking through the documentation, I'm believing that the implementation of commands.getstatusoutput is actually some >>multi-step thing that starts with issuing the bracket character that is being choked on. This leads me to believe that Python >>or perhaps just the commands module is not setup correctly on my computer. > > I installed Python using the Python2-5.msi link that I found at: > http://www.python.org/download/releases/2.5/ > > I left everything the default during installation, so Python was installed to C:\Python25. The only other thing I did was add > this PATH variable on my computer. > > Any ideas on what I might do to troubleshoot this? > > Thanks! > > Brant Sears The commands module doesn't work on Windows. You could try using os.popen, or maybe the subprocess module. Roger From rwupole at msn.com Thu Sep 21 02:49:37 2006 From: rwupole at msn.com (Roger Upole) Date: Wed, 20 Sep 2006 20:49:37 -0400 Subject: [python-win32] How to launch acrobat with data Message-ID: Andrew Diederich wrote: > Hello python-win32, > > I'm storing some Adobe forms (application/vnd.fdf) in a database. > Using ADODBAPI I've been able to pull the data out. Does anyone know > how I can launch Adobe Acrobat with the data? > > Here's how I get the data: >>>> import adodbapi > >>>> conn = adodbapi.connect('Driver={SQL Server};Data > Source=dbServer,1433;Initial Catalog=theDatabase;User > ID=theUser;Password=thePassword;') > >>>> curs=conn.corsor() > >>>> curs.execute('''select documentID, BLOBcol from mytable where documentID=5;''') > >>>> answer=curs.fetchall() > > And answer is: >>>> answer > ((u'5', ),) > > I can get just the FDF data, of course. > >>>> print answer[0][1] > %+++-1.2 > /FDF << /Fields [ << /T (All_Activity_ActivityID)/V /Off >> << /T (All_ > > > Does anyone know how to launch Acrobat with data? I'm very behind the > power curve on windows programming, so I'm not really even sure how to > search through windows to discover how to Dispatch correctly. I > searched the registry for applicatoin/vnd.fdf, and found HKCR\.fdf, > which had AcroExch.FDFDoc, and PDFs look to be AcroExch.Document, but > how I would use, say, win32com.client.Dispatch to launch Acrobat with > some data (or even launch Acrobat)? > > Thanks for the help. > > -- > Best regards, > Andrew Diederich You could write the data out to a file and use os.startfile to launch acrobat. If you need to actually control Acrobat as a COM object, it has to be embedded in a container. Using IE as a container is fairly easy, you just Navigate to a PDF document: import win32com.client ie=win32com.client.Dispatch('internetexplorer.application') ie.Visible=1 ie.Navigate('somedocument.pdf') Roger From kenchanningphd at gmail.com Thu Sep 21 08:36:22 2006 From: kenchanningphd at gmail.com (Ken Channing) Date: Wed, 20 Sep 2006 23:36:22 -0700 Subject: [python-win32] How to implement a COM interface (that is not part In-Reply-To: References: Message-ID: Thanks for your help -- I searched around some more and I think I have the basic idea down -- if you want to implement a COM interface, it should look something like this: Use makepy -i to generate a file from the typelib containing the interface definition. In my case the file generated is named: 13F76618-D199-4485-8C95-DC524958686Cx0x2x0.py I assume the typelib GUID is: 13F76618-D199-4485-8C95-DC524958686C and the typelib version is: 2,0 The interface I'm trying to implement is named: "IMbtQuotesNotify" universal.RegisterInterfaces('{13F76618-D199-4485-8C95-DC524958686C}',0,2,0,["IMbtQuotesNotify"]) class Q: _com_interfaces_ = ['IMbtQuotesNotify'] _typelib_guid_ = '{13F76618-D199-4485-8C95-DC524958686C}' _typelib_version_ = 2, 0 def OnQuoteData(self,pQuote): print "got onquote!" print type(pQuote) print "%s" % pQuote import win32com.server.util qnotify = win32com.server.util.wrap(Q()) The object named qnotify is now something I can pass to another COM function that expects an object implementing the interface. import win32com.client as com quote = com.Dispatch("MBTrading.MbtQuotes") quote.AdviseSymbol(qnotify,'GOOG',1) The callback functions defined in qnotify should be called with quote data whenever a new quote for 'GOOG' is available. For whatever reason, this doesn't happen. Sometimes the OnQuoteData callback is invoked with an int (the int is 1240772, if that means anything) instead of the quote datatype as advertised. Sometimes the interpreter crashes. However, I suspect that the above code is correct, unless I am still doing something wrong. (Perhaps using wrap is not the right function for creating an object that is passed as an argument to another COM function?) Thanks again for your help! > > I think the post here outlines a similar problem: > > http://mail.python.org/pipermail/python-win32/2004-May/001990.html > > > > Is there some obvious way to do this that I'm missing? > > In the VB version of the program I'm trying to re-implement in python, > > it seems to be able to > > implement the interface by simply calling "Implements Foo" and subclassing by > > "Private Sub Foo_OnSomeEvent(..." > > > > Thanks for any help! > > You should be able to implement it just as you would a small COM server. > Basically, your class would need to specify the interface with > _com_interfaces_=[iid of Foo] > and define an event method. > def OnSomeEvent(self,.....): > > Roger Thanks for your help -- I've created a class as you've suggested. The function that takes as an argu From derickvn at gmail.com Thu Sep 21 10:00:36 2006 From: derickvn at gmail.com (Derick Van Niekerk) Date: Thu, 21 Sep 2006 10:00:36 +0200 Subject: [python-win32] Module not found weirdness In-Reply-To: <32dab3890609200009s5670170bwf6f96448dc623589@mail.gmail.com> References: <32dab3890609200009s5670170bwf6f96448dc623589@mail.gmail.com> Message-ID: <32dab3890609210100k68d9dd77pa8a322ebb0fdd7db@mail.gmail.com> > > Since you're getting pywintypes.error rather than an import error, > the function is actually called. Most likely the app that created the > window (wxPython) isn't responding correctory. You might want to > check if you have the same version of wx on both machines. > Yep - both versions turned out to be the same. I reinstalled anyway, but still the same problem persists. I uninstalled everything, deleted any remaining dirs, rebooted and reinstalled only python, wx and win32. Still the same problem. So I'm sure the problem is not with the python libs themselves and it must be a problem somewhere else - probably with the OS - but where? I replaced all the relevant dlls (except user32dll, which is always in use it seems) - still no dice. How can I replace user32.dll? Where else can I look for the source of the problem before going so far as reinstalling windows? -d- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060921/d9d7681e/attachment.html From filipporandello at yahoo.com Thu Sep 21 15:27:23 2006 From: filipporandello at yahoo.com (filippo randello) Date: Thu, 21 Sep 2006 06:27:23 -0700 (PDT) Subject: [python-win32] from: http://mail.python.org/pipermail/python-list/2006-January/320434.html Message-ID: <20060921132723.47254.qmail@web36509.mail.mud.yahoo.com> Hello, if after your command: ie.Document.login_form.submit() I write: doc = ie.Document s = doc.documentElement.outerHTML print s I can see the HTML of the document before the submit command, but I would like to see the HTML of the page after the submit command: do you know how to solve this problem? Cheers. form: http://mail.python.org/pipermail/python-list/2006-January/320434.html ################################ # Quick and dirty script example from win32com.client import DispatchEx import time def wait(ie): while ie.Busy: time.sleep(0.1) while ie.Document.ReadyState != 'complete': time.sleep(0.1) #instaniate a new ie object so you can call it's #methods and properties...etc.. ie = DispatchEx('InternetExplorer.Application') # You need to make it Visible ie.Visible = 1 # Navigate to the page ie.Navigate('mail.yahoo.com') wait(ie) # important to wait for the doc to load # Enter User info and submit the form since it uses #submit # If the button had a name attribute # You #could also use #ie.Document.login_form.buttonName.Click # ieObject.Document.FormName.TexboxName.value ="??" ie.Document.login_form.username.value="MyName" ie.Document.login_form.passwd.value="Mypasswd" ie.Document.login_form.submit() __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From bwmetz at att.com Thu Sep 21 17:53:17 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Thu, 21 Sep 2006 10:53:17 -0500 Subject: [python-win32] from:http://mail.python.org/pipermail/python-list/2006-January/320434.html In-Reply-To: <20060921132723.47254.qmail@web36509.mail.mud.yahoo.com> Message-ID: <01D5341D04A2E64AB9B3457690473367027FC2F9@OCCLUST01EVS1.ugd.att.com> One possible solution...just sleep until the ie object reports it's not busy. Should mean the form submission has completed and the new document as loaded. ie.Document.login_form.submit() while ie.Busy: time.sleep(.5) s = doc.documentElement.outerHTML print s Bobby -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of filippo randello Sent: Thursday, September 21, 2006 6:27 AM To: python-win32 at python.org Subject: [python-win32] from:http://mail.python.org/pipermail/python-list/2006-January/320434.ht ml Hello, if after your command: ie.Document.login_form.submit() I write: doc = ie.Document s = doc.documentElement.outerHTML print s I can see the HTML of the document before the submit command, but I would like to see the HTML of the page after the submit command: do you know how to solve this problem? Cheers. form: http://mail.python.org/pipermail/python-list/2006-January/320434.html ################################ # Quick and dirty script example from win32com.client import DispatchEx import time def wait(ie): while ie.Busy: time.sleep(0.1) while ie.Document.ReadyState != 'complete': time.sleep(0.1) #instaniate a new ie object so you can call it's #methods and properties...etc.. ie = DispatchEx('InternetExplorer.Application') # You need to make it Visible ie.Visible = 1 # Navigate to the page ie.Navigate('mail.yahoo.com') wait(ie) # important to wait for the doc to load # Enter User info and submit the form since it uses #submit # If the button had a name attribute # You #could also use #ie.Document.login_form.buttonName.Click # ieObject.Document.FormName.TexboxName.value ="??" ie.Document.login_form.username.value="MyName" ie.Document.login_form.passwd.value="Mypasswd" ie.Document.login_form.submit() __________________________________________________ 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 From timr at probo.com Thu Sep 21 19:07:41 2006 From: timr at probo.com (Tim Roberts) Date: Thu, 21 Sep 2006 10:07:41 -0700 Subject: [python-win32] Module not found weirdness In-Reply-To: <32dab3890609210100k68d9dd77pa8a322ebb0fdd7db@mail.gmail.com> References: <32dab3890609200009s5670170bwf6f96448dc623589@mail.gmail.com> <32dab3890609210100k68d9dd77pa8a322ebb0fdd7db@mail.gmail.com> Message-ID: <4512C6DD.3060705@probo.com> Derick Van Niekerk wrote: > > I uninstalled everything, deleted any remaining dirs, rebooted and > reinstalled only python, wx and win32. Still the same problem. So I'm > sure the problem is not with the python libs themselves... That is an unjustified conclusion. You may be sure that the problem was not caused by a bad installation of Python or wx, but in no way have you eliminated the Python libs or wrappers from suspicion. > ...and it must be a problem somewhere else - probably with the OS - > but where? > > I replaced all the relevant dlls (except user32dll, which is always in > use it seems) - still no dice. > > How can I replace user32.dll? Where else can I look for the source of > the problem before going so far as reinstalling windows? Unless you have been infected by a virus, user32.dll is not broken. Please eliminate that option from consideration. Windows constantly monitors all of the critical system files and replaces them with hidden, cached copies if they change. Do you run any real-time virus or spyware checkers? Have you tried disabling those temporarily to see if it makes a difference? You might try running HijackThis (www.spywareinfo.com/~merijn/programs.php). Create a log and send it to me, and I'll see if there are any Windows hooks installed that might be interfering. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From zhangh1 at umbc.edu Thu Sep 21 17:32:35 2006 From: zhangh1 at umbc.edu (zhangh1 at umbc.edu) Date: Thu, 21 Sep 2006 11:32:35 -0400 (EDT) Subject: [python-win32] "Browse" button in windows Message-ID: <1945.130.85.169.19.1158852755.squirrel@webmail.umbc.edu> Hi: I am totally an freshman to Python, and I want to build in my python program a button just like the "Browse" button in windows which will pop out a dialog window to select files from the local machine. Can somebody tell me the library and method that might be useful? Thanks From timr at probo.com Thu Sep 21 20:45:41 2006 From: timr at probo.com (Tim Roberts) Date: Thu, 21 Sep 2006 11:45:41 -0700 Subject: [python-win32] "Browse" button in windows In-Reply-To: <1945.130.85.169.19.1158852755.squirrel@webmail.umbc.edu> References: <1945.130.85.169.19.1158852755.squirrel@webmail.umbc.edu> Message-ID: <4512DDD5.6000401@probo.com> zhangh1 at umbc.edu wrote: >Hi: >I am totally an freshman to Python, and I want to build in my python >program a button just like the "Browse" button in windows which will pop >out a dialog window to select files from the local machine. Can somebody >tell me the library and method that might be useful? > What toolkit are you using to build your UI? If you are drawing your windows with wx, there is a canned dialog already. If you're using win32ui, you can use win32ui.CreateFileDialog. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From derickvn at gmail.com Thu Sep 21 20:58:54 2006 From: derickvn at gmail.com (Derick Van Niekerk) Date: Thu, 21 Sep 2006 20:58:54 +0200 Subject: [python-win32] Module not found weirdness In-Reply-To: <4512C6DD.3060705@probo.com> References: <32dab3890609200009s5670170bwf6f96448dc623589@mail.gmail.com> <32dab3890609210100k68d9dd77pa8a322ebb0fdd7db@mail.gmail.com> <4512C6DD.3060705@probo.com> Message-ID: <32dab3890609211158w1d1cdfbeldbc30f980b6c0390@mail.gmail.com> > > Unless you have been infected by a virus, user32.dll is not broken. > Please eliminate that option from consideration. Windows constantly > monitors all of the critical system files and replaces them with hidden, > cached copies if they change. > > Do you run any real-time virus or spyware checkers? Have you tried > disabling those temporarily to see if it makes a difference? I think you are on to something here. I disabled AVG and the program worked! Then I enabled AVG again, and the program still worked. Before replying to your message, I decided to reboot, just to make sure it still works but after rebooting I get the same error as before - even if I disable AVG :( You might try running HijackThis > (www.spywareinfo.com/~merijn/programs.php). Create a log and send it to > me, and I'll see if there are any Windows hooks installed that might be > interfering. > Sending it to you now... Thanks! -d- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060921/16507058/attachment.html From derickvn at gmail.com Thu Sep 21 21:04:57 2006 From: derickvn at gmail.com (Derick Van Niekerk) Date: Thu, 21 Sep 2006 21:04:57 +0200 Subject: [python-win32] Module not found weirdness In-Reply-To: <4512C6DD.3060705@probo.com> References: <32dab3890609200009s5670170bwf6f96448dc623589@mail.gmail.com> <32dab3890609210100k68d9dd77pa8a322ebb0fdd7db@mail.gmail.com> <4512C6DD.3060705@probo.com> Message-ID: <32dab3890609211204t15df85bao3de5d762e0efd45c@mail.gmail.com> After rebooting the pywintypes.error message has changed slightly: Traceback (most recent call last): File "C:\Documents and Settings\Derick\Desktop\test.py", line 73, in ? frame = TestFrame () File "C:\Documents and Settings\Derick\Desktop\test.py", line 23, in __init__ self.nextWnd = win32clipboard.SetClipboardViewer (self.hwnd) pywintypes.error: (126, 'SetClipboardViewer', 'The specified module could not be found.') -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060921/24be36d1/attachment.htm From timr at probo.com Thu Sep 21 22:54:34 2006 From: timr at probo.com (Tim Roberts) Date: Thu, 21 Sep 2006 13:54:34 -0700 Subject: [python-win32] "Browse" button in windows In-Reply-To: <1094.130.85.168.100.1158867486.squirrel@webmail.umbc.edu> References: <1945.130.85.169.19.1158852755.squirrel@webmail.umbc.edu> <4512DDD5.6000401@probo.com> <1094.130.85.168.100.1158867486.squirrel@webmail.umbc.edu> Message-ID: <4512FC0A.4090801@probo.com> You should always reply to the whole list so that future folks with the same question can see the answers. zhangh1 at umbc.edu wrote: >Actually, I am just using Tkinter library, but I don't know there is some >widget to access the windows file system or not. Thanks > > Yes, a few minutes with Google would have led you to this answer more quickly import tkFileDialog filename = tkFileDialog.askopenfilename() -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mhammond at skippinet.com.au Fri Sep 22 04:18:31 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 22 Sep 2006 12:18:31 +1000 Subject: [python-win32] How to implement a COM interface (that is notpart In-Reply-To: Message-ID: <13be01c6dded$665d8370$050a0a0a@enfoldsystems.local> > Thanks for your help -- I searched around some more and I think I > have the basic idea down -- if you want to implement a COM > interface, it should > look something like this: That all looks correct! > import win32com.server.util > qnotify = win32com.server.util.wrap(Q()) Try adding useDispatcher=1 as a param to wrap. That will cause the object to use a "debug" dispatcher, and should spew print statements to win32traceutil - ie, the same as if the object was registered with "--debug" (but as this object is not registered at all, --debug isn't an option; the param to wrap is though). > Sometimes the OnQuoteData callback is > invoked with an int (the int is 1240772, if that means anything) > instead of the quote datatype as advertised. Sometimes the interpreter > crashes. Ack - that can't be good. What is the makepy generated code for OnQuoteData? > However, I suspect that the above code is correct, unless I > am still doing something wrong. (Perhaps using wrap is not the right > function for creating an object that is passed as an argument to > another COM function?) It all looks ok to me, so I'm not really able to offer much more help at this stage. Mark From kenchanningphd at gmail.com Fri Sep 22 06:36:12 2006 From: kenchanningphd at gmail.com (Ken Channing) Date: Thu, 21 Sep 2006 21:36:12 -0700 Subject: [python-win32] How to implement a COM interface (that is notpart In-Reply-To: <13be01c6dded$665d8370$050a0a0a@enfoldsystems.local> References: <13be01c6dded$665d8370$050a0a0a@enfoldsystems.local> Message-ID: > Try adding useDispatcher=1 as a param to wrap. That will cause the object > to use a "debug" dispatcher, and should spew print statements to > win32traceutil - ie, the same as if the object was registered with "--debug" > (but as this object is not registered at all, --debug isn't an option; the > param to wrap is though). Thanks for this tip! Unfortunately, the few times I tried running it, there wasn't any output before crashing, but I'll keep at it and see if it turns up anything. > > Sometimes the OnQuoteData callback is > > invoked with an int (the int is 1240772, if that means anything) > > instead of the quote datatype as advertised. Sometimes the interpreter > > crashes. > > Ack - that can't be good. What is the makepy generated code for > OnQuoteData? I think because it is an interface, makepy only generated these v_table entries: IMbtQuotesNotify_vtables_dispatch_ = 0 IMbtQuotesNotify_vtables_ = [ (( 'OnQuoteData' , 'pQuote' , ), 1610678272, (1610678272, (), [ (36, 1, None, None) , ], 1 , 1 , 4 , 0 , 12 , (3, 0, None, None) , 0 , )), (( 'OnLevel2Data' , 'pRec' , ), 1610678273, (1610678273, (), [ (36, 1, None, None) , ], 1 , 1 , 4 , 0 , 16 , (3, 0, None, None) , 0 , )), (( 'OnTSData' , 'pRec' , ), 1610678274, (1610678274, (), [ (36, 1, None, None) , ], 1 , 1 , 4 , 0 , 20 , (3, 0, None, None) , 0 , )), (( 'OnOptionsData' , 'pRec' , ), 1610678275, (1610678275, (), [ (36, 1, None, None) , ], 1 , 1 , 4 , 0 , 24 , (3, 0, None, None) , 0 , )), ] Is the custom of passing an object that implements an interface as an argument to a COM function an unusual one? I've searched for other COM functions that do this, and have yet to find any. The most common way of registering an event sink for most COM applications seems to be overriding the callback functions on a COM object directly. Thanks for all your help! From derickvn at gmail.com Fri Sep 22 08:56:07 2006 From: derickvn at gmail.com (Derick Van Niekerk) Date: Fri, 22 Sep 2006 08:56:07 +0200 Subject: [python-win32] Module not found weirdness In-Reply-To: <4512FE43.5060700@probo.com> References: <32dab3890609200009s5670170bwf6f96448dc623589@mail.gmail.com> <32dab3890609210100k68d9dd77pa8a322ebb0fdd7db@mail.gmail.com> <4512C6DD.3060705@probo.com> <32dab3890609211206s42bd634eg9de7ab7a8edacb86@mail.gmail.com> <4512FE43.5060700@probo.com> Message-ID: <32dab3890609212356s3c3e285ct40248eb34acc74f0@mail.gmail.com> On 9/21/06, Tim Roberts wrote: > > Derick Van Niekerk wrote: > > > Here's my log file... > > > > I hope it helps with figuring out the problem > > > Well, there's a lot of stuff running here, but nothing that immediately > stands out. > > You're running both D-Link's AirPlus G utility and the Alpha Networks > wireless utility. Is that intentional? I assumed the two were related. I'll disable the Alpha Networks dirver and see what happens. "Evernote" might be inserting hooks to intercept the clipboard. You > might try turning it off for one run as a test. You should be able to > disable and enable it with "msconfig", on the Startup tag. I've already tried uninstalling both Google Talk and Evernote, but it didn't affect my errant program at all, so I reinstalled it. I run both at work as well so, I wasn't too surprised that they weren't the culprits I've recently heard of some troubles with the AVG monitor, AVG7_CC, > which you are running. Again, you might try turning it off for one run > using "msconfig". > I still think you're right about the AVG thing - I'll uninstall it tonight and see what happens. It's so strange that the program worked after disabling AVG control panel the first time (I only disabled the control panel, not the actual program the first time) while I had no luck after rebooting. I'll uninstall everything in that hijaakthis.log and add them one by one until something breaks. Assuming it works when I uninstall everything :-\ -d- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060922/53ee40b0/attachment.htm From Ben.Young at risk.sungard.com Fri Sep 22 17:26:36 2006 From: Ben.Young at risk.sungard.com (Ben.Young at risk.sungard.com) Date: Fri, 22 Sep 2006 16:26:36 +0100 Subject: [python-win32] Setting string properties Message-ID: Hi there, Am I being stupid somewhere here? I have a class defined (code below) which has a property which is get and put. Here is a sample session of using it: >>> slice.Value u'18.000000' >>> slice.Value = "19.0" Traceback (most recent call last): File "", line 1, in ? File "c:\Python24\lib\site-packages\win32com\client\__init__.py", line 462, in __setattr__ raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) AttributeError: '' object has no attribute 'Value' >>> slice.SetValue Traceback (most recent call last): File "", line 1, in ? File "c:\Python24\lib\site-packages\win32com\client\__init__.py", line 454, in __getattr__ raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) AttributeError: '' object has no attribute 'SetValue' Is it possible to set string properties? If so, what am I doing wrong? Thanks for your help! Cheers, Ben class IPanScriptTFOSlice2(DispatchBaseClass): """PanScript TFO Slice.""" CLSID = IID('{6BA870D0-055A-11D4-ABE3-00C04F9D382F}') coclass_clsid = IID('{0E362F40-0587-11D4-ABE3-00C04F9D382F}') # Result is of type IPanScriptTFOSlice # The method Slice is actually a property, but must be used as a method to correctly pass the arguments def Slice(self, Index=defaultNamedNotOptArg): """Gets a slice by setting the first of the remaining dimensions.""" ret = self._oleobj_.InvokeTypes(5, LCID, 2, (9, 0), ((8, 1),),Index ) if ret is not None: ret = Dispatch(ret, 'Slice', '{BFD8D300-8F81-11D2-A508-00C04F718866}', UnicodeToString=0) return ret # Result is of type IPanScriptTFOSlice # The method _Default is actually a property, but must be used as a method to correctly pass the arguments def _Default(self, Index=defaultNamedNotOptArg): """Default action. Gets a slice by setting the first of the remaining dimensions.""" ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((8, 1),),Index ) if ret is not None: ret = Dispatch(ret, '_Default', '{BFD8D300-8F81-11D2-A508-00C04F718866}', UnicodeToString=0) return ret _prop_map_get_ = { # Method 'Application' returns object of type 'IPanScriptApplication' "Application": (1, 2, (9, 0), (), "Application", '{70C0547D-32CF-11D2-AA93-00C04FA2F3C6}'), "CouldHaveValue": (8, 2, (11, 0), (), "CouldHaveValue", None), "DimensionOrdinal": (10, 2, (3, 0), (), "DimensionOrdinal", None), # Method 'Dimensions' returns object of type 'IPanScriptTFODimensions' "Dimensions": (4, 2, (9, 0), (), "Dimensions", '{8BB8A200-85F5-11D2-A507-00C04F718866}'), "HasValue": (7, 2, (11, 0), (), "HasValue", None), "Name": (3, 2, (8, 0), (), "Name", None), "Parent": (2, 2, (9, 0), (), "Parent", None), # Method 'ParentSlice' returns object of type 'IPanScriptTFOSlice' "ParentSlice": (9, 2, (9, 0), (), "ParentSlice", '{BFD8D300-8F81-11D2-A508-00C04F718866}'), "Value": (6, 2, (12, 0), (), "Value", None), } _prop_map_put_ = { "Value": ((6, LCID, 4, 0),()), } # Default method for this class is '_Default' def __call__(self, Index=defaultNamedNotOptArg): """Default action. Gets a slice by setting the first of the remaining dimensions.""" ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((8, 1),),Index ) if ret is not None: ret = Dispatch(ret, '__call__', '{BFD8D300-8F81-11D2-A508-00C04F718866}', UnicodeToString=0) return ret # str(ob) and int(ob) will use __call__ def __unicode__(self, *args): try: return unicode(self.__call__(*args)) except pythoncom.com_error: return repr(self) def __str__(self, *args): return str(self.__unicode__(*args)) def __int__(self, *args): return int(self.__call__(*args)) def __iter__(self): "Return a Python iterator for this object" ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) return win32com.client.util.Iterator(ob) def _NewEnum(self): "Create an enumerator from this object" return win32com.client.util.WrapEnum(self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()),None) def __getitem__(self, index): "Allow this class to be accessed as a collection" if not self.__dict__.has_key('_enum_'): self.__dict__['_enum_'] = self._NewEnum() return self._enum_.__getitem__(index) Ben Young - Software Engineer SunGard - Enterprise House, Vision Park, Histon, Cambridge, CB4 9ZR Tel +44 1223 266049 - Main +44 1223 266000 - http://www.sungard.com/ CONFIDENTIALITY: This email (including any attachments) may contain confidential, proprietary and privileged information, and unauthorized disclosure or use is prohibited. If you received this email in error, please notify the sender and delete this email from your system. Thank you. From derickvn at gmail.com Fri Sep 22 20:07:24 2006 From: derickvn at gmail.com (Derick Van Niekerk) Date: Fri, 22 Sep 2006 20:07:24 +0200 Subject: [python-win32] Module not found weirdness In-Reply-To: <32dab3890609212356s3c3e285ct40248eb34acc74f0@mail.gmail.com> References: <32dab3890609200009s5670170bwf6f96448dc623589@mail.gmail.com> <32dab3890609210100k68d9dd77pa8a322ebb0fdd7db@mail.gmail.com> <4512C6DD.3060705@probo.com> <32dab3890609211206s42bd634eg9de7ab7a8edacb86@mail.gmail.com> <4512FE43.5060700@probo.com> <32dab3890609212356s3c3e285ct40248eb34acc74f0@mail.gmail.com> Message-ID: <32dab3890609221107q77257234lea557dacc00b2f04@mail.gmail.com> > > I'll uninstall everything in that hijaakthis.log and add them one by one > until > something breaks. Assuming it works when I uninstall everything :-\ > > -d- Even after completely uninstalling every memory resident program I installed, I still get the same error: pywintypes.error: (126, 'SetClipboardViewer', 'The specified module could not be found.') What gets me is that it worked after following your instructions the first time. I don't know if it was because I disabled AVG, I just know that it worked at least once. So there has to be a way to make it work again. -d- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060922/4a8e0a1a/attachment.html From mbrighton at neuropace.com Sat Sep 23 01:25:01 2006 From: mbrighton at neuropace.com (Mark C. Brighton) Date: Fri, 22 Sep 2006 16:25:01 -0700 Subject: [python-win32] Newbie question Message-ID: <704BA3F951BFE84B92F3B773D506C07482DEF6@laguna.neuropace.com> Hello, I don't really have experience using win32com and I'm running into a problem. I'm trying to use a COM object. Several of the functions take strings as arguments, but when I pass in a string I get an exception: >>> import win32com.client >>> o=win32com.client.gencache.EnsureDispatch("AT91Boot_DLL.AT91BootDLL.1") >>> o.AT91Boot_Open("/usb/ARM0") Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\site-packages\win32com\gen_py\A3983AFB-180A-4751-B69B-D5496C253EF2x0x1x0.py", line 52, in AT91Boot_Open , h_handle) File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 446, in _ApplyTypes_ return self._get_good_object_( ValueError: invalid literal for int(): /usb/ARM0 The documentation claims that the argument is a pointer to a string. Looking in PythonWin's COM browser, it appears that the object is expecting an integer pointer. Is there a way to get around this? The DLL in question can be found in: http://atmel.com/dyn/resources/prod_documents/at91_isp_V14.zip Thanks, Mark Brighton Senior Software Engineer NeuroPace From mhammond at skippinet.com.au Sat Sep 23 02:25:33 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 23 Sep 2006 10:25:33 +1000 Subject: [python-win32] Newbie question In-Reply-To: <704BA3F951BFE84B92F3B773D506C07482DEF6@laguna.neuropace.com> Message-ID: <18ae01c6dea6$db500630$050a0a0a@enfoldsystems.local> > Hello, I don't really have experience using win32com and I'm > running into a problem. I'm trying to use a COM object. > Several of the functions take strings as arguments, but when > I pass in a string I get an exception: ... > > The documentation claims that the argument is a pointer to a > string. Looking in PythonWin's COM browser, it appears that > the object is expecting an integer pointer. Is there a way to > get around this? If the typelib specifies an integer, that it probably more correct than the docs. I'd suggest you try the MS COM browser, and if that still says it wants an int, then contract the author of the COM object. Sorry I can't be more help. Mark -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 1900 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20060923/ca4a81c4/attachment.bin From mhammond at skippinet.com.au Sat Sep 23 02:29:31 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 23 Sep 2006 10:29:31 +1000 Subject: [python-win32] Setting string properties In-Reply-To: Message-ID: <18b201c6dea7$59163490$050a0a0a@enfoldsystems.local> The only thing I can notice is: > AttributeError: ' Objects).IPanScriptTFOSlice instance at 0x11496344>' object has no > attribute 'Value' ... > class IPanScriptTFOSlice2(DispatchBaseClass): > """PanScript TFO Slice.""" > CLSID = IID('{6BA870D0-055A-11D4-ABE3-00C04F9D382F}') ... Note that you pasted in the incorrect interface definition - your code is not using the version with '2' at the end. Without knowing the typelib in question, I can't suggest how you get the interface you expect. Cheers, Mark From mhammond at skippinet.com.au Sat Sep 23 02:30:59 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 23 Sep 2006 10:30:59 +1000 Subject: [python-win32] How to implement a COM interface (that is notpart In-Reply-To: Message-ID: <18b301c6dea7$8b8483a0$050a0a0a@enfoldsystems.local> > Is the custom of passing an object that implements an interface as an > argument to a COM function an unusual one? Yes - but you must be careful of threading rules - ie, you can *not* simply pass the pointer to a different thread that make the actual callback. > I've searched for other > COM functions that do this, and have yet to find any. The most common > way of registering an event sink for most COM applications seems to be > overriding the callback functions on a COM object directly. Yeah, COM events generally use 'connection points' - but even then, the thread-rules must be followed. Mark From timr at probo.com Sat Sep 23 03:06:23 2006 From: timr at probo.com (Tim Roberts) Date: Fri, 22 Sep 2006 18:06:23 -0700 Subject: [python-win32] Newbie question In-Reply-To: <704BA3F951BFE84B92F3B773D506C07482DEF6@laguna.neuropace.com> References: <704BA3F951BFE84B92F3B773D506C07482DEF6@laguna.neuropace.com> Message-ID: <4514888F.2040109@probo.com> Mark C. Brighton wrote: >Hello, I don't really have experience using win32com and I'm running into a problem. I'm trying to use a COM object. Several of the functions take strings as arguments, but when I pass in a string I get an exception: > > > >>>>import win32com.client >>>>o=win32com.client.gencache.EnsureDispatch("AT91Boot_DLL.AT91BootDLL.1") >>>>o.AT91Boot_Open("/usb/ARM0") >>>> >>>> >Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\site-packages\win32com\gen_py\A3983AFB-180A-4751-B69B-D5496C253EF2x0x1x0.py", line 52, in AT91Boot_Open > , h_handle) > File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 446, in _ApplyTypes_ > return self._get_good_object_( >ValueError: invalid literal for int(): /usb/ARM0 > >The documentation claims that the argument is a pointer to a string. Looking in PythonWin's COM browser, it appears that the object is expecting an integer pointer. Is there a way to get around this? > > The people who wrote this must have been idiots. They do want a string, but they declared all the string parameters as "unsigned char *" instead of "char *". I don't know how to make this work with Python. By the way, it wasn't entirely reasonable of you to expect us to download and install an 11 megabyte product just for one 85k byte dll. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060922/70db0b2b/attachment.html From mhammond at skippinet.com.au Sat Sep 23 03:23:57 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 23 Sep 2006 11:23:57 +1000 Subject: [python-win32] pywin32 build 210 released Message-ID: <18ed01c6deae$f1a7a750$050a0a0a@enfoldsystems.local> Hi all, I've just released pywin32 build 210. As usual, lots of thanks go to Roger Upole who again contributed significant changes - the full change notes are at: https://sourceforge.net/project/shownotes.php?release_id=449591 Now that 2.5 has been released, you will also find a 2.6 package for use with the CVS version of Python. Get it now via https://sourceforge.net/project/showfiles.php?group_id=78018 Cheers, Mark From msherman77 at yahoo.com Sat Sep 23 19:45:46 2006 From: msherman77 at yahoo.com (Michael S) Date: Sat, 23 Sep 2006 13:45:46 -0400 (EDT) Subject: [python-win32] (no subject) Message-ID: <20060923174546.44789.qmail@web88311.mail.re4.yahoo.com> Good day all. I am trying to write a short Python script to create some PDFs. I create instances of App, AVDoc and PDDoc using the following syntax: app = Dispatch("AcroExch.App") doc = Dispatch("AcroExch.AVDoc") pd = Dispatch("AcroExch.PDDoc") However when I call pd = doc.GetPDDoc(), the Python interpreter complains about the member function not being found. I know for sure that it is there, since I can execute the code in VB no problem. Any suggestions? P.S. I ran the makepy on the Adobe5 type library. From zhangh1 at umbc.edu Sun Sep 24 07:55:29 2006 From: zhangh1 at umbc.edu (zhangh1 at umbc.edu) Date: Sun, 24 Sep 2006 01:55:29 -0400 (EDT) Subject: [python-win32] plot function Message-ID: <2491.69.143.150.0.1159077329.squirrel@webmail.umbc.edu> Hi, Does Python have a library providing a plot function similiar to matlab that will plot a math plot or just some data points in a pop-up window Thanks From waldemar.osuch at gmail.com Sun Sep 24 19:20:34 2006 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Sun, 24 Sep 2006 11:20:34 -0600 Subject: [python-win32] plot function In-Reply-To: <2491.69.143.150.0.1159077329.squirrel@webmail.umbc.edu> References: <2491.69.143.150.0.1159077329.squirrel@webmail.umbc.edu> Message-ID: <6fae95540609241020j74b3d609r5f64e6df3191202a@mail.gmail.com> On 9/23/06, zhangh1 at umbc.edu wrote: > Hi, > Does Python have a library providing a plot function similiar to matlab > that will plot a math plot or just some data points in a pop-up window > Thanks > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > Check out http://matplotlib.sourceforge.net/ From justin.mailinglists at gmail.com Mon Sep 25 03:52:18 2006 From: justin.mailinglists at gmail.com (Justin Ezequiel) Date: Mon, 25 Sep 2006 09:52:18 +0800 Subject: [python-win32] AVDoc and PDDoc Message-ID: <3c6718980609241852t4d333804yf5c04c3e0c94bbe@mail.gmail.com> > From: Michael S > > I am trying to write a short Python script to create > some PDFs. > I create instances of App, AVDoc and PDDoc using the > following syntax: > app = Dispatch("AcroExch.App") > doc = Dispatch("AcroExch.AVDoc") > pd = Dispatch("AcroExch.PDDoc") > > However when I call pd = doc.GetPDDoc(), the Python > interpreter > complains about the member function not being found. I > know for sure > that it is there, since I can execute the code in VB > no problem. > was experimenting with Acrobat months ago import win32com.client.dynamic NOSAVE = -1 PDSAVEFULL = 1 class Acrobat2pdfError(RuntimeError): pass def Acrobat2pdf(src, dst): avdoc = win32com.client.dynamic.Dispatch("AcroExch.AVDoc") if not avdoc.Open(src, "doc2pdf"): raise Acrobat2pdfError("unable to open %s" % src) pddoc = avdoc.GetPDDoc() if not pddoc.Save(PDSAVEFULL, dst): raise Acrobat2pdfError("unable to save %s" % dst) if not pddoc.Close(): raise Acrobat2pdfError("unable to close %s" % dst) del pddoc if not avdoc.Close(NOSAVE): raise Acrobat2pdfError("unable to close %s" % src) del avdoc if __name__ == '__main__': import os src = r"C:\test\file1.doc" dst = r"C:\test\file2.pdf" Acrobat2pdf(src, dst) assert os.path.isfile(dst) From msherman77 at yahoo.com Mon Sep 25 04:44:57 2006 From: msherman77 at yahoo.com (Michael S) Date: Sun, 24 Sep 2006 19:44:57 -0700 (PDT) Subject: [python-win32] AVDoc and PDDoc In-Reply-To: <3c6718980609241852t4d333804yf5c04c3e0c94bbe@mail.gmail.com> Message-ID: <20060925024457.36504.qmail@web88309.mail.re4.yahoo.com> Thanks a lot Justin. I tried running your code, for some reason it just hangs. I wonder why. ----- Original Message ---- From: Justin Ezequiel To: python-win32 at python.org Sent: Sunday, September 24, 2006 9:52:18 PM Subject: Re: [python-win32] AVDoc and PDDoc > From: Michael S > > I am trying to write a short Python script to create > some PDFs. > I create instances of App, AVDoc and PDDoc using the > following syntax: > app = Dispatch("AcroExch.App") > doc = Dispatch("AcroExch.AVDoc") > pd = Dispatch("AcroExch.PDDoc") > > However when I call pd = doc.GetPDDoc(), the Python > interpreter > complains about the member function not being found. I > know for sure > that it is there, since I can execute the code in VB > no problem. > was experimenting with Acrobat months ago import win32com.client.dynamic NOSAVE = -1 PDSAVEFULL = 1 class Acrobat2pdfError(RuntimeError): pass def Acrobat2pdf(src, dst): avdoc = win32com.client.dynamic.Dispatch("AcroExch.AVDoc") if not avdoc.Open(src, "doc2pdf"): raise Acrobat2pdfError("unable to open %s" % src) pddoc = avdoc.GetPDDoc() if not pddoc.Save(PDSAVEFULL, dst): raise Acrobat2pdfError("unable to save %s" % dst) if not pddoc.Close(): raise Acrobat2pdfError("unable to close %s" % dst) del pddoc if not avdoc.Close(NOSAVE): raise Acrobat2pdfError("unable to close %s" % src) del avdoc if __name__ == '__main__': import os src = r"C:\test\file1.doc" dst = r"C:\test\file2.pdf" Acrobat2pdf(src, dst) assert os.path.isfile(dst) _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From msherman77 at yahoo.com Mon Sep 25 16:52:28 2006 From: msherman77 at yahoo.com (Michael S) Date: Mon, 25 Sep 2006 07:52:28 -0700 (PDT) Subject: [python-win32] AVDoc and PDDoc/How to force late binding Message-ID: <20060925145228.55319.qmail@web88306.mail.re4.yahoo.com> I am trying to force late binding, since obviously early binding does not discover the methods that I am trying to call. I ran the makepy -i from within PythonWin, to get those two lines I need to paste in into my script. from win32com.client import gencache gencache.EnsureModule ....... However when I run the script, I get an com_error saying that dynamic.py couldn't find a certain method? I thought that EnsureModule should force late binding. ----- Original Message ---- From: Michael S To: Justin Ezequiel ; python-win32 at python.org Sent: Sunday, September 24, 2006 10:44:57 PM Subject: Re: [python-win32] AVDoc and PDDoc Thanks a lot Justin. I tried running your code, for some reason it just hangs. I wonder why. ----- Original Message ---- From: Justin Ezequiel To: python-win32 at python.org Sent: Sunday, September 24, 2006 9:52:18 PM Subject: Re: [python-win32] AVDoc and PDDoc > From: Michael S > > I am trying to write a short Python script to create > some PDFs. > I create instances of App, AVDoc and PDDoc using the > following syntax: > app = Dispatch("AcroExch.App") > doc = Dispatch("AcroExch.AVDoc") > pd = Dispatch("AcroExch.PDDoc") > > However when I call pd = doc.GetPDDoc(), the Python > interpreter > complains about the member function not being found. I > know for sure > that it is there, since I can execute the code in VB > no problem. > was experimenting with Acrobat months ago import win32com.client.dynamic NOSAVE = -1 PDSAVEFULL = 1 class Acrobat2pdfError(RuntimeError): pass def Acrobat2pdf(src, dst): avdoc = win32com.client.dynamic.Dispatch("AcroExch.AVDoc") if not avdoc.Open(src, "doc2pdf"): raise Acrobat2pdfError("unable to open %s" % src) pddoc = avdoc.GetPDDoc() if not pddoc.Save(PDSAVEFULL, dst): raise Acrobat2pdfError("unable to save %s" % dst) if not pddoc.Close(): raise Acrobat2pdfError("unable to close %s" % dst) del pddoc if not avdoc.Close(NOSAVE): raise Acrobat2pdfError("unable to close %s" % src) del avdoc if __name__ == '__main__': import os src = r"C:\test\file1.doc" dst = r"C:\test\file2.pdf" Acrobat2pdf(src, dst) assert os.path.isfile(dst) _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From simon.dahlbacka at gmail.com Mon Sep 25 16:56:13 2006 From: simon.dahlbacka at gmail.com (Simon Dahlbacka) Date: Mon, 25 Sep 2006 17:56:13 +0300 Subject: [python-win32] AVDoc and PDDoc/How to force late binding In-Reply-To: <20060925145228.55319.qmail@web88306.mail.re4.yahoo.com> References: <20060925145228.55319.qmail@web88306.mail.re4.yahoo.com> Message-ID: <57124720609250756m5fa2a0degb490ccfc6a94ae7c@mail.gmail.com> EnsureModule forces *early* binding On 9/25/06, Michael S wrote: > > I am trying to force late binding, since obviously early binding does not > discover the methods that I am trying to call. > I ran the makepy -i from within PythonWin, to get those two lines I need > to paste in into my script. > from win32com.client import gencache > gencache.EnsureModule ....... > > However when I run the script, I get an com_error saying that dynamic.pycouldn't find a certain method? > I thought that EnsureModule should force late binding. > > > > ----- Original Message ---- > From: Michael S > To: Justin Ezequiel ; > python-win32 at python.org > Sent: Sunday, September 24, 2006 10:44:57 PM > Subject: Re: [python-win32] AVDoc and PDDoc > > Thanks a lot Justin. I tried running your code, for some reason it just > hangs. I wonder why. > > ----- Original Message ---- > From: Justin Ezequiel > To: python-win32 at python.org > Sent: Sunday, September 24, 2006 9:52:18 PM > Subject: Re: [python-win32] AVDoc and PDDoc > > > > From: Michael S > > > > I am trying to write a short Python script to create > > some PDFs. > > I create instances of App, AVDoc and PDDoc using the > > following syntax: > > app = Dispatch("AcroExch.App") > > doc = Dispatch("AcroExch.AVDoc") > > pd = Dispatch("AcroExch.PDDoc") > > > > However when I call pd = doc.GetPDDoc(), the Python > > interpreter > > complains about the member function not being found. I > > know for sure > > that it is there, since I can execute the code in VB > > no problem. > > > > was experimenting with Acrobat months ago > > import win32com.client.dynamic > > NOSAVE = -1 > PDSAVEFULL = 1 > > class Acrobat2pdfError(RuntimeError): pass > > def Acrobat2pdf(src, dst): > avdoc = win32com.client.dynamic.Dispatch("AcroExch.AVDoc") > > if not avdoc.Open(src, "doc2pdf"): > raise Acrobat2pdfError("unable to open %s" % src) > > pddoc = avdoc.GetPDDoc() > > if not pddoc.Save(PDSAVEFULL, dst): > raise Acrobat2pdfError("unable to save %s" % dst) > > if not pddoc.Close(): > raise Acrobat2pdfError("unable to close %s" % dst) > > del pddoc > > if not avdoc.Close(NOSAVE): > raise Acrobat2pdfError("unable to close %s" % src) > > del avdoc > > if __name__ == '__main__': > import os > src = r"C:\test\file1.doc" > dst = r"C:\test\file2.pdf" > Acrobat2pdf(src, dst) > assert os.path.isfile(dst) > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > > _______________________________________________ > 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/20060925/1965a01a/attachment.htm From msherman77 at yahoo.com Mon Sep 25 17:08:13 2006 From: msherman77 at yahoo.com (Michael S) Date: Mon, 25 Sep 2006 08:08:13 -0700 (PDT) Subject: [python-win32] AVDoc and PDDoc/How to force late binding In-Reply-To: <57124720609250756m5fa2a0degb490ccfc6a94ae7c@mail.gmail.com> Message-ID: <20060925150813.88906.qmail@web88302.mail.re4.yahoo.com> You are right. I made a mistake, it forces early binding. However neither late nor early can discover the AcroExch.AVdoc method I need and VB does it with no problem. By the way I can force early or late binding on the Excel.Application, but for some reason not on Acrobat classes. ----- Original Message ---- From: Simon Dahlbacka To: Michael S Cc: Justin Ezequiel ; python-win32 at python.org Sent: Monday, September 25, 2006 10:56:13 AM Subject: Re: [python-win32] AVDoc and PDDoc/How to force late binding EnsureModule forces *early* binding On 9/25/06, Michael S wrote: I am trying to force late binding, since obviously early binding does not discover the methods that I am trying to call. I ran the makepy -i from within PythonWin, to get those two lines I need to paste in into my script. from win32com.client import gencache gencache.EnsureModule ....... However when I run the script, I get an com_error saying that dynamic.py couldn't find a certain method? I thought that EnsureModule should force late binding. ----- Original Message ---- From: Michael S To: Justin Ezequiel ; python-win32 at python.org Sent: Sunday, September 24, 2006 10:44:57 PM Subject: Re: [python-win32] AVDoc and PDDoc Thanks a lot Justin. I tried running your code, for some reason it just hangs. I wonder why. ----- Original Message ---- From: Justin Ezequiel < justin.mailinglists at gmail.com> To: python-win32 at python.org Sent: Sunday, September 24, 2006 9:52:18 PM Subject: Re: [python-win32] AVDoc and PDDoc > From: Michael S < msherman77 at yahoo.com> > > I am trying to write a short Python script to create > some PDFs. > I create instances of App, AVDoc and PDDoc using the > following syntax: > app = Dispatch("AcroExch.App") > doc = Dispatch("AcroExch.AVDoc") > pd = Dispatch("AcroExch.PDDoc") > > However when I call pd = doc.GetPDDoc(), the Python > interpreter > complains about the member function not being found. I > know for sure > that it is there, since I can execute the code in VB > no problem. > was experimenting with Acrobat months ago import win32com.client.dynamic NOSAVE = -1 PDSAVEFULL = 1 class Acrobat2pdfError(RuntimeError): pass def Acrobat2pdf(src, dst): avdoc = win32com.client.dynamic.Dispatch("AcroExch.AVDoc ") if not avdoc.Open(src, "doc2pdf"): raise Acrobat2pdfError("unable to open %s" % src) pddoc = avdoc.GetPDDoc() if not pddoc.Save(PDSAVEFULL, dst): raise Acrobat2pdfError("unable to save %s" % dst) if not pddoc.Close(): raise Acrobat2pdfError("unable to close %s" % dst) del pddoc if not avdoc.Close(NOSAVE): raise Acrobat2pdfError("unable to close %s" % src) del avdoc if __name__ == '__main__': import os src = r"C:\test\file1.doc" dst = r"C:\test\file2.pdf" Acrobat2pdf(src, dst) assert os.path.isfile(dst) _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ 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/20060925/9e21a02b/attachment.htm From msherman77 at yahoo.com Mon Sep 25 17:54:05 2006 From: msherman77 at yahoo.com (Michael S) Date: Mon, 25 Sep 2006 08:54:05 -0700 (PDT) Subject: [python-win32] How to force late binding/Solved In-Reply-To: <57124720609250810p3a62d2f5sba0cc50e6410e091@mail.gmail.com> Message-ID: <20060925155405.86280.qmail@web88303.mail.re4.yahoo.com> Thanks for you help. The problem apparentely was in the parenthesis. I dropped the parenthesis from GetPDDoc and things started to work! ----- Original Message ---- From: Simon Dahlbacka To: Michael S Sent: Monday, September 25, 2006 11:10:16 AM Subject: Re: [python-win32] AVDoc and PDDoc/How to force late binding Early bound code is case sensitive, so have you checked that you've got your casings correct? On 9/25/06, Michael S wrote: You are right. I made a mistake, it forces early binding. However neither late nor early can discover the AcroExch.AVdoc method I need and VB does it with no problem. By the way I can force early or late binding on the Excel.Application, but for some reason not on Acrobat classes. ----- Original Message ---- From: Simon Dahlbacka < simon.dahlbacka at gmail.com> To: Michael S Cc: Justin Ezequiel < justin.mailinglists at gmail.com>; python-win32 at python.org Sent: Monday, September 25, 2006 10:56:13 AM Subject: Re: [python-win32] AVDoc and PDDoc/How to force late binding EnsureModule forces *early* binding On 9/25/06, Michael S wrote: I am trying to force late binding, since obviously early binding does not discover the methods that I am trying to call. I ran the makepy -i from within PythonWin, to get those two lines I need to paste in into my script. from win32com.client import gencache gencache.EnsureModule ....... However when I run the script, I get an com_error saying that dynamic.py couldn't find a certain method? I thought that EnsureModule should force late binding. ----- Original Message ---- From: Michael S < msherman77 at yahoo.com > To: Justin Ezequiel ; python-win32 at python.org Sent: Sunday, September 24, 2006 10:44:57 PM Subject: Re: [python-win32] AVDoc and PDDoc Thanks a lot Justin. I tried running your code, for some reason it just hangs. I wonder why. ----- Original Message ---- From: Justin Ezequiel < justin.mailinglists at gmail.com> To: python-win32 at python.org Sent: Sunday, September 24, 2006 9:52:18 PM Subject: Re: [python-win32] AVDoc and PDDoc > From: Michael S < msherman77 at yahoo.com > > > I am trying to write a short Python script to create > some PDFs. > I create instances of App, AVDoc and PDDoc using the > following syntax: > app = Dispatch("AcroExch.App ") > doc = Dispatch("AcroExch.AVDoc") > pd = Dispatch("AcroExch.PDDoc") > > However when I call pd = doc.GetPDDoc(), the Python > interpreter > complains about the member function not being found. I > know for sure > that it is there, since I can execute the code in VB > no problem. > was experimenting with Acrobat months ago import win32com.client.dynamic NOSAVE = -1 PDSAVEFULL = 1 class Acrobat2pdfError(RuntimeError): pass def Acrobat2pdf(src, dst): avdoc = win32com.client.dynamic.Dispatch("AcroExch.AVDoc ") if not avdoc.Open(src, "doc2pdf"): raise Acrobat2pdfError("unable to open %s" % src) pddoc = avdoc.GetPDDoc() if not pddoc.Save(PDSAVEFULL, dst): raise Acrobat2pdfError("unable to save %s" % dst) if not pddoc.Close(): raise Acrobat2pdfError("unable to close %s" % dst) del pddoc if not avdoc.Close(NOSAVE): raise Acrobat2pdfError("unable to close %s" % src) del avdoc if __name__ == '__main__': import os src = r"C:\test\file1.doc" dst = r"C:\test\file2.pdf" Acrobat2pdf(src, dst) assert os.path.isfile(dst) _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ 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/20060925/6a655dd7/attachment-0001.htm From msherman77 at yahoo.com Mon Sep 25 18:58:00 2006 From: msherman77 at yahoo.com (Michael S) Date: Mon, 25 Sep 2006 09:58:00 -0700 (PDT) Subject: [python-win32] printing to PDF Message-ID: <20060925165800.4577.qmail@web88312.mail.re4.yahoo.com> Now that I resolved the PDF generation issue, I have another question. I am trying to print numerous word documents to pdf, using the "Acrobat PDFWriter". I do it in the following way: for i in range(1, 16): doc_file = "ish0%.2d.doc" % i pdf_file = "ish0%.2d.pdf" % i self.word_app.Documents.Open(self.dir_name+doc_file) self.word_app.Documents(self.dir_name+doc_file).PrintOut(Background=True,\ OutputFileName=pdf_file, PrintToFile=True) time.sleep(2) self.word_app.Documents(self.dir_name+doc_file).Close() My problem is that I am prompted for a file name for every pdf file being printed, even though I supply one. Is there a way to avoid the File Save dialog popping up? Thanks in advance. ----- Original Message ---- From: Michael S To: Simon Dahlbacka ; python-win32 at python.org Sent: Monday, September 25, 2006 11:54:05 AM Subject: Re: [python-win32] How to force late binding/Solved Thanks for you help. The problem apparentely was in the parenthesis. I dropped the parenthesis from GetPDDoc and things started to work! ----- Original Message ---- From: Simon Dahlbacka To: Michael S Sent: Monday, September 25, 2006 11:10:16 AM Subject: Re: [python-win32] AVDoc and PDDoc/How to force late binding Early bound code is case sensitive, so have you checked that you've got your casings correct? On 9/25/06, Michael S wrote: You are right. I made a mistake, it forces early binding. However neither late nor early can discover the AcroExch.AVdoc method I need and VB does it with no problem. By the way I can force early or late binding on the Excel.Application, but for some reason not on Acrobat classes. ----- Original Message ---- From: Simon Dahlbacka < simon.dahlbacka at gmail.com> To: Michael S Cc: Justin Ezequiel < justin.mailinglists at gmail.com>; python-win32 at python.org Sent: Monday, September 25, 2006 10:56:13 AM Subject: Re: [python-win32] AVDoc and PDDoc/How to force late binding EnsureModule forces *early* binding On 9/25/06, Michael S wrote: I am trying to force late binding, since obviously early binding does not discover the methods that I am trying to call. I ran the makepy -i from within PythonWin, to get those two lines I need to paste in into my script. from win32com.client import gencache gencache.EnsureModule ....... However when I run the script, I get an com_error saying that dynamic.py couldn't find a certain method? I thought that EnsureModule should force late binding. ----- Original Message ---- From: Michael S < msherman77 at yahoo.com > To: Justin Ezequiel ; python-win32 at python.org Sent: Sunday, September 24, 2006 10:44:57 PM Subject: Re: [python-win32] AVDoc and PDDoc Thanks a lot Justin. I tried running your code, for some reason it just hangs. I wonder why. ----- Original Message ---- From: Justin Ezequiel < justin.mailinglists at gmail.com> To: python-win32 at python.org Sent: Sunday, September 24, 2006 9:52:18 PM Subject: Re: [python-win32] AVDoc and PDDoc > From: Michael S < msherman77 at yahoo.com > > > I am trying to write a short Python script to create > some PDFs. > I create instances of App, AVDoc and PDDoc using the > following syntax: > app = Dispatch("AcroExch.App ") > doc = Dispatch("AcroExch.AVDoc") > pd = Dispatch("AcroExch.PDDoc") > > However when I call pd = doc.GetPDDoc(), the Python > interpreter > complains about the member function not being found. I > know for sure > that it is there, since I can execute the code in VB > no problem. > was experimenting with Acrobat months ago import win32com.client.dynamic NOSAVE = -1 PDSAVEFULL = 1 class Acrobat2pdfError(RuntimeError): pass def Acrobat2pdf(src, dst): avdoc = win32com.client.dynamic.Dispatch("AcroExch.AVDoc ") if not avdoc.Open(src, "doc2pdf"): raise Acrobat2pdfError("unable to open %s" % src) pddoc = avdoc.GetPDDoc() if not pddoc.Save(PDSAVEFULL, dst): raise Acrobat2pdfError("unable to save %s" % dst) if not pddoc.Close(): raise Acrobat2pdfError("unable to close %s" % dst) del pddoc if not avdoc.Close(NOSAVE): raise Acrobat2pdfError("unable to close %s" % src) del avdoc if __name__ == '__main__': import os src = r"C:\test\file1.doc" dst = r"C:\test\file2.pdf" Acrobat2pdf(src, dst) assert os.path.isfile(dst) _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060925/e0cf2506/attachment.html From gagsl-p32 at yahoo.com.ar Tue Sep 26 07:22:53 2006 From: gagsl-p32 at yahoo.com.ar (Gabriel Genellina) Date: Tue, 26 Sep 2006 02:22:53 -0300 Subject: [python-win32] plot function In-Reply-To: <2491.69.143.150.0.1159077329.squirrel@webmail.umbc.edu> References: <2491.69.143.150.0.1159077329.squirrel@webmail.umbc.edu> Message-ID: <7.0.1.0.0.20060926022226.040dbe48@yahoo.com.ar> At Sunday 24/9/2006 02:55, zhangh1 at umbc.edu wrote: >Does Python have a library providing a plot function similiar to matlab >that will plot a math plot or just some data points in a pop-up window pychart may be useful Gabriel Genellina Softlab SRL __________________________________________________ Pregunt?. Respond?. Descubr?. Todo lo que quer?as saber, y lo que ni imaginabas, est? en Yahoo! Respuestas (Beta). ?Probalo ya! http://www.yahoo.com.ar/respuestas From niki at vintech.bg Tue Sep 26 11:12:04 2006 From: niki at vintech.bg (Niki Spahiev) Date: Tue, 26 Sep 2006 12:12:04 +0300 Subject: [python-win32] pywin32 build 210 released In-Reply-To: <18ed01c6deae$f1a7a750$050a0a0a@enfoldsystems.local> References: <18ed01c6deae$f1a7a750$050a0a0a@enfoldsystems.local> Message-ID: <4518EEE4.2020200@vintech.bg> version for 2.4 installs file: pywin32-210-py2.6.egg-info IAUC it must be py2.4.egg? Niki Spahiev From mhammond at skippinet.com.au Wed Sep 27 00:50:02 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 27 Sep 2006 08:50:02 +1000 Subject: [python-win32] pywin32 build 210 released In-Reply-To: <4518EEE4.2020200@vintech.bg> Message-ID: <267601c6e1be$1b24cbf0$050a0a0a@enfoldsystems.local> > version for 2.4 installs file: > > pywin32-210-py2.6.egg-info > > IAUC it must be py2.4.egg? Hrmph - I never asked for *any* egg file to be created. I'm guessing that the simple fact I previously installed setuptools caused this side-effect. I'll try and remember to dig deeper before the next release. Mark From smithbk at aecl.ca Thu Sep 28 17:20:54 2006 From: smithbk at aecl.ca (Smith, Brian (CR)) Date: Thu, 28 Sep 2006 11:20:54 -0400 Subject: [python-win32] Input-only vs. In/Out Function Parameters Message-ID: Hello, I am new to COM programming and have a question about function parameters when implementing a COM object in Python. After reading "Python Programming on Win32", I have managed to create a working COM object, where "working" is defined as "I can use it from Excel VBA". I have a function like this: def func(self, in1, inout1, in2, inout2) where the in* parameters are input only and inout* are input and output. At the end of the function I return an error code and new values for the in/out parameters. I.e.: return( errorCode, new_inout1, new_inout2 ) This seems to work fine if it is called from VBA as errorCode = object.func( CONSTANT_1, var1, CONSTANT_2, var2 ) or errorCode = object.func( 42, var1, 7.4, var2 ) but it breaks if the VB program does this: c1 = CONSTANT_1 ' c1 is a previously declared variable c2 = 7.4 ' c2 is a previously declared variable errorCode = object.func( c1, var1, c2, var2 ) because c1 will then be assigned new_inout1 and var1 will be assigned new_inout2, while c2 and var2 will not be assigned anything. Short of telling the VB programmer "Don't do that", how do I prevent this problem? Thanks, Brian CONFIDENTIAL AND PRIVILEGED INFORMATION NOTICE This e-mail, and any attachments, may contain information that is confidential, subject to copyright, or exempt from disclosure. Any unauthorized review, disclosure, retransmission, dissemination or other use of or reliance on this information may be unlawful and is strictly prohibited. AVIS D'INFORMATION CONFIDENTIELLE ET PRIVIL?GI?E Le pr?sent courriel, et toute pi?ce jointe, peut contenir de l'information qui est confidentielle, r?gie par les droits d'auteur, ou interdite de divulgation. Tout examen, divulgation, retransmission, diffusion ou autres utilisations non autoris?es de l'information ou d?pendance non autoris?e envers celle-ci peut ?tre ill?gale et est strictement interdite. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060928/ede68ec4/attachment.html From torriem at chem.byu.edu Thu Sep 28 19:08:18 2006 From: torriem at chem.byu.edu (Michael L Torrie) Date: Thu, 28 Sep 2006 11:08:18 -0600 Subject: [python-win32] loading and unloading python24.dll in an embedded situation Message-ID: <1159463298.20064.16.camel@isengard> I have a problem with an embedded application that loads python24.dll. Basically my embedded application is itself a dll that is a plugin for another application. my dll is loaded and unloaded on demand. I do have my dllmain stuff initialize and finalize python when appropriate. This works most of the time. The problem is that if python loads any modules that use dlls, such as win32gui, when my dll is unloaded the pywintypes.dll does not get unloaded (neither does python24.dll for that matter). Having python24.dll sticking around doesn't seem to be a problem, but unfortunately the pywintypes.dll is a problem. When my dll is loaded the second time, something fails (probably when pywintypes.dll is asked to initialize again). So my question is, is there any way to get these dlls unloaded? If not, I guess I'll have to resort to putting python in a separate process and communicating with it via an IPC mechanism, which is not something I want to do. thanks. Michael From mhammond at skippinet.com.au Fri Sep 29 01:33:00 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 29 Sep 2006 09:33:00 +1000 Subject: [python-win32] loading and unloading python24.dll in an embeddedsituation In-Reply-To: <1159463298.20064.16.camel@isengard> Message-ID: <2cf101c6e356$71cdc080$050a0a0a@enfoldsystems.local> > So my question is, is there any way to get these dlls unloaded? Nope :( Python loads libraries for extension modules, but never unloads them. I'd suggest just never finalizing Python! Mark From torriem at chem.byu.edu Fri Sep 29 02:11:15 2006 From: torriem at chem.byu.edu (Michael Torrie) Date: Thu, 28 Sep 2006 18:11:15 -0600 Subject: [python-win32] loading and unloading python24.dll in an embeddedsituation In-Reply-To: <2cf101c6e356$71cdc080$050a0a0a@enfoldsystems.local> References: <2cf101c6e356$71cdc080$050a0a0a@enfoldsystems.local> Message-ID: <1159488676.950.1.camel@enterprise.local.lan> On Fri, 2006-09-29 at 09:33 +1000, Mark Hammond wrote: > > So my question is, is there any way to get these dlls unloaded? > > Nope :( Python loads libraries for extension modules, but never unloads > them. > > I'd suggest just never finalizing Python! Hmm. I'll have to look into that. IT just might work since even though my dll is unloaded, the python dll remains in memory (presumably in the same state I left it). If not, I guess I'll have to go down a different path. Michael > > Mark >