From mhammond at skippinet.com.au Mon Oct 1 01:32:40 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 1 Oct 2007 09:32:40 +1000 Subject: [python-win32] type mismatch using win32com.client.GetObject In-Reply-To: <9ba59fb50709281130r176ec3c3nac7cbf836242231e@mail.gmail.com> References: <9ba59fb50709281130r176ec3c3nac7cbf836242231e@mail.gmail.com> Message-ID: <110901c803ba$34dd5520$9e97ff60$@com.au> > So I have a Visual Basic script in Excel which connects via com to programX and retrieves > data. The COM function takes 7 required arguments. arg1-6 are set equal to values to > determine what data to fetch. arg7 is the variant in which the function returns > the fetched data. > In VB it works like this: > Private Function functionX(arg1 As Long, arg2 As Integer, arg3 As Long, > arg4 As Long, arg5 As Boolean, arg6 As Long) As Variant What makes you think there is an 'arg7' at all then? Aren't we just talking about a simple return type? If it truly was an arg7, then VB would insist you treat it as such (ie, by passing it as a true argument and it being declared 'byref') > When I try this in python, I get a type mismatch, for the apparent reason that arg7 is > not a variant. What gives you that impression? Sadly, you haven't provided the rest of your code so we can see what types you are actually passing. > So I'm at a loss as to how to force passing arg7 as a variant type. I'm not at all convinced that 'arg7' exists at all given your description, so attempting to pass one could well cause such an error. You might be confused by looking at the C++ implementation of the object, where you do see it as an 'arg7', but you should ignore that implementation detail - whan called via IDispatch, the C++ implementation isn't really relevant. Mark From ssims at spsu.edu Mon Oct 1 18:01:08 2007 From: ssims at spsu.edu (Seth Sims) Date: Mon, 1 Oct 2007 12:01:08 -0400 (EDT) Subject: [python-win32] newby to com and a problem with events Message-ID: <20071001120108.ACT19019@mira.spsu.edu> Hello everyone, I am having a problem receiving events from some com objects I am working with. win32com has performed beautifully so far and the code can call methods and manipulate properties with no problems. However I cannot seem to figure out why I am not receiving events. It is probably just a lack of knowledge on my part about com but thats why I am asking. The com object that this code accesses follows a specification for talking to point of sale devices called OPOS. In particular it is a control for a magnetic stripe reader device. I need to receive the DataEvent event from the control. I am using the method prototypes from the makepy utility for the event class but I never see their print statements executed on my output. The DataEvent is being fired though the various card properties are not filled in until the event is generated and those show up every time. Also I have used the ActiveX test shell from vc++ 6 and it receives the events. In the output I have scrubbed the card number and name (its actually a fake test card but it seems safer this way) but the data is there and correct. Thank you for your help in advance. -Seth Sims -----------event.py------------- import win32com.client as client import pythoncom class OPOSEventSink: def OnDirectIOEvent(self, EventNumber, pData, pString): """method DirectIOEvent""" print "direct io" def OnDataEvent(self, Status): """method DataEvent""" print "data" def OnStatusUpdateEvent(self, Data): """method StatusUpdateEvent""" print "status update" def OnErrorEvent(self, ResultCode, ResultCodeExtended, ErrorLocus, pErrorResponse): """method ErrorEvent""" print "error" if __name__ == '__main__': msr = client.DispatchWithEvents("OPOS.MSR", OPOSEventSink) #Ready the device msr.Open("Ing6XXX") msr.ClaimDevice(-1) #setup the magnetic stripe reader #tell the device to turn its self off when a swipe is read msr.AutoDisable = True msr.DataEventEnabled = True #read all 4 tracks msr.TracksToRead = 0xf #hold events till I tell you to send them msr.FreezeEvents = True #turn the device on msr.DeviceEnabled = True print "please swipe a card" #when this loop finishes there has #been a successful swipe of a card #and a data event is waiting to be #released in the com object while msr.DataCount < 1: pass #by the OPOS specification these #attributes are set as blank strings #until a data event is fired print 'before unfreezing events should be blank' print 'Account number:', msr.AccountNumber, \ '\nName:', msr.Surname, '\n' #release the events msr.FreezeEvents = False print 'events thawed should still be blank' print 'Account number:', msr.AccountNumber, \ '\nName:', msr.Surname, '\n' pythoncom.PumpWaitingMessages() print 'after pump waiting messages now the values should be there' print 'Account number:', msr.AccountNumber, \ '\nName:', msr.Surname, '\n' msr.ReleaseDevice() msr.Close() ---------- Output ------------- please swipe a card before unfreezing events should be blank Account number: Name: events thawed should still be blank Account number: Name: after pump waiting messages now the values should be there Account number: Name: From carl at personnelware.com Mon Oct 1 20:30:24 2007 From: carl at personnelware.com (Carl Karsten) Date: Mon, 01 Oct 2007 13:30:24 -0500 Subject: [python-win32] burning dvds Message-ID: <47013CC0.5020406@personnelware.com> Friend is trying to replace an active-x control with some calls to 'native' windows stuff for backing up data to a multi-session CD or DVD. If anyone here has some nifty python code that does something similar, it might help. In case it matters, Here are some references he is looking at: http://msdn2.microsoft.com/en-us/library/aa366443.aspx And the VFP code he is trying to use that is failing: oDiscMaster2 = CREATEOBJECT("IMAPI2.MsftDiscMaster2") oDiscRecorder2 = CreateObject("IMAPI2.MsftDiscRecorder2") oFileSystemImage = CREATEOBJECT("IMAPI2FS.MsftFileSystemImage") oDiscFormat2Data = CREATEOBJECT("IMAPI2.MsftDiscFormat2Data") oDiscRecorder2.InitializeDiscRecorder(oDiscMaster2.Item(0)) oDiscFormat2Data.Recorder = oDiscRecorder2 oFileSystemImage.FreeMediaBlocks = oDiscFormat2Data.FreeSectorsOnMedia IF oDiscFormat2Data.NextWritableAddress > 0 oFileSystemImage.MultisessionInterfaces = oDiscFormat2Data.MultisessionInterfaces oFileSystemImage.ImportFileSystem() ENDIF Carl K From rwupole at msn.com Mon Oct 1 23:56:59 2007 From: rwupole at msn.com (Roger Upole) Date: Mon, 1 Oct 2007 17:56:59 -0400 Subject: [python-win32] newby to com and a problem with events Message-ID: Seth Sims wrote: > Hello everyone, > > I am having a problem receiving events from some com objects I am working with. win32com has performed beautifully so far > and the code can call methods and manipulate properties with no problems. However I cannot seem to figure out why I am not > receiving events. It is probably just a lack of knowledge on my part about com but thats why I am asking. > The com object that this code accesses follows a specification for talking to point of sale devices called OPOS. In > particular it is a control for a magnetic stripe reader device. I need to receive the DataEvent event from the control. I am > using the method prototypes from the makepy utility for the event class but I never see their print statements executed on my > output. > The DataEvent is being fired though the various card properties are not filled in until the event is generated and those > show up every time. Also I have used the ActiveX test shell from vc++ 6 and it receives the events. In the output I have > scrubbed the card number and name (its actually a fake test card but it seems safer this way) but the data is there and > correct. Thank you for your help in advance. > > -Seth Sims > > > -----------event.py------------- > > import win32com.client as client > import pythoncom > > class OPOSEventSink: > > def OnDirectIOEvent(self, EventNumber, pData, pString): > """method DirectIOEvent""" > print "direct io" > > def OnDataEvent(self, Status): > """method DataEvent""" > print "data" > > def OnStatusUpdateEvent(self, Data): > """method StatusUpdateEvent""" > print "status update" > > def OnErrorEvent(self, ResultCode, ResultCodeExtended, ErrorLocus, pErrorResponse): > """method ErrorEvent""" > print "error" > > > if __name__ == '__main__': > msr = client.DispatchWithEvents("OPOS.MSR", OPOSEventSink) > > #Ready the device > msr.Open("Ing6XXX") > msr.ClaimDevice(-1) > > #setup the magnetic stripe reader > #tell the device to turn its self off when a swipe is read > msr.AutoDisable = True > msr.DataEventEnabled = True > > #read all 4 tracks > msr.TracksToRead = 0xf > > #hold events till I tell you to send them > msr.FreezeEvents = True > > #turn the device on > msr.DeviceEnabled = True > > print "please swipe a card" > > #when this loop finishes there has > #been a successful swipe of a card > #and a data event is waiting to be > #released in the com object > while msr.DataCount < 1: > pass > > #by the OPOS specification these > #attributes are set as blank strings > #until a data event is fired > print 'before unfreezing events should be blank' > print 'Account number:', msr.AccountNumber, \ > '\nName:', msr.Surname, '\n' > > #release the events > msr.FreezeEvents = False > > print 'events thawed should still be blank' > print 'Account number:', msr.AccountNumber, \ > '\nName:', msr.Surname, '\n' > > pythoncom.PumpWaitingMessages() > > print 'after pump waiting messages now the values should be there' > print 'Account number:', msr.AccountNumber, \ > '\nName:', msr.Surname, '\n' > > msr.ReleaseDevice() > msr.Close() > > ---------- Output ------------- > please swipe a card > before unfreezing events should be blank > Account number: > Name: > > events thawed should still be blank > Account number: > Name: > > after pump waiting messages now the values should be there > Account number: > Name: It may be that a single PumpWaitingMessages doesn't allow enough time for the events to be delivered. Try running it in a loop with a small sleep until the event is fired. Roger From ssims at spsu.edu Tue Oct 2 17:48:16 2007 From: ssims at spsu.edu (Seth Sims) Date: Tue, 2 Oct 2007 11:48:16 -0400 (EDT) Subject: [python-win32] newby to com and a problem with events Message-ID: <20071002114816.ACT49579@mira.spsu.edu> Ok I have attempted that but with no success. I added: timeout = time.time() + 30 while time.time() <= timeout: print 'pumping messages' pythoncom.PumpWaitingMessages() time.sleep(0.5) Aside from the 60 'pump messages' prints the output is unchanged. As I understand it the fact that msr.AccountNumber contains the account number means that the event has been fired, at least within the OPOS.MSR COM object. The specification states that AccountNumber and a few other properties are set to the blank string when msr.Open is called. They are only changed as part of raising a DataEvent. That seems to be the behavior that I am seeing; because until that single PumpWaitingMessages the properties remain blank. -Seth Sims From Samer.Dajani at USPTO.GOV Tue Oct 2 17:44:24 2007 From: Samer.Dajani at USPTO.GOV (Dajani, Samer (PPC)) Date: Tue, 2 Oct 2007 11:44:24 -0400 Subject: [python-win32] Porting VB 6.0 to Python Message-ID: <18AEA794D557D14A858FCD73332345B603D28595@EXCHANGE2.uspto.gov> Hi everyone, I am working on a project to port a VB 6.0 rich GUI application to python, and was wondering if there is a developer kit available to generate rich GUI and also if there are data connectors available to an oracle client. Thanks, Samer From timr at probo.com Tue Oct 2 18:44:57 2007 From: timr at probo.com (Tim Roberts) Date: Tue, 02 Oct 2007 09:44:57 -0700 Subject: [python-win32] Porting VB 6.0 to Python In-Reply-To: <18AEA794D557D14A858FCD73332345B603D28595@EXCHANGE2.uspto.gov> References: <18AEA794D557D14A858FCD73332345B603D28595@EXCHANGE2.uspto.gov> Message-ID: <47027589.3000602@probo.com> Dajani, Samer (PPC) wrote: > Hi everyone, > > I am working on a project to port a VB 6.0 rich GUI application to python, and was wondering if there is a developer kit available to generate rich GUI and also if there are data connectors available to an oracle client. > There are many choices: tkinter, wxPython and Qt are the three that come to mind first. I prefer wxPython, but the choice of GUI is really a matter of personal preference. There are also several choices for an Oracle connection. ODBC and ADODB will work. cx_Oracle is a Python DBAPI-compliant extension specifically for Oracle. There's even http://www.ioug.org/python.pdf, which gives a couple of quick examples. (My apologies to Samar for sending a blank reply initially; it's too easy to press Ctrl-Enter when I intend to press Enter...) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From vernondcole at gmail.com Tue Oct 2 22:31:48 2007 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 2 Oct 2007 14:31:48 -0600 Subject: [python-win32] Porting VB 6.0 to Python In-Reply-To: <47027589.3000602@probo.com> References: <18AEA794D557D14A858FCD73332345B603D28595@EXCHANGE2.uspto.gov> <47027589.3000602@probo.com> Message-ID: Assuming that your VB application was written using Microsoft Foundation Classes, the simplest port would probably use the built-in MFC framework in pywin32, rather than any of the other GUI packages. There is a brief writeup in Mark Hammond's book (page 400). The modules are win32ui and pywin.mfc . On 10/2/07, Tim Roberts wrote: > > Dajani, Samer (PPC) wrote: > > Hi everyone, > > > > I am working on a project to port a VB 6.0 rich GUI application to > python, and was wondering if there is a developer kit available to generate > rich GUI and also if there are data connectors available to an oracle > client. > > > > There are many choices: tkinter, wxPython and Qt are the three that > come to mind first. I prefer wxPython, but the choice of GUI is really > a matter of personal preference. > > There are also several choices for an Oracle connection. ODBC and ADODB > will work. cx_Oracle is a Python DBAPI-compliant extension specifically > for Oracle. There's even http://www.ioug.org/python.pdf, which gives a > couple of quick examples. > > (My apologies to Samar for sending a blank reply initially; it's too > easy to press Ctrl-Enter when I intend to press Enter...) > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071002/70f1feb9/attachment.htm From timr at probo.com Tue Oct 2 23:44:08 2007 From: timr at probo.com (Tim Roberts) Date: Tue, 02 Oct 2007 14:44:08 -0700 Subject: [python-win32] Porting VB 6.0 to Python In-Reply-To: References: <18AEA794D557D14A858FCD73332345B603D28595@EXCHANGE2.uspto.gov> <47027589.3000602@probo.com> Message-ID: <4702BBA8.5040404@probo.com> Vernon Cole wrote: > Assuming that your VB application was written using Microsoft > Foundation Classes, MFC only applies to C++, not to Visual Basic. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From werner.bruhin at free.fr Wed Oct 3 14:04:38 2007 From: werner.bruhin at free.fr (Werner F. Bruhin) Date: Wed, 03 Oct 2007 14:04:38 +0200 Subject: [python-win32] Porting VB 6.0 to Python In-Reply-To: <18AEA794D557D14A858FCD73332345B603D28595@EXCHANGE2.uspto.gov> References: <18AEA794D557D14A858FCD73332345B603D28595@EXCHANGE2.uspto.gov> Message-ID: Hi, Dajani, Samer (PPC) wrote: > Hi everyone, > > I am working on a project to port a VB 6.0 rich GUI application to python, and was wondering if there is a developer kit available to generate rich GUI and also if there are data connectors available to an oracle client. You might want to look at Dabo (http://dabodev.com/) - quote from thie site: Dabo is a 3-tier, cross-platform application development framework, written in Python atop the wxPython GUI toolkit. I have not got around to really using it. Werner From chlo.prog at gmail.com Wed Oct 3 16:00:50 2007 From: chlo.prog at gmail.com (r c) Date: Wed, 3 Oct 2007 09:00:50 -0500 Subject: [python-win32] Converting VB COM register program to Python Message-ID: <5e2006d10710030700u65b5f949h3a2acb3e3dbae271@mail.gmail.com> I'm trying to convert VB code that registers COM+ components to Python. I'm unable to set values on COMAdminCatalogObject using the Value() method, it seems to think I'm trying to call the get method? VB Code: Dim cat As COMAdminCatalog Set cat = New COMAdminCatalog Dim apps As COMAdminCatalogCollection Set apps = cat.GetCollection("Applications") Dim app As COMAdminCatalogObject Set app = apps.Add app.Value("ID") = AppID Python Code: objCOMAdminCatalog = win32com.client.Dispatch("COMAdmin.COMAdminCatalog") objApplications = objCOMAdminCatalog.GetCollection("Applications") objCOMAdminCatalogObject = objApplications.Add() print "ID", objCOMAdminCatalogObject.Value("ID") #This is returning the random ID # app.Value("ID") = AppID # SyntaxError: can't assign to function call objCOMAdminCatalogObject.Value("ID", AppID) #Exception thrown Returns the following error: TypeError: Value() takes at most 2 arguments (3 given) Thanks rc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071003/d91d1a59/attachment.htm From timr at probo.com Wed Oct 3 18:53:20 2007 From: timr at probo.com (Tim Roberts) Date: Wed, 03 Oct 2007 09:53:20 -0700 Subject: [python-win32] Converting VB COM register program to Python In-Reply-To: <5e2006d10710030700u65b5f949h3a2acb3e3dbae271@mail.gmail.com> References: <5e2006d10710030700u65b5f949h3a2acb3e3dbae271@mail.gmail.com> Message-ID: <4703C900.3020904@probo.com> r c wrote: > > I'm trying to convert VB code that registers COM+ components to > Python. I'm unable to set values on COMAdminCatalogObject using the > Value() method, it seems to think I'm trying to call the get method? > > ... > > Python Code: > objCOMAdminCatalog = win32com.client.Dispatch("COMAdmin.COMAdminCatalog") > objApplications = objCOMAdminCatalog.GetCollection ("Applications") > objCOMAdminCatalogObject = objApplications.Add() > print "ID", objCOMAdminCatalogObject.Value("ID") #This is returning > the random ID > # app.Value("ID") = AppID # SyntaxError: can't assign to function call > objCOMAdminCatalogObject.Value("ID", AppID) #Exception thrown > > Returns the following error: > TypeError: Value() takes at most 2 arguments (3 given) In this case, where an indexed property had both a "Get" and a "Let" handler, the Python COM stuff generates a "Value" function for the "Get" part, and a "SetValue" function for the "Let" part. So, you want: objCOMAdminCatalogObject.SetValue("ID", AppID) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From chlo.prog at gmail.com Wed Oct 3 21:39:33 2007 From: chlo.prog at gmail.com (r c) Date: Wed, 3 Oct 2007 14:39:33 -0500 Subject: [python-win32] Converting VB COM register program to Python In-Reply-To: <4703C900.3020904@probo.com> References: <5e2006d10710030700u65b5f949h3a2acb3e3dbae271@mail.gmail.com> <4703C900.3020904@probo.com> Message-ID: <5e2006d10710031239k1d31b2e5k1b906f92426ea5d7@mail.gmail.com> > >In this case, where an indexed property had both a "Get" and a "Let" > >handler, the Python COM stuff generates a "Value" function for the "Get" > >part, and a "SetValue" function for the "Let" part.> > > > >So, you want: > > objCOMAdminCatalogObject.SetValue("ID", AppID)> > > > >-- > >Tim Roberts, timr at probo.com > >Providenza & Boekelheide, Inc. > > When I try SetValue I get: Traceback (most recent call last): *File "C:\programming\python\dev\src\FullInstallScripts\COMObjectFullInstall.py", line 74, in * CreateApplication() *File "C:\programming\python\dev\src\FullInstallScripts\COMObjectFullInstall.py", line 21, in CreateApplication * objCOMAdminCatalogObject.SetValue("ID", AppID) *File "C:\Python25\Lib\site-packages\win32com\client\dynamic.py", line 496, in __getattr__ * raise AttributeError, "%s.%s" % (self._username_, attr) AttributeError: Add.SetValue -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071003/2dfc388a/attachment.htm From timr at probo.com Wed Oct 3 21:48:42 2007 From: timr at probo.com (Tim Roberts) Date: Wed, 03 Oct 2007 12:48:42 -0700 Subject: [python-win32] Converting VB COM register program to Python In-Reply-To: <5e2006d10710031239k1d31b2e5k1b906f92426ea5d7@mail.gmail.com> References: <5e2006d10710030700u65b5f949h3a2acb3e3dbae271@mail.gmail.com> <4703C900.3020904@probo.com> <5e2006d10710031239k1d31b2e5k1b906f92426ea5d7@mail.gmail.com> Message-ID: <4703F21A.4050100@probo.com> r c wrote: > > >In this case, where an indexed property had both a "Get" and a "Let" > >handler, the Python COM stuff generates a "Value" function for > the "Get" > >part, and a "SetValue" function for the "Let" part. > > > > >So, you want: > > objCOMAdminCatalogObject.SetValue("ID", AppID) > > > > >-- > >Tim Roberts, timr at probo.com > > Providenza & Boekelheide, Inc. > > When I try SetValue I get: > > > > Traceback (most recent call last): > > _File > "C:\programming\python\dev\src\FullInstallScripts\COMObjectFullInstall.py", > line 74, in _ > > CreateApplication() > > _File > "C:\programming\python\dev\src\FullInstallScripts\COMObjectFullInstall.py", > line 21, in CreateApplication_ > > objCOMAdminCatalogObject.SetValue("ID", AppID) > > _File "C:\Python25\Lib\site-packages\win32com\client\dynamic.py", line > 496, in __getattr___ > > raise AttributeError, "%s.%s" % (self._username_, attr) > > AttributeError: Add.SetValue > Not sure what to tell you. This exact script runs correctly for me: import win32com.client objCOMAdminCatalog = win32com.client.Dispatch("COMAdmin.COMAdminCatalog") objApplications = objCOMAdminCatalog.GetCollection ("Applications") objCOMAdminCatalogObject = objApplications.Add() AppID = objCOMAdminCatalogObject.Value("ID") print "ID", objCOMAdminCatalogObject.Value("ID") #This is returning the random ID objCOMAdminCatalogObject.SetValue("ID",AppID) Have you run "makepy" on this type lib? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From Mark.English at rbccm.com Tue Oct 2 19:13:30 2007 From: Mark.English at rbccm.com (English, Mark) Date: Tue, 2 Oct 2007 18:13:30 +0100 Subject: [python-win32] Porting VB 6.0 to Python Message-ID: > -----Original Message----- > From: python-win32-bounces at python.org > [mailto:python-win32-bounces at python.org]On Behalf Of Tim Roberts > Sent: 02 October 2007 17:45 > To: Python-Win32 List > Subject: Re: [python-win32] Porting VB 6.0 to Python > > > Dajani, Samer (PPC) wrote: > > Hi everyone, > > > > I am working on a project to port a VB 6.0 rich GUI > application to python, and was wondering if there is a > developer kit available to generate rich GUI and also if > there are data connectors available to an oracle client. > > > > There are many choices: tkinter, wxPython and Qt are the three that > come to mind first. I prefer wxPython, but the choice of GUI > is really > a matter of personal preference. > > There are also several choices for an Oracle connection. > ODBC and ADODB > will work. cx_Oracle is a Python DBAPI-compliant extension > specifically > for Oracle. There's even http://www.ioug.org/python.pdf, > which gives a > couple of quick examples. > > (My apologies to Samar for sending a blank reply initially; it's too > easy to press Ctrl-Enter when I intend to press Enter...) > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > You could consider IronPython: http://www.codeplex.com/IronPython That's not Python in the purest cPython sense though... ________________________________________ This E-Mail (including any attachments) may contain privileged or confidential information. It is intended only for the addressee(s) indicated above. The sender does not waive any of its rights, privileges or other protections respecting this information. Any distribution, copying or other use of this E-Mail or the information it contains, by other than an intended recipient, is not sanctioned and is prohibited. If you received this E-Mail in error, please delete it and advise the sender (by return E-Mail or otherwise) immediately. This E-Mail (including any attachments) has been scanned for viruses. It is believed to be free of any virus or other defect that might affect any computer system into which it is received and opened. However, it is the responsibility of the recipient to ensure that it is virus free. The sender accepts no responsibility for any loss or damage arising in any way from its use. E-Mail received by or sent from RBC Capital Markets is subject to review by Supervisory personnel. Such communications are retained and may be produced to regulatory authorities or others with legal rights to the information. IRS CIRCULAR 230 NOTICE: TO COMPLY WITH U.S. TREASURY REGULATIONS, WE ADVISE YOU THAT ANY U.S. FEDERAL TAX ADVISE INCLUDED IN THIS COMMUNICATION IS NOT INTENDED OR WRITTEN TO BE USED, AND CANNOT BE USED, TO AVOID ANY U.S. FEDERAL TAX PENALTIES OR TO PROMOTE, MARKET, OR RECOMMEND TO ANOTHER PARTY ANY TRANSACTION OR MATTER. From tim.fulcher at bt.com Thu Oct 4 12:00:42 2007 From: tim.fulcher at bt.com (tim.fulcher at bt.com) Date: Thu, 4 Oct 2007 11:00:42 +0100 Subject: [python-win32] api for mapping webdav location in My Network Places? Message-ID: <5215403955D2994085575F8BE52239DDCAC93A@E03MVA4-UKBR.domain1.systemhost.net> Hi I'm trying to write a test harness for some application code, and part of the setup method is to map a network drive / network place to a webdav folder. After extensive googling I can't seem to find any examples in any language :-/ Perhaps that's a bad omen, but being optimistic - Hopefully I'm right in thinking the WNetAddConnection2() call is the right approach. I've tried various options, but after a load of digging I've sussed (hopefully correct!) that I should set the provider name to "Web Client Network" rather than None, since this always generated an error 67 code I have an unsecured Tomcat4.1 server on a machine nearby which has a webdav folder installed. To attempt to map this I use import win32net import win32netcon import win32wnet win32wnet.WNetAddConnection2( win32netcon.RESOURCETYPE_DISK, "z:", "http://192.168.2.6/webdav/ ", "Web Client Network", None, None, 0) But I'm getting win32wnet.WNetAddConnection2( win32netcon.RESOURCETYPE_DISK, "z:", "http://192.168.2.6/webdav/ ", "Web Client Network", None, None, 0) error: (53, 'WNetAddConnection2', 'The network path was not found.') If I try to add a network place manually to the same location it succeeds. Two aspects puzzle me: - Webdav locations tend to exist under My Network Places, so is the call getting hung up on trying to map drive Z ? But what should I pass in as the local name for the call to work? - Utimately I need to turn on access control in the webdav server (that's part of the testing to conduct). If the webdav prompt contains an basic authentication realm "foo", should my call be win32wnet.WNetAddConnection2( win32netcon.RESOURCETYPE_DISK, "z:", "http://192.168.2.6/webdav/ ", "Web Client Network", "user at foo ", "password", 0) ? I did wonder if the win32net.NetUseAdd() call has any mileage as an alternative? I'm on WinXP Professional SP1, ActiveState Python 2.4.1 Tim From raduciora at yahoo.com Thu Oct 4 13:04:28 2007 From: raduciora at yahoo.com (Radu Ciora) Date: Thu, 4 Oct 2007 04:04:28 -0700 (PDT) Subject: [python-win32] message queue Message-ID: <832541.55914.qm@web50104.mail.re2.yahoo.com> Hi all, given this code: while 1: time.sleep(1) l_hwnd = win32gui.GetForegroundWindow() try: msg = win32gui.GetMessage(l_hwnd, 0, 0) print msg except: traceback.print_exc() can anyone tell me what's wrong with it, 'cos it doesn't print anything? I'm trying to get into this tiny application message queue and print out the messages that come in to it. Thanks a million, Radu. ___________________________________________________________ Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html From sidnei at enfoldsystems.com Thu Oct 4 14:16:32 2007 From: sidnei at enfoldsystems.com (Sidnei da Silva) Date: Thu, 4 Oct 2007 09:16:32 -0300 Subject: [python-win32] api for mapping webdav location in My Network Places? In-Reply-To: <5215403955D2994085575F8BE52239DDCAC93A@E03MVA4-UKBR.domain1.systemhost.net> References: <5215403955D2994085575F8BE52239DDCAC93A@E03MVA4-UKBR.domain1.systemhost.net> Message-ID: The WebDAV Folder (Microsoft calls them WebFolders) is apparently just a shortcut in the User's 'Nethood' hidden folder. More information and sample code in C# here: http://www.codeproject.com/aspnet/ReadWebFolderContent.asp -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 From timr at probo.com Thu Oct 4 20:10:13 2007 From: timr at probo.com (Tim Roberts) Date: Thu, 04 Oct 2007 11:10:13 -0700 Subject: [python-win32] message queue In-Reply-To: <832541.55914.qm@web50104.mail.re2.yahoo.com> References: <832541.55914.qm@web50104.mail.re2.yahoo.com> Message-ID: <47052C85.4060707@probo.com> Radu Ciora wrote: > Hi all, > > given this code: > > while 1: > time.sleep(1) > > l_hwnd = win32gui.GetForegroundWindow() > try: > msg = win32gui.GetMessage(l_hwnd, 0, 0) > print msg > except: > traceback.print_exc() > > can anyone tell me what's wrong with it, 'cos it doesn't print anything? > I'm trying to get into this tiny application message queue and print out the messages that come in to it. What messages do you expect to get? Are you sending it messages from somewhere else? How are you doing that? Are you actually creating any windows? If not, then this will never work. GetForegroundWindow will return to you the handle of whatever visible window happens to be frontmost. If you're in a console, it's the console window. If you're in Pythonwin, it's the Pythonwin window. In either case, that window does not belong to your thread, so you will never see any messages destined for that window. Because you supplied a window handle to GetMessage, it will only pull the messages for that window handle. If you want to get ALL messages sent to your thread, do win32gui.GetMessage( 0, 0, 0 ), but again that begs the question of what messages you are sending? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From chlo.prog at gmail.com Thu Oct 4 20:36:50 2007 From: chlo.prog at gmail.com (r c) Date: Thu, 4 Oct 2007 13:36:50 -0500 Subject: [python-win32] Converting VB COM register program to Python In-Reply-To: <4703F21A.4050100@probo.com> References: <5e2006d10710030700u65b5f949h3a2acb3e3dbae271@mail.gmail.com> <4703C900.3020904@probo.com> <5e2006d10710031239k1d31b2e5k1b906f92426ea5d7@mail.gmail.com> <4703F21A.4050100@probo.com> Message-ID: <5e2006d10710041136l396356fbn860b476410cdb5aa@mail.gmail.com> On 10/3/07, Tim Roberts wrote: > > r c wrote: > > > > >In this case, where an indexed property had both a "Get" and a > "Let" > > >handler, the Python COM stuff generates a "Value" function for > > the "Get" > > >part, and a "SetValue" function for the "Let" part. > > > > > > >So, you want: > > > objCOMAdminCatalogObject.SetValue("ID", AppID) > > > > > > >-- > > >Tim Roberts, timr at probo.com > > > Providenza & Boekelheide, Inc. > > > > When I try SetValue I get: > > > > > > > > Traceback (most recent call last): > > > > _File > > > "C:\programming\python\dev\src\FullInstallScripts\COMObjectFullInstall.py", > > line 74, in _ > > > > CreateApplication() > > > > _File > > > "C:\programming\python\dev\src\FullInstallScripts\COMObjectFullInstall.py", > > line 21, in CreateApplication_ > > > > objCOMAdminCatalogObject.SetValue("ID", AppID) > > > > _File "C:\Python25\Lib\site-packages\win32com\client\dynamic.py", line > > 496, in __getattr___ > > > > raise AttributeError, "%s.%s" % (self._username_, attr) > > > > AttributeError: Add.SetValue > > > > Not sure what to tell you. This exact script runs correctly for me: > > import win32com.client > > objCOMAdminCatalog = > win32com.client.Dispatch("COMAdmin.COMAdminCatalog") > objApplications = objCOMAdminCatalog.GetCollection ("Applications") > objCOMAdminCatalogObject = objApplications.Add() > AppID = objCOMAdminCatalogObject.Value("ID") > print "ID", objCOMAdminCatalogObject.Value("ID") #This is returning > the random ID > objCOMAdminCatalogObject.SetValue("ID",AppID) > > Have you run "makepy" on this type lib? > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > Perfect! Adding the makepy to my script allowed me to call the SetValue method: win32com.client.gencache.EnsureModule(pywintypes.IID(* '{F618C513-DFB8-11D1-A2CF-00805FC79235}'*), 0x0, 1, 0) Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071004/f9ba6218/attachment.htm From raduciora at yahoo.com Thu Oct 4 21:14:08 2007 From: raduciora at yahoo.com (Radu Ciora) Date: Thu, 4 Oct 2007 12:14:08 -0700 (PDT) Subject: [python-win32] message queue Message-ID: <479597.70999.qm@web50104.mail.re2.yahoo.com> I was trying to see how GetMessage function works. I was trying with this basic app and later try to get message for MsWord. Regards, Radu. ----- Original Message ---- From: Tim Roberts To: Python-Win32 List Sent: Thursday, 4 October, 2007 7:10:13 PM Subject: Re: [python-win32] message queue Radu Ciora wrote: > Hi all, > > given this code: > > while 1: > time.sleep(1) > > l_hwnd = win32gui.GetForegroundWindow() > try: > msg = win32gui.GetMessage(l_hwnd, 0, 0) > print msg > except: > traceback.print_exc() > > can anyone tell me what's wrong with it, 'cos it doesn't print anything? > I'm trying to get into this tiny application message queue and print out the messages that come in to it. What messages do you expect to get? Are you sending it messages from somewhere else? How are you doing that? Are you actually creating any windows? If not, then this will never work. GetForegroundWindow will return to you the handle of whatever visible window happens to be frontmost. If you're in a console, it's the console window. If you're in Pythonwin, it's the Pythonwin window. In either case, that window does not belong to your thread, so you will never see any messages destined for that window. Because you supplied a window handle to GetMessage, it will only pull the messages for that window handle. If you want to get ALL messages sent to your thread, do win32gui.GetMessage( 0, 0, 0 ), but again that begs the question of what messages you are sending? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 ___________________________________________________________ Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html From timr at probo.com Thu Oct 4 23:06:28 2007 From: timr at probo.com (Tim Roberts) Date: Thu, 04 Oct 2007 14:06:28 -0700 Subject: [python-win32] message queue In-Reply-To: <479597.70999.qm@web50104.mail.re2.yahoo.com> References: <479597.70999.qm@web50104.mail.re2.yahoo.com> Message-ID: <470555D4.9020700@probo.com> Radu Ciora wrote: > I was trying to see how GetMessage function works. > I was trying with this basic app and later try to get message for MsWord. > The only messages you get with GetMessage are messages that arrived in your thread's message queue. You can monitor the message traffic within another process, but only by using a window "hook" that actually injects code into that other process. The "spyxx" tool that ships with the PlatformSDK is an excellent way to do this. Borland has an equivalent tool called "WinSight". Window messages are very low-level things. WM_PAINT tells an application to repaint part of a window. WM_MOVE tells it the window is being moved, WM_SIZE says the window is being resized. WM_MOUSEMOVE tells it that the mouse moved within its window. In addition, controls like buttons and list boxes report activity to their parent windows, like when they get clicked, or when an item is selected. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From raduciora at yahoo.com Thu Oct 4 23:37:08 2007 From: raduciora at yahoo.com (Radu Ciora) Date: Thu, 4 Oct 2007 14:37:08 -0700 (PDT) Subject: [python-win32] message queue Message-ID: <472781.333.qm@web50101.mail.re2.yahoo.com> So you mean that I won't be able to see Word's message queue, right? Regards, Radu. ----- Original Message ---- From: Tim Roberts To: Python-Win32 List Sent: Thursday, 4 October, 2007 10:06:28 PM Subject: Re: [python-win32] message queue Radu Ciora wrote: > I was trying to see how GetMessage function works. > I was trying with this basic app and later try to get message for MsWord. > The only messages you get with GetMessage are messages that arrived in your thread's message queue. You can monitor the message traffic within another process, but only by using a window "hook" that actually injects code into that other process. The "spyxx" tool that ships with the PlatformSDK is an excellent way to do this. Borland has an equivalent tool called "WinSight". Window messages are very low-level things. WM_PAINT tells an application to repaint part of a window. WM_MOVE tells it the window is being moved, WM_SIZE says the window is being resized. WM_MOUSEMOVE tells it that the mouse moved within its window. In addition, controls like buttons and list boxes report activity to their parent windows, like when they get clicked, or when an item is selected. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.orailman/listinfo/python-win32 ___________________________________________________________ Yahoo! Answers - Got a question? Someone out there knows the answer. Try it now. http://uk.answers.yahoo.com/ From timr at probo.com Fri Oct 5 00:01:08 2007 From: timr at probo.com (Tim Roberts) Date: Thu, 04 Oct 2007 15:01:08 -0700 Subject: [python-win32] message queue In-Reply-To: <472781.333.qm@web50101.mail.re2.yahoo.com> References: <472781.333.qm@web50101.mail.re2.yahoo.com> Message-ID: <470562A4.2050602@probo.com> Radu Ciora wrote: > So you mean that I won't be able to see Word's message queue, right? > Not by using GetMessage, no. You wouldn't want to in any case, because GetMessage *removes* the messages from the queue. If you COULD get them, then Word WOULDN'T get them, and the display would be screwed up. It IS possible to monitor the message queue for another application by creating a Windows hook, using SetWindowsHookEx. The WH_CALLWNDPROC or WH_GETMESSAGE hooks might do what you want. This can't be done from Python, because this actually does inject the code directly into other processes. What are you trying to accomplish? There isn't really very much of interest in a window message queue. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From raduciora at yahoo.com Fri Oct 5 00:08:02 2007 From: raduciora at yahoo.com (Radu Ciora) Date: Thu, 4 Oct 2007 15:08:02 -0700 (PDT) Subject: [python-win32] message queue Message-ID: <106703.79238.qm@web50105.mail.re2.yahoo.com> My goal is to be able to say when a user clicks a Word toolbar button to be able to "know" what that button was. So that I might provide some feedback or something. Regards, Radu. ----- Original Message ---- From: Tim Roberts To: Python-Win32 List Sent: Thursday, 4 October, 2007 11:01:08 PM Subject: Re: [python-win32] message queue Radu Ciora wrote: > So you mean that I won't be able to see Word's message queue, right? > Not by using GetMessage, no. You wouldn't want to in any case, because GetMessage *removes* the messages from the queue. If you COULD get them, then Word WOULDN'T get them, and the display would be screwed up. It IS possible to monitor the message queue for another application by creating a Windows hook, using SetWindowsHookEx. The WH_CALLWNDPROC or WH_GETMESSAGE hooks might do what you want. This can't be done from Python, because this actually does inject the code directly into other processes. What are you trying to accomplish? There isn't really very much of interest in a window message queue. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 ___________________________________________________________ Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html From timr at probo.com Fri Oct 5 00:35:21 2007 From: timr at probo.com (Tim Roberts) Date: Thu, 04 Oct 2007 15:35:21 -0700 Subject: [python-win32] message queue In-Reply-To: <106703.79238.qm@web50105.mail.re2.yahoo.com> References: <106703.79238.qm@web50105.mail.re2.yahoo.com> Message-ID: <47056AA9.5060000@probo.com> Radu Ciora wrote: > My goal is to be able to say when a user clicks a Word toolbar button to be able to "know" what that button was. So that I might provide some feedback or something. > Unfortunately, that turns out to be virtually impossible. Most applications draw their windows by putting up a collection of controls within windows, so that each toolbar button (for example) is a separate window. The toolbar buttons in Office applications don't do that. For efficiency, they draw all of their toolbars into one big bitmap. If you use spyxx to look at Word's window structure, you'll see that each toolbar and command bar is one big window, with no subwindows. So, although you could learn that the user clicked at coordinate (223,17) of the "Standard" command bar, there is simply no way to figure out what button was actually at that location. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From ssims at spsu.edu Fri Oct 5 17:32:14 2007 From: ssims at spsu.edu (Seth Sims) Date: Fri, 5 Oct 2007 11:32:14 -0400 (EDT) Subject: [python-win32] newby to com and a problem with events Message-ID: <20071005113214.ACU26301@mira.spsu.edu> Hi, Does anyone have anything else I can try to fix my problem? I know that events are being fired because of their side effects on the COM object state. However I never see my little print messages from the event handler. I feel like it is just something small that I am missing. Thank you in advance. -Seth ------msrtest.py------- from win32com import client import pythoncom import time class OPOSEventSink: def OnDirectIOEvent(self, EventNumber, pData, pString): """method DirectIOEvent""" print "direct io" def OnDataEvent(self, Status): """method DataEvent""" print "data" def OnStatusUpdateEvent(self, Data): """method StatusUpdateEvent""" print "status update" def OnErrorEvent(self, ResultCode, ResultCodeExtended, ErrorLocus, pErrorResponse): """method ErrorEvent""" print "error" if __name__ == '__main__': msr = client.DispatchWithEvents("OPOS.MSR", OPOSEventSink) #Ready the device status = msr.Open("Ing6XXX") if status <> 0: print "failed to open msr" quit() status = msr.ClaimDevice(-1) if status <> 0: print "failed to claim msr" quit() #setup the magnetic stripe reader msr.AutoDisable = True #tell the device to turn its self off when a swipe is read msr.DataEventEnabled = True msr.TracksToRead = 0xf #read all 4 tracks msr.FreezeEvents = True #hold events till I say to send them #turn the device on msr.DeviceEnabled = True print "please swipe a card" #when this loop finishes there has been a successful swipe of a card #and a data event is waiting to be released in the com object while msr.DataCount < 1: time.sleep(0.5) #by the OPOS specification these attributes are set as blank strings #until a data event is fired print 'before unfreezing events should be blank' print 'Account number:', msr.AccountNumber, '\nName:', msr.Surname, '\n' #release the events msr.FreezeEvents = False print 'events thawed should still be blank' print 'Account number:', msr.AccountNumber, '\nName:', msr.Surname, '\n' pythoncom.PumpWaitingMessages() print 'after pump waiting messages now the values should be there' print 'Account number:', msr.AccountNumber, '\nName:', msr.Surname, '\n' timeout = time.time() + 30 while time.time() <= timeout: print 'pumping messages' pythoncom.PumpWaitingMessages() time.sleep(0.5) msr.ReleaseDevice() msr.Close() ---output--- please swipe a card before unfreezing events should be blank Account number: Name: events thawed should still be blank Account number: Name: after pump waiting messages now the values should be there Account number: Name: pumping messages pumping messages pumping messages .... From ckkart at hoc.net Mon Oct 8 14:42:06 2007 From: ckkart at hoc.net (Christian K.) Date: Mon, 8 Oct 2007 12:42:06 +0000 (UTC) Subject: [python-win32] using wxPython from Outlook addin Message-ID: Hi, since my knowlegde about windows gui programming is not existent I'd prefer to do the gui part of a Outlook addin using wxPython. Is that possible at all and if yes, at which point can I start the wxPython main loop? Basically the addin does similar things as spambayes. It listens to button and folder events and does something with the mail items. Thanks for any hints, Christian From graemeglass at gmail.com Mon Oct 8 15:12:40 2007 From: graemeglass at gmail.com (Graeme Glass) Date: Mon, 8 Oct 2007 15:12:40 +0200 Subject: [python-win32] using wxPython from Outlook addin In-Reply-To: References: Message-ID: There are a couple of posts about this about 3 years back, when I tried to do this. (http://aspn.activestate.com/ASPN/Mail/Browse/Plain/Python-win32?period=200409) The project died the next week, so never got anything going, but hopefully some of those comments might help you along your way. Regards, G On 10/8/07, Christian K. wrote: > Hi, > since my knowlegde about windows gui programming is not existent I'd prefer to > do the gui part of a Outlook addin using wxPython. > Is that possible at all and if yes, at which point can I start the wxPython main > loop? Basically the addin does similar things as spambayes. It listens to button > and folder events and does something with the mail items. > Thanks for any hints, Christian > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From ghankiewicz at rastertech.es Mon Oct 8 18:06:39 2007 From: ghankiewicz at rastertech.es (Grzegorz Adam Hankiewicz) Date: Mon, 08 Oct 2007 18:06:39 +0200 Subject: [python-win32] Accessing FindWindow for unicode applications? Message-ID: <470A558F.4040001@rastertech.es> I'm using win32gui.FindWindow() to find the handle of a window. This works until you set the title of a window to some unicode strange looking title like russian or arabic. The msdn documentation about FindWindowEx mentions the existence of FindWindowExW supported by the Microsoft Layer for Unicode (MSLU). But how do I access this function? -- Rastertech Espa?a S.A. Grzegorz Adam Hankiewicz /Jefe de Producto TeraVial/ C/ Perfumer?a 21. Nave I. Pol?gono industrial La Mina 28770 Colmenar Viejo. Madrid (Espa?a) Tel. +34 918 467 390 (Ext.17) *?* Fax +34 918 457 889 ghankiewicz at rastertech.es *?* www.rastertech.es From mail at timgolden.me.uk Tue Oct 9 10:16:56 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 09 Oct 2007 09:16:56 +0100 Subject: [python-win32] Accessing FindWindow for unicode applications? In-Reply-To: <470A558F.4040001@rastertech.es> References: <470A558F.4040001@rastertech.es> Message-ID: <470B38F8.5070603@timgolden.me.uk> Grzegorz Adam Hankiewicz wrote: > I'm using win32gui.FindWindow() to find the handle of a window. This > works until you set the title of a window to some unicode strange > looking title like russian or arabic. > > The msdn documentation about FindWindowEx mentions the existence of > FindWindowExW supported by the Microsoft Layer for Unicode (MSLU). But > how do I access this function? I *think* -- and I could be wrong about this -- that you *are* using that function, because the MS compiler set uses a macro to alias one of A and W as depending on whatever Unicode settings are in place when you compile the program. The note about the MSLU is to say that, while this version of the function is supported natively by Win2K, XP and later, under Win9x it's only supported by virtue of the MSLU. If you want to be *certain* you're accessing the function, you can get direct access by using ctypes: import ctypes ctypes.windll.user32.FindWindowExW TJG From quest at openend.se Mon Oct 8 10:32:18 2007 From: quest at openend.se (quest at openend.se) Date: Mon, 08 Oct 2007 10:32:18 +0200 Subject: [python-win32] Why the strange frozen dance in win32com/__init__.py? Message-ID: <7whcl29fcd.fsf@enki.openend.se> (My appologies if this has been discussed earlier; my Google-fu may be weak.) pywin32's win32com/__init__.py does this (slightly compacted for brevity): def SetupEnvironment(): try: keyName = "SOFTWARE\\Python\\PythonCore\\%s\\PythonPath\\win32com" % sys.winver key = win32api.RegOpenKey(HKEY_LOCAL_MACHINE , keyName, 0, KEY_QUERY_VALUE) except (win32api.error, AttributeError): key = None try: found = 0 if key is not None: try: __path__.append(win32api.RegQueryValue(key, "Extensions" )) found = 1 except win32api.error: pass if not found: try: __path__.append( win32api.GetFullPathName(__path__[0] + "\\.\ .\\win32comext") ) except win32api.error: pass if not sys.frozen: SetupEnvironment() Being a developer of a commercial Python application, I have beef with this: I would much prefer this code to work in the opposite fashion: first look at the place relative to __path__, then fallback to registry lookup. My reason is of course, that I have no wish to install a "standalone" python on the user's box, nor do I want to be tripped by the presence of one. E.g.: cand_extdir = os.path.join(os.path.dirname(__path__[0]), 'win32comext') if not os.path.exists(cand_extdir): keyName = "SOFTWARE\\Python\\PythonCore\\%s\\PythonPath\\win32com" % \ sys.winver key = win32api.RegOpenKey(HKEY_LOCAL_MACHINE , keyName, 0, KEY_QUERY_VALUE) try: cand_extdir = win32api.RegQueryValue(key, "Extensions" ) except win32api.error: cand_extdir = None if cand_extdir: __path__.append(cand_extdir) The above disregards that SetupEnvironment code is not executed at all in a frozen state, but I don't have a problem with explicitly calling a method to get this inited; e.g: if getattr(sys, 'frozen', False): win32com.SetupEnvironment() -- Anders Qvist, Open End AB From mjohnson at mpjconsultancy.com Thu Oct 11 11:40:12 2007 From: mjohnson at mpjconsultancy.com (mjohnson) Date: Thu, 11 Oct 2007 10:40:12 +0100 Subject: [python-win32] Selecting OK button in dialog Message-ID: I know this has been discussed elsewhere, maybe even on this board. But I am getting spooky things happening, can anyone shed any light please? I enumerate through the windows until I find the one I want, then using childWindows = [] win32gui.EnumChildWindows(window[0], windowEnumerationHandler, childWindows) for child in childWindows: if child[1]=='OK': print child win32gui.SendMessage(child[0], win32con.WM_LBUTTONDOWN, 0, 0) win32gui.SendMessage(child[0], win32con.WM_LBUTTONUP, 0, 0) I click the OK button. If I watch the execution on the screen I can see the OK button depressed then released, but nothing happens. The spooky part is that if I then move the mouse over the dialog with the OK button then the action is performed. I guess there is something else needed, perhaps focus. All hints and tips gratefully received, thanks Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071011/52da0f45/attachment.htm From niki at vintech.bg Thu Oct 11 12:41:21 2007 From: niki at vintech.bg (niki) Date: Thu, 11 Oct 2007 13:41:21 +0300 Subject: [python-win32] Selecting OK button in dialog In-Reply-To: References: Message-ID: <470DFDD1.7070807@vintech.bg> mjohnson wrote: > I enumerate through the windows until I find the one I want, then using > I click the OK button. > > If I watch the execution on the screen I can see the OK button depressed > then released, but nothing happens. The spooky part is that if I then > move the mouse over the dialog with the OK button then the action is > performed. > > I guess there is something else needed, perhaps focus. > > All hints and tips gratefully received, thanks Try this: press mouse on dialog button, button comes down and stays. Nothing happens yet. Then drag mouse without releasing. After mouse leaves button area see what happens. Releasing mouse outside button has no effect. HTH Niki From singhai.nish at gmail.com Thu Oct 11 15:42:29 2007 From: singhai.nish at gmail.com (kNish) Date: Thu, 11 Oct 2007 19:12:29 +0530 Subject: [python-win32] lock workstation Message-ID: <81bfef2e0710110642y43e2ebcex3b9c229adbb00561@mail.gmail.com> Hi, Need : To track time when a workstation is locked and when it is unlocked. Store this time. My approach : 1st Option Trap the key "ctrl+alt+del" or "windows+l". trigger a procedure to save the time in and time out into a database. 2nd Option Run a procedure that has a while true loop. In this loop there can be a event capture device to know that a ctrl+alt+del has been pressed. Now run the save to database procedure. I think of doing this using python, tkinter, ctype opendesktop. To trap the keys, I need to find a bind function. Is it possible to do this. Any suggestion. BRgds, kNish -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071011/62d9277e/attachment.htm From steven.james at gmail.com Thu Oct 11 17:55:09 2007 From: steven.james at gmail.com (Steven James) Date: Thu, 11 Oct 2007 11:55:09 -0400 Subject: [python-win32] lock workstation In-Reply-To: <81bfef2e0710110642y43e2ebcex3b9c229adbb00561@mail.gmail.com> References: <81bfef2e0710110642y43e2ebcex3b9c229adbb00561@mail.gmail.com> Message-ID: Never tried it, but you might want to see if "WTSRegisterSessionNotification" [ http://msdn2.microsoft.com/en-us/library/aa383841.aspx] works in the python win32 API. You can register your window to receive notification automatically when a user logs in, logs out, locks the machine, unlocks, etc. Steven James On 10/11/07, kNish wrote: > > Hi, > > Need : To track time when a workstation is locked and when it > is unlocked. Store this time. > > My approach : 1st Option > > Trap the key "ctrl+alt+del" or "windows+l". trigger a procedure > to save the time in and time out into a database. > > 2nd Option > > Run a procedure that has a while true loop. In this loop there > can be a event capture device to know that a ctrl+alt+del has been pressed. > > Now run the save to database procedure. > > I think of doing this using python, tkinter, ctype opendesktop. > > > To trap the keys, I need to find a bind function. Is it possible > to do this. Any suggestion. > > > BRgds, > > kNish > > _______________________________________________ > 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/20071011/1c01f46a/attachment.htm From timr at probo.com Thu Oct 11 19:27:07 2007 From: timr at probo.com (Tim Roberts) Date: Thu, 11 Oct 2007 10:27:07 -0700 Subject: [python-win32] lock workstation In-Reply-To: <81bfef2e0710110642y43e2ebcex3b9c229adbb00561@mail.gmail.com> References: <81bfef2e0710110642y43e2ebcex3b9c229adbb00561@mail.gmail.com> Message-ID: <470E5CEB.1090000@probo.com> kNish wrote: > > Need : To track time when a workstation is locked and when > it is unlocked. Store this time. > My approach : 1st Option > Trap the key "ctrl+alt+del" or "windows+l". trigger a > procedure to save the time in and time out into a database. You can't trap ctrl+alt+del. That is one of the key security rules of Windows. The whole purpose of ctrl+alt+del is to have a key sequence which is guaranteed to go straight to the operating system, without any traps or bypasses, so that the user can be confident there are no Trojans in the way before entering a password. > 2nd Option > > Run a procedure that has a while true loop. In this loop > there can be a event capture device to know that a ctrl+alt+del has > been pressed. > > Now run the save to database procedure. > > I think of doing this using python, tkinter, ctype opendesktop. The "usual" way to determine whether the desktop has been locked is to call OpenDesktop on the desktop called "default", and then try to use SwitchDesktop to switch to it. If the SwitchDesktop fails, then the workstation is locked. There's an example in Delphi here: http://www.delphipages.com/threads/thread.cfm?ID=145214&G=145213 and one in Visual Basic here: http://gethelp.devx.com/techtips/nt_pro/10_minute_solutions/10minNT0701-4.asp -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mail at timgolden.me.uk Thu Oct 11 20:31:31 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 11 Oct 2007 19:31:31 +0100 Subject: [python-win32] lock workstation In-Reply-To: <470E5CEB.1090000@probo.com> References: <81bfef2e0710110642y43e2ebcex3b9c229adbb00561@mail.gmail.com> <470E5CEB.1090000@probo.com> Message-ID: <470E6C03.5040408@timgolden.me.uk> Tim Roberts wrote: > The "usual" way to determine whether the desktop has been locked is to > call OpenDesktop on the desktop called "default", and then try to use > SwitchDesktop to switch to it. If the SwitchDesktop fails, then the > workstation is locked. There's an example in Delphi here: > http://www.delphipages.com/threads/thread.cfm?ID=145214&G=145213 > and one in Visual Basic here: > > http://gethelp.devx.com/techtips/nt_pro/10_minute_solutions/10minNT0701-4.asp and, indeed, one in Python here: http://timgolden.me.uk/python/win32_how_do_i/see_if_my_workstation_is_locked.html This, in fact, the OP already knows because he's come to the list at my suggestion after a private email conversation. I wasn't entirely clear why that solution didn't suit his needs to I hope someone here can serve him better. (Your point about not being able to trap Ctrl-Alt-Del might help clear things up a little.) TJG From endavis at gmail.com Thu Oct 11 18:49:39 2007 From: endavis at gmail.com (Eric Davis) Date: Thu, 11 Oct 2007 12:49:39 -0400 Subject: [python-win32] win32evtlogutil.SafeFormatMessage shortcomings Message-ID: Running pywin32 version 210. Python 2.5 I have some events that don't get formatted correctly, basically ones that contain messages from winerror and some events in the security logs. System Log Error [273] ID:7000 Service Control Manager Type: ERROR Time: 10/11/2007 05:13:18 The Network Load Balancing service failed to start due to the following error: %%1058 The 1058 is an error message from the winerror.h header, which I can get with win32api.FormatMessage, but why doesn't SafeFormatMessage do this automatically? Security Log Audit Failure Message Object Open: Object Server: Security Object Type: File Object Name: C:\WINDOWS\DtcInstall.log Handle ID: - Operation ID: {0,72457} Process ID: 1208 Image File Name: Primary User Name: NETWORK SERVICE Primary Domain: NT AUTHORITY Primary Logon ID: (0x0,0x3E4) Client User Name: - Client Domain: - Client Logon ID: - Accesses: %%1538 %%1541 %%4416 %%4417 %%4418 %%4419 %%4420 %%4423 %%4424 Privileges: - Restricted Sid Count: 0 Access Mask: 0x12019F The %% messages are not from winerror.h. I believe the security log has a messages dll of its own, but I have no idea how to get those messages. Again, why doesn't SafeFormatMessage do this automatically? Is there a way that I can do this with the win32api? The messages are formatted correctly with wmi, but wmi is painfully slow because the event logs are so large. Thanks, Eric From timr at probo.com Thu Oct 11 21:33:25 2007 From: timr at probo.com (Tim Roberts) Date: Thu, 11 Oct 2007 12:33:25 -0700 Subject: [python-win32] lock workstation In-Reply-To: <470E6C03.5040408@timgolden.me.uk> References: <81bfef2e0710110642y43e2ebcex3b9c229adbb00561@mail.gmail.com> <470E5CEB.1090000@probo.com> <470E6C03.5040408@timgolden.me.uk> Message-ID: <470E7A85.7030809@probo.com> Tim Golden wrote: > Tim Roberts wrote: > >> The "usual" way to determine whether the desktop has been locked is to >> call OpenDesktop on the desktop called "default", and then try to use >> SwitchDesktop to switch to it. If the SwitchDesktop fails, then the >> workstation is locked. There's an example in Delphi here: >> http://www.delphipages.com/threads/thread.cfm?ID=145214&G=145213 >> and one in Visual Basic here: >> >> http://gethelp.devx.com/techtips/nt_pro/10_minute_solutions/10minNT0701-4.asp >> > > and, indeed, one in Python here: > > http://timgolden.me.uk/python/win32_how_do_i/see_if_my_workstation_is_locked.html > Gosh, Tim, is there ANY Windows tool you haven't built? ;) I'm starting to think that every Python problem can be solved by either a 5-line Twisted script, or a script from Tim Golden's web site. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mhammond at skippinet.com.au Thu Oct 11 23:53:29 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 12 Oct 2007 07:53:29 +1000 Subject: [python-win32] Why the strange frozen dance in win32com/__init__.py? In-Reply-To: <7whcl29fcd.fsf@enki.openend.se> References: <7whcl29fcd.fsf@enki.openend.se> Message-ID: <01b301c80c51$2f00e050$8d02a0f0$@com.au> Note that nothing ever writes this stuff to the registry, so it is really old, dead code that can be removed. By all means, upload a tested patch to sourceforge and I'd be happy to look at it. Cheers, Mark > -----Original Message----- > From: python-win32-bounces at python.org [mailto:python-win32- > bounces at python.org] On Behalf Of quest at openend.se > Sent: Monday, 8 October 2007 6:32 PM > To: python-win32 at python.org > Subject: [python-win32] Why the strange frozen dance in > win32com/__init__.py? > > (My appologies if this has been discussed earlier; my Google-fu may be > weak.) > > pywin32's win32com/__init__.py does this (slightly compacted for > brevity): > > def SetupEnvironment(): > try: > keyName = > "SOFTWARE\\Python\\PythonCore\\%s\\PythonPath\\win32com" % sys.winver > key = win32api.RegOpenKey(HKEY_LOCAL_MACHINE , keyName, 0, > KEY_QUERY_VALUE) > except (win32api.error, AttributeError): > key = None > > try: > found = 0 > if key is not None: > try: > __path__.append(win32api.RegQueryValue(key, > "Extensions" )) > found = 1 > except win32api.error: > pass > if not found: > try: > __path__.append( win32api.GetFullPathName(__path__[0] > + "\\.\ > .\\win32comext") ) > except win32api.error: > pass > > if not sys.frozen: > SetupEnvironment() > > Being a developer of a commercial Python application, I have beef with > this: > > I would much prefer this code to work in the opposite fashion: first > look at the place relative to __path__, then fallback to registry > lookup. My reason is of course, that I have no wish to install a > "standalone" python on the user's box, nor do I want to be tripped by > the presence of one. E.g.: > > cand_extdir = os.path.join(os.path.dirname(__path__[0]), > 'win32comext') > if not os.path.exists(cand_extdir): > keyName = > "SOFTWARE\\Python\\PythonCore\\%s\\PythonPath\\win32com" % \ > sys.winver > key = win32api.RegOpenKey(HKEY_LOCAL_MACHINE , keyName, 0, > KEY_QUERY_VALUE) > try: > cand_extdir = win32api.RegQueryValue(key, "Extensions" ) > except win32api.error: > cand_extdir = None > > if cand_extdir: > __path__.append(cand_extdir) > > The above disregards that SetupEnvironment code is not executed at all > in a frozen state, but I don't have a problem with explicitly calling > a method to get this inited; e.g: > > if getattr(sys, 'frozen', False): > win32com.SetupEnvironment() > -- > Anders Qvist, Open End AB > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From mail at timgolden.me.uk Fri Oct 12 10:19:26 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 12 Oct 2007 09:19:26 +0100 Subject: [python-win32] lock workstation In-Reply-To: <470E7A85.7030809@probo.com> References: <81bfef2e0710110642y43e2ebcex3b9c229adbb00561@mail.gmail.com> <470E5CEB.1090000@probo.com> <470E6C03.5040408@timgolden.me.uk> <470E7A85.7030809@probo.com> Message-ID: <470F2E0E.9080906@timgolden.me.uk> Tim Roberts wrote: > Tim Golden wrote: >> Tim Roberts wrote: >> >>> The "usual" way to determine whether the desktop has been locked is to >>> call OpenDesktop on the desktop called "default", and then try to use >>> SwitchDesktop to switch to it. If the SwitchDesktop fails, then the >>> workstation is locked. There's an example in Delphi here: >>> http://www.delphipages.com/threads/thread.cfm?ID=145214&G=145213 >>> and one in Visual Basic here: >>> >>> http://gethelp.devx.com/techtips/nt_pro/10_minute_solutions/10minNT0701-4.asp >>> >> and, indeed, one in Python here: >> >> http://timgolden.me.uk/python/win32_how_do_i/see_if_my_workstation_is_locked.html >> > > Gosh, Tim, is there ANY Windows tool you haven't built? ;) > > I'm starting to think that every Python problem can be solved by either > a 5-line Twisted script, or a script from Tim Golden's web site. Thanks for the bouquets Funnily enough, I was just saying to a friend that I can go weeks or even months without a question coming up on the lists which is *specific* to stuff I can help with, and then a whole run of them come up in one week. (Or, as we say in London: you wait for ages then three come along at once). TJG From patter001 at gmail.com Fri Oct 12 18:43:09 2007 From: patter001 at gmail.com (Kevin Patterson) Date: Fri, 12 Oct 2007 12:43:09 -0400 Subject: [python-win32] Finding the COM server Message-ID: Once I've successfully called Dispatch and gotten an object back from the COM server, is there a way to determine the path to the exe of the COM server where I got the object from? There are some other DLL's that are not COM servers in the same directory as my COM server, and I'm looking for an easy and reliable way to know the path to those DLLs. Thanks, Kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071012/a9452933/attachment.htm From timr at probo.com Fri Oct 12 19:08:40 2007 From: timr at probo.com (Tim Roberts) Date: Fri, 12 Oct 2007 10:08:40 -0700 Subject: [python-win32] Finding the COM server In-Reply-To: References: Message-ID: <470FAA18.6080108@probo.com> Kevin Patterson wrote: > Once I've successfully called Dispatch and gotten an object back from > the COM server, is there a way to determine the path to the exe of the > COM server where I got the object from? > > There are some other DLL's that are not COM servers in the same > directory as my COM server, and I'm looking for an easy and reliable > way to know the path to those DLLs. You can look it up in the registry, which is exactly what CoCreateInstance does to find the server. It sometimes takes a bit of cross-referencing. Take "Excel.Application", for example. In HKEY_CLASSES_ROOT, Excel.Application\CurVer tells me the version is Excel.Application.11. Excel.Application.11\CLSID tells me the class is {00024500-0000-0000-C000-000000000046} CLSID\{00024500-0000-0000-C000-000000000046}\LocalServer32 tells me the handler is c:\Program Files\Microsoft Office\Office11\Excel.exe. InProcServer32 will be set if it is an in-process DLL. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Fri Oct 12 20:24:15 2007 From: timr at probo.com (Tim Roberts) Date: Fri, 12 Oct 2007 11:24:15 -0700 Subject: [python-win32] Finding the COM server In-Reply-To: References: <470FAA18.6080108@probo.com> Message-ID: <470FBBCF.1010307@probo.com> Kevin Patterson wrote: > Does the registry get updated every time the comserver is run? For > example I know some of my users keep multiple copies of the same rev > (or different revs) in different directories. My script often gets > called after the COM server is up and running: > > So user has: > C:\appA\app.exe > and > C:\appB\app.exe > > The appA may be the one originally installed, but appB directory may > be another copy of the same app only with different config files. If > the user ran appB would the register still points to appA. Well, this is a good question, and having looked into it in more depth, I've discovered that I don't know the answer. Out-of-process servers call CoRegisterClassObject to register their classes with the COM runtime. That doesn't change the registry. I can't find a COM utility to return the process ID for a given CLSID, and without that, I don't know how you'd find the executable name. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From theller at ctypes.org Fri Oct 12 20:57:03 2007 From: theller at ctypes.org (Thomas Heller) Date: Fri, 12 Oct 2007 20:57:03 +0200 Subject: [python-win32] Finding the COM server In-Reply-To: <470FBBCF.1010307@probo.com> References: <470FAA18.6080108@probo.com> <470FBBCF.1010307@probo.com> Message-ID: Tim Roberts schrieb: > Kevin Patterson wrote: >> Does the registry get updated every time the comserver is run? For >> example I know some of my users keep multiple copies of the same rev >> (or different revs) in different directories. My script often gets >> called after the COM server is up and running: >> >> So user has: >> C:\appA\app.exe >> and >> C:\appB\app.exe >> >> The appA may be the one originally installed, but appB directory may >> be another copy of the same app only with different config files. If >> the user ran appB would the register still points to appA. > > Well, this is a good question, and having looked into it in more depth, > I've discovered that I don't know the answer. > > Out-of-process servers call CoRegisterClassObject to register their > classes with the COM runtime. That doesn't change the registry. I > can't find a COM utility to return the process ID for a given CLSID, and > without that, I don't know how you'd find the executable name. > I think that's not entirely correct. Out-of-process servers call CoRegisterClassObject *only* to make the class factory available to the COM runtime. The server is still started with CoCreateInstance looking into the registry for finding the executable to start. I event think that at least /some/ out-of-process servers update the registry each time they are started. But, a simple experiment should find out if that's the case for the OP's app.exe. Thomas From timr at probo.com Fri Oct 12 23:19:57 2007 From: timr at probo.com (Tim Roberts) Date: Fri, 12 Oct 2007 14:19:57 -0700 Subject: [python-win32] Finding the COM server In-Reply-To: References: <470FAA18.6080108@probo.com> <470FBBCF.1010307@probo.com> Message-ID: <470FE4FD.6010306@probo.com> Thomas Heller wrote: > Tim Roberts schrieb: > >> Out-of-process servers call CoRegisterClassObject to register their >> classes with the COM runtime. That doesn't change the registry. I >> can't find a COM utility to return the process ID for a given CLSID, and >> without that, I don't know how you'd find the executable name. >> > I think that's not entirely correct. Out-of-process servers call CoRegisterClassObject > *only* to make the class factory available to the COM runtime. The server is still > started with CoCreateInstance looking into the registry for finding the executable > to start. > He said the users are starting the server process manually. In that case, I believe CoCreateInstance will connect to the registered server without going to the registry. I admit that I have not stepped through CoCreateInstance to see if this is the case. If they weren't starting the process manually, then the registry would be exactly the right answer. > I event think that at least /some/ out-of-process servers update the registry > each time they are started. But, a simple experiment should find out if that's > the case for the OP's app.exe. > Yes. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From oliver at hallmarkins.net Mon Oct 15 01:12:55 2007 From: oliver at hallmarkins.net (Oliver T. Nelson) Date: Sun, 14 Oct 2007 16:12:55 -0700 Subject: [python-win32] Server Busy messages Message-ID: <4712A277.40001@hallmarkins.net> I'm using MapPoint 2006 successfully, but I'm stuck on a problem that I can't find settings for. MapPoint sometimes runs long processes that can cause a server busy message to come up. In VB there are some settings you can adjust to deal with this (see http://www.codeguru.com/forum/showthread.php?t=328534). But I don't see how I would accomplish this. There is another article in MSDN on this issue (it is not MapPoint specific, but MPs processing needs really can make it an issue) that says how to deal with this is C++ .NET (http://support.microsoft.com/kb/248019). Does anyone have a way of dealing with this? Thanx, OLIVER From ckkart at hoc.net Tue Oct 16 06:34:54 2007 From: ckkart at hoc.net (Christian K.) Date: Tue, 16 Oct 2007 04:34:54 +0000 (UTC) Subject: [python-win32] writin Outlook's custom action rules in python? Message-ID: Hi, is there any chance that one could write a custom action rule (CAR, see http://support.microsoft.com/?kbid=151690) for Outlook in python? Christian From ckkart at hoc.net Tue Oct 16 08:47:55 2007 From: ckkart at hoc.net (Christian K.) Date: Tue, 16 Oct 2007 06:47:55 +0000 (UTC) Subject: [python-win32] gui examples Message-ID: Hi, could somebody point me please to examples of gui programming using pywin32? Thanks, Christian From lreenaers at ressource-toi.org Tue Oct 16 11:46:59 2007 From: lreenaers at ressource-toi.org (Ludovic Reenaers) Date: Tue, 16 Oct 2007 11:46:59 +0200 Subject: [python-win32] gui examples References: Message-ID: <000601c80fd9$81d7c2e0$4001a8c0@PERCEVAL> Hi, you should download WxPython there is a pretty nice documentation with very detailed samples. cheers, Ludo ----- Original Message ----- From: "Christian K." To: Sent: Tuesday, October 16, 2007 8:47 AM Subject: [python-win32] gui examples > Hi, > could somebody point me please to examples of gui programming using > pywin32? > Thanks, Christian > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From ckkart at hoc.net Tue Oct 16 11:53:43 2007 From: ckkart at hoc.net (Christian K.) Date: Tue, 16 Oct 2007 09:53:43 +0000 (UTC) Subject: [python-win32] gui examples References: Message-ID: Ludovic Reenaers wrote: > Hi, > you should download WxPython there is a pretty nice documentation with very detailed samples. > cheers, I know, thanks. wxPython is usually my first choice, however this time I just need some simple stuff, e.g. simple dialogs, message boxes and I don't want to have that additional dependency. I tried to learn from VB scripts, but all the gui stuff is usually done with a gui builder, if I'm not wrong. So not much to learn there. Christian From mail at timgolden.me.uk Tue Oct 16 12:40:44 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 16 Oct 2007 11:40:44 +0100 Subject: [python-win32] gui examples In-Reply-To: References: Message-ID: <4714952C.4080904@timgolden.me.uk> Christian K. wrote: > Ludovic Reenaers wrote: >> Hi, >> you should download WxPython there is a pretty nice documentation with very > detailed samples. >> cheers, > > I know, thanks. wxPython is usually my first choice, however this time I just > need some simple stuff, e.g. simple dialogs, message boxes If that's really all you need, have a look at easygui: http://www.ferg.org/easygui/ There's a couple of tutorials on showmedo.com, as well: http://showmedo.com/videos/series?name=pythonJensFromKidsSeries Doing the same directly from the pywin32 extensions is fairly straightforward as well. If you want to go that way I'll try to rustle up a couple of examples. TJG From ckkart at hoc.net Tue Oct 16 15:32:47 2007 From: ckkart at hoc.net (Christian K.) Date: Tue, 16 Oct 2007 13:32:47 +0000 (UTC) Subject: [python-win32] gui examples References: <4714952C.4080904@timgolden.me.uk> Message-ID: Tim Golden timgolden.me.uk> writes: > > Christian K. wrote: > > Ludovic Reenaers wrote: > >> Hi, > >> you should download WxPython there is a pretty nice documentation with very > > detailed samples. > >> cheers, > > > > I know, thanks. wxPython is usually my first choice, however this time I just > > need some simple stuff, e.g. simple dialogs, message boxes > > If that's really all you need, have a look at easygui: > > http://www.ferg.org/easygui/ Indeed, that should provide everything I need, although I'd prefer using the native gui elements and not Tk. Christian From theller at ctypes.org Tue Oct 16 16:30:47 2007 From: theller at ctypes.org (Thomas Heller) Date: Tue, 16 Oct 2007 16:30:47 +0200 Subject: [python-win32] gui examples In-Reply-To: References: <4714952C.4080904@timgolden.me.uk> Message-ID: Christian K. schrieb: > Tim Golden timgolden.me.uk> writes: > >> >> Christian K. wrote: >> > Ludovic Reenaers wrote: >> >> Hi, >> >> you should download WxPython there is a pretty nice documentation with very >> > detailed samples. >> >> cheers, >> > >> > I know, thanks. wxPython is usually my first choice, however this time I just >> > need some simple stuff, e.g. simple dialogs, message boxes >> >> If that's really all you need, have a look at easygui: >> >> http://www.ferg.org/easygui/ > > Indeed, that should provide everything I need, although I'd prefer using the > native gui elements and not Tk. > > Christian For Windows, there's also EasyDialogs, which uses native GUI elements: http://www.averdevelopment.com/python/EasyDialogs.html Thomas From timr at probo.com Tue Oct 16 19:15:58 2007 From: timr at probo.com (Tim Roberts) Date: Tue, 16 Oct 2007 10:15:58 -0700 Subject: [python-win32] writin Outlook's custom action rules in python? In-Reply-To: References: Message-ID: <4714F1CE.6090006@probo.com> Christian K. wrote: > Hi, > is there any chance that one could write a custom action rule > (CAR, see http://support.microsoft.com/?kbid=151690) > for Outlook in python? > Those rules add-ins are just COM servers, so theoretically you should be able to do it in Python. The trick, of course, is figuring out which interfaces you need to handle. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From ckkart at hoc.net Wed Oct 17 02:55:01 2007 From: ckkart at hoc.net (Christian K.) Date: Wed, 17 Oct 2007 00:55:01 +0000 (UTC) Subject: [python-win32] gui examples References: <4714952C.4080904@timgolden.me.uk> Message-ID: Thanks everybody for all the pointers. I've enough to play with now. Christian From ckkart at hoc.net Wed Oct 17 08:12:15 2007 From: ckkart at hoc.net (Christian K.) Date: Wed, 17 Oct 2007 15:12:15 +0900 Subject: [python-win32] unable to receive button click notifications Message-ID: Hi, I'm just trying the pywin gui examples and I'm wondering why I won't receive any BN_CLICKED notifications in the code attached. Can anyone help? Christian -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: notify.py Url: http://mail.python.org/pipermail/python-win32/attachments/20071017/deb0bc66/attachment.txt From lakki712 at gmail.com Wed Oct 17 12:01:07 2007 From: lakki712 at gmail.com (lakki p) Date: Wed, 17 Oct 2007 15:31:07 +0530 Subject: [python-win32] Regarding Embedded Pyhton Message-ID: <7d95ff950710170301p459a96b7i41e24701192bbe1c@mail.gmail.com> Hi, i try to execute attached example.but it showing error "wchar.h" unable to open. just i commented where it was showing. still i am getting errors like unresolved external reference Py_Initialize and Py_Finalize and PyInt_FromLong. Thanks, Lakshmi. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071017/1752e898/attachment.htm From lakki712 at gmail.com Wed Oct 17 12:02:18 2007 From: lakki712 at gmail.com (lakki p) Date: Wed, 17 Oct 2007 15:32:18 +0530 Subject: [python-win32] Fwd: Regarding Embedded Pyhton In-Reply-To: <7d95ff950710170301p459a96b7i41e24701192bbe1c@mail.gmail.com> References: <7d95ff950710170301p459a96b7i41e24701192bbe1c@mail.gmail.com> Message-ID: <7d95ff950710170302s526a4b89y50f2b34984e127e1@mail.gmail.com> ---------- Forwarded message ---------- From: lakki p Date: Oct 17, 2007 3:31 PM Subject: Regarding Embedded Pyhton To: python-win32 at python.org Hi, i try to execute attached example.but it showing error "wchar.h" unable to open. just i commented where it was showing. still i am getting errors like unresolved external reference Py_Initialize and Py_Finalize and PyInt_FromLong. Thanks, Lakshmi. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071017/03ff1d76/attachment.htm -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: embedded.txt Url: http://mail.python.org/pipermail/python-win32/attachments/20071017/03ff1d76/attachment.txt From p.f.moore at gmail.com Wed Oct 17 12:16:11 2007 From: p.f.moore at gmail.com (Paul Moore) Date: Wed, 17 Oct 2007 11:16:11 +0100 Subject: [python-win32] Regarding Embedded Pyhton In-Reply-To: <7d95ff950710170301p459a96b7i41e24701192bbe1c@mail.gmail.com> References: <7d95ff950710170301p459a96b7i41e24701192bbe1c@mail.gmail.com> Message-ID: <79990c6b0710170316o42182f4r3ee24b66151e20c1@mail.gmail.com> On 17/10/2007, lakki p wrote: > Hi, > i try to execute attached example.but it showing error "wchar.h" unable to > open. > just i commented where it was showing. > still i am getting errors like unresolved external reference Py_Initialize > and Py_Finalize and PyInt_FromLong. > Thanks, > Lakshmi. What C compiler are you using? Python requires a compiler that supports standard C, and I'm pretty sure that wchar.h is a required header from the C standard. In other words, it sounds like your C compiler is broken, or doesn't support the ANSI C standard. Paul. From matherbe at cisco.com Wed Oct 17 17:01:31 2007 From: matherbe at cisco.com (Matt Herbert (matherbe)) Date: Wed, 17 Oct 2007 11:01:31 -0400 Subject: [python-win32] Automating logon/logoff Message-ID: <249A89BAA060C94FA0B93EA6135CC93C044E2CB3@xmb-rtp-20b.amer.cisco.com> Hello all, I am stumped trying to figure out how I can automate the login/logoff procedure on Windows. Here is what I know so far. First, I can logoff the system pretty easily using win32api.ExitWindowsEx() function. Second, I can auto logon the system (after a reboot) using the special registry keys (DefaultUserName, DefaultPassword, DefaultDomain). Third, I will have to wrap everything up in a service, so I can be running at the desktop and the logon screen. So the hard part that I can't figure out, is how do I programmatically initiate a logon, after a logoff? Here is the rough sequence of events I want to achieve: 1 MyPyService is running (at desktop) 2 User requests an automated test 3 MyPyService starts the test 4 MyPyService logs the user off 5 MyPyService wait's for something to happen 6 MyPyService logs a user on Any hints or help on step 6 would be greatly appreciated -Matt From larry.bates at websafe.com Thu Oct 18 01:33:54 2007 From: larry.bates at websafe.com (Larry Bates) Date: Wed, 17 Oct 2007 18:33:54 -0500 Subject: [python-win32] Automating logon/logoff In-Reply-To: <249A89BAA060C94FA0B93EA6135CC93C044E2CB3@xmb-rtp-20b.amer.cisco.com> References: <249A89BAA060C94FA0B93EA6135CC93C044E2CB3@xmb-rtp-20b.amer.cisco.com> Message-ID: Matt Herbert (matherbe) wrote: > Hello all, > > I am stumped trying to figure out how I can automate the login/logoff > procedure on Windows. Here is what I know so far. First, I can logoff > the system pretty easily using win32api.ExitWindowsEx() function. > Second, I can auto logon the system (after a reboot) using the special > registry keys (DefaultUserName, DefaultPassword, DefaultDomain). Third, > I will have to wrap everything up in a service, so I can be running at > the desktop and the logon screen. > > So the hard part that I can't figure out, is how do I programmatically > initiate a logon, after a logoff? Here is the rough sequence of events I > want to achieve: > > 1 MyPyService is running (at desktop) > 2 User requests an automated test > 3 MyPyService starts the test > 4 MyPyService logs the user off > 5 MyPyService wait's for something to happen > 6 MyPyService logs a user on > > > Any hints or help on step 6 would be greatly appreciated > > -Matt Maybe a use case description would help us. Why would you want a service to log users off and back on? If you want to run a task as a user there is a RunAs capability. Automating logon is probably seen as a security problem by M$. -Larry From pv at google.com Thu Oct 18 01:44:16 2007 From: pv at google.com (Paul Peavyhouse) Date: Wed, 17 Oct 2007 16:44:16 -0700 Subject: [python-win32] Automating logon/logoff In-Reply-To: References: <249A89BAA060C94FA0B93EA6135CC93C044E2CB3@xmb-rtp-20b.amer.cisco.com> Message-ID: I do this in my EggplantHelper (don't be fooled by the name, it has nothing to do w/ Eggplant...a rename is pending). http://wiki/Main/EggplantHelper from xmlrpclib import * s = ServerProxy('http://x.x.x.x:7399') s.win32.LogOffAndOnAs('', 'username', 'password') Pv On 10/17/07, Larry Bates wrote: > > Matt Herbert (matherbe) wrote: > > Hello all, > > > > I am stumped trying to figure out how I can automate the login/logoff > > procedure on Windows. Here is what I know so far. First, I can logoff > > the system pretty easily using win32api.ExitWindowsEx() function. > > Second, I can auto logon the system (after a reboot) using the special > > registry keys (DefaultUserName, DefaultPassword, DefaultDomain). Third, > > I will have to wrap everything up in a service, so I can be running at > > the desktop and the logon screen. > > > > So the hard part that I can't figure out, is how do I programmatically > > initiate a logon, after a logoff? Here is the rough sequence of events I > > want to achieve: > > > > 1 MyPyService is running (at desktop) > > 2 User requests an automated test > > 3 MyPyService starts the test > > 4 MyPyService logs the user off > > 5 MyPyService wait's for something to happen > > 6 MyPyService logs a user on > > > > > > Any hints or help on step 6 would be greatly appreciated > > > > -Matt > > Maybe a use case description would help us. Why would you want a service > to log > users off and back on? If you want to run a task as a user there is a > RunAs > capability. Automating logon is probably seen as a security problem by > M$. > > -Larry > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- Windows Software Engineer in Test - Google Pack/Updater Cell: 425-891-4796 http://wiki/Main/LogonStarter http://wiki/Main/EggplantHelper http://wiki/Main/WatchDog -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071017/334eff8b/attachment.htm From mhammond at skippinet.com.au Thu Oct 18 07:47:40 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 18 Oct 2007 15:47:40 +1000 Subject: [python-win32] unable to receive button click notifications In-Reply-To: References: Message-ID: <019801c8114a$699602b0$3cc20810$@com.au> > I'm just trying the pywin gui examples and I'm wondering why I won't > receive any BN_CLICKED notifications in the code attached. Can anyone > help? It might be that you are using win32ui, and therefore using MFC, and IIRC, it has 'Reflected Messages' that may send the notification back to the control itself. An alternative is to use win32gui, which wraps the raw win32 functions, so operates more as a "normal" Windows application. The win32/Demos/win32gui_*.py files has some examples of windows that create controls and handle notifications from them. HTH, Mark From mail at timgolden.me.uk Thu Oct 18 09:07:04 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 18 Oct 2007 08:07:04 +0100 Subject: [python-win32] Automating logon/logoff In-Reply-To: <249A89BAA060C94FA0B93EA6135CC93C044E2CB3@xmb-rtp-20b.amer.cisco.com> References: <249A89BAA060C94FA0B93EA6135CC93C044E2CB3@xmb-rtp-20b.amer.cisco.com> Message-ID: <47170618.8060806@timgolden.me.uk> Matt Herbert (matherbe) wrote: > Hello all, > > I am stumped trying to figure out how I can automate the login/logoff > procedure on Windows. Here is what I know so far. First, I can logoff > the system pretty easily using win32api.ExitWindowsEx() function. > Second, I can auto logon the system (after a reboot) using the special > registry keys (DefaultUserName, DefaultPassword, DefaultDomain). Third, > I will have to wrap everything up in a service, so I can be running at > the desktop and the logon screen. > > So the hard part that I can't figure out, is how do I programmatically > initiate a logon, after a logoff? Here is the rough sequence of events I > want to achieve: > > 1 MyPyService is running (at desktop) > 2 User requests an automated test > 3 MyPyService starts the test > 4 MyPyService logs the user off > 5 MyPyService wait's for something to happen > 6 MyPyService logs a user on I may be misunderstanding, but following the information here: http://msdn2.microsoft.com/en-us/library/aa378750.aspx I added, in addition to the keys you mention above: AutoAdminLogon = 1 AutoLogonCount = 1 I logged out and -- sure enough -- it logged me back in as me. Is that what you were after? TJG From matherbe at cisco.com Thu Oct 18 15:26:17 2007 From: matherbe at cisco.com (Matt Herbert (matherbe)) Date: Thu, 18 Oct 2007 09:26:17 -0400 Subject: [python-win32] Automating logon/logoff In-Reply-To: Message-ID: <249A89BAA060C94FA0B93EA6135CC93C044E318A@xmb-rtp-20b.amer.cisco.com> > -----Original Message----- > From: python-win32-bounces at python.org > [mailto:python-win32-bounces at python.org] On Behalf Of Larry Bates > Sent: Wednesday, October 17, 2007 7:34 PM > To: python-win32 at python.org > Subject: Re: [python-win32] Automating logon/logoff > > Matt Herbert (matherbe) wrote: > > Hello all, > > > > I am stumped trying to figure out how I can automate the > login/logoff > > procedure on Windows. Here is what I know so far. First, I > can logoff > > the system pretty easily using win32api.ExitWindowsEx() function. > > Second, I can auto logon the system (after a reboot) using > the special > > registry keys (DefaultUserName, DefaultPassword, DefaultDomain). > > Third, I will have to wrap everything up in a service, so I can be > > running at the desktop and the logon screen. > > > > So the hard part that I can't figure out, is how do I > programmatically > > initiate a logon, after a logoff? Here is the rough > sequence of events > > I want to achieve: > > > > 1 MyPyService is running (at desktop) > > 2 User requests an automated test > > 3 MyPyService starts the test > > 4 MyPyService logs the user off > > 5 MyPyService wait's for something to happen > > 6 MyPyService logs a user on > > > > > > Any hints or help on step 6 would be greatly appreciated > > > > -Matt > > Maybe a use case description would help us. Why would you > want a service to log users off and back on? If you want to > run a task as a user there is a RunAs capability. Automating > logon is probably seen as a security problem by M$. > > -Larry Here is a little background. I am automating the testing of a wireless network client. The client must be able to establish a connection when at the logon prompt, using one set of credentials. If a user then log's in, the client must break the connection, and establish a new connection using the user's credentials. It is important that the client does this, at the correct times, so GPO's, scripts, and domain logon's can all occur as they should. There are hundreds of test cases that are currently manually tested. If I can just figure out how I can log a user on, at the right time, it would save a lot of work. One thing I've considered, though I'm not sure if it would work, is using a little bit of GUI automation to enter a username and password, then click the logon button. I'm not sure if I can access the GUI elements when I am on the logon desktop though. -Matt From matherbe at cisco.com Thu Oct 18 15:42:53 2007 From: matherbe at cisco.com (Matt Herbert (matherbe)) Date: Thu, 18 Oct 2007 09:42:53 -0400 Subject: [python-win32] Automating logon/logoff In-Reply-To: <47170618.8060806@timgolden.me.uk> Message-ID: <249A89BAA060C94FA0B93EA6135CC93C044E31BB@xmb-rtp-20b.amer.cisco.com> > -----Original Message----- > From: Tim Golden [mailto:mail at timgolden.me.uk] > Sent: Thursday, October 18, 2007 3:07 AM > To: Matt Herbert (matherbe) > Cc: python-win32 at python.org > Subject: Re: [python-win32] Automating logon/logoff > > Matt Herbert (matherbe) wrote: > > Hello all, > > > > I am stumped trying to figure out how I can automate the > login/logoff > > procedure on Windows. Here is what I know so far. First, I > can logoff > > the system pretty easily using win32api.ExitWindowsEx() function. > > Second, I can auto logon the system (after a reboot) using > the special > > registry keys (DefaultUserName, DefaultPassword, DefaultDomain). > > Third, I will have to wrap everything up in a service, so I can be > > running at the desktop and the logon screen. > > > > So the hard part that I can't figure out, is how do I > programmatically > > initiate a logon, after a logoff? Here is the rough > sequence of events > > I want to achieve: > > > > 1 MyPyService is running (at desktop) > > 2 User requests an automated test > > 3 MyPyService starts the test > > 4 MyPyService logs the user off > > 5 MyPyService wait's for something to happen > > 6 MyPyService logs a user on > > I may be misunderstanding, but following the information here: > > http://msdn2.microsoft.com/en-us/library/aa378750.aspx > > I added, in addition to the keys you mention above: > > AutoAdminLogon = 1 > AutoLogonCount = 1 > > I logged out and -- sure enough -- it logged me back in as me. > > Is that what you were after? > > TJG > Thomas, I've seen this. The problem is, I can't "hold off" the logon. It automatically logs the user in right away. I need to be able to hold off the logon, until I've verified that I have established a network connection during step 5. That may take anywhere from a couple of seconds, to a couple of minutes (worst case). Thanks -Matt From matherbe at cisco.com Thu Oct 18 16:09:55 2007 From: matherbe at cisco.com (Matt Herbert (matherbe)) Date: Thu, 18 Oct 2007 10:09:55 -0400 Subject: [python-win32] Automating logon/logoff In-Reply-To: <249A89BAA060C94FA0B93EA6135CC93C044E31BB@xmb-rtp-20b.amer.cisco.com> Message-ID: <249A89BAA060C94FA0B93EA6135CC93C044E31D6@xmb-rtp-20b.amer.cisco.com> > > Thomas, > Wooops, I meant to say Tim. Sorry bout that. -Matt From mail at timgolden.me.uk Thu Oct 18 16:13:21 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 18 Oct 2007 15:13:21 +0100 Subject: [python-win32] Automating logon/logoff In-Reply-To: <249A89BAA060C94FA0B93EA6135CC93C044E31BB@xmb-rtp-20b.amer.cisco.com> References: <249A89BAA060C94FA0B93EA6135CC93C044E31BB@xmb-rtp-20b.amer.cisco.com> Message-ID: <47176A01.5010807@timgolden.me.uk> Matt Herbert (matherbe) wrote: > > >> -----Original Message----- >> From: Tim Golden [mailto:mail at timgolden.me.uk] >> Sent: Thursday, October 18, 2007 3:07 AM >> To: Matt Herbert (matherbe) >> Cc: python-win32 at python.org >> Subject: Re: [python-win32] Automating logon/logoff >> >> Matt Herbert (matherbe) wrote: >>> Hello all, >>> >>> I am stumped trying to figure out how I can automate the >> login/logoff >>> procedure on Windows. Here is what I know so far. First, I >> can logoff >>> the system pretty easily using win32api.ExitWindowsEx() function. >>> Second, I can auto logon the system (after a reboot) using >> the special >>> registry keys (DefaultUserName, DefaultPassword, DefaultDomain). >>> Third, I will have to wrap everything up in a service, so I can be >>> running at the desktop and the logon screen. >>> >>> So the hard part that I can't figure out, is how do I >> programmatically >>> initiate a logon, after a logoff? Here is the rough >> sequence of events >>> I want to achieve: >>> >>> 1 MyPyService is running (at desktop) >>> 2 User requests an automated test >>> 3 MyPyService starts the test >>> 4 MyPyService logs the user off >>> 5 MyPyService wait's for something to happen >>> 6 MyPyService logs a user on >> I may be misunderstanding, but following the information here: >> >> http://msdn2.microsoft.com/en-us/library/aa378750.aspx >> >> I added, in addition to the keys you mention above: >> >> AutoAdminLogon = 1 >> AutoLogonCount = 1 >> >> I logged out and -- sure enough -- it logged me back in as me. >> >> Is that what you were after? >> >> TJG >> > > Thomas, I've seen this. The problem is, I can't "hold off" the logon. > It automatically logs the user in right away. I need to be able to > hold off the logon, until I've verified that I have established a > network connection during step 5. That may take anywhere from a couple > of seconds, to a couple of minutes (worst case). (Tim, actually :) By sheer synchronicity, this appeared yesterday on Raymond Chen's blog: http://blogs.msdn.com/oldnewthing/archive/2007/10/16/5465592.aspx TJG From tnelson at onresolve.com Thu Oct 18 20:05:58 2007 From: tnelson at onresolve.com (Trent Nelson) Date: Thu, 18 Oct 2007 20:05:58 +0200 Subject: [python-win32] Announcement: Project to get some CPython C extensions running underIronPython In-Reply-To: <470FAE6B.3030203@resolversystems.com> References: <470FAE6B.3030203@resolversystems.com> Message-ID: Giles, Just a thought: if you've got some energy you're willing to invest, perhaps you could redirect it to getting win32com to support the generation of type libraries for Python classes that are exposed as COM objects. If you've got a .tlb available, you can use 'tlbimp' to generate .NET assemblies, which you could use directly in IronPython (http://msdn2.microsoft.com/en-us/library/ms973800.aspx). Disadvantage of this approach, obviously, is that it relies on the Python class to expose itself as a COM object, which isn't very common for your average CPython library. Perhaps proxying the object in some way to 'fill in' the relevant COM bits needed in order for the type library to be generated would work... CC'd python-win32 for additional input... Trent. ________________________________ From: python-announce-list-bounces at python.org [mailto:python-announce-list-bounces at python.org] On Behalf Of Giles Thomas Sent: 12 October 2007 18:27 To: python-announce-list at python.org Subject: Announcement: Project to get some CPython C extensions running underIronPython The great thing about CPython is that it comes with the batteries included. The problem with IronPython is that some of these batteries just don't fit - in particular, most of the the C extensions don't work. We'd like to help fix at least some of this problem, to help people who use IronPython to use their CPython scripts without having to port everything over to .NET. Solving the general problem - plugging an arbitrary C extension into IronPython - is a huge project, and we're not even sure we could work out *how much work it is* without a lot of investigation. What we intend to do is to solve a specific problem, to integrate just one extension, and to use that project as a testbed to examine the possibilities for getting other extensions working - and perhaps, in the long term, solving the general problem. We think that any solution like this will be valuable not just to us, but to the Python community as a whole. And so, we want to make it Open Source. Right now, we'd really like to hear from people about the following: * Who wants to get involved? We're really keen on working with other people on this. * Which module should we go for? NumPy looks like a good start, as it gives us a start on getting SciPy working. But perhaps there are better choices. * Should this be a new project, or should we be talking to other people about getting it into other projects? * Which license? If we're to work on it with a view to building it into Resolver One, then it will need to be commercial-software-friendly. Apart from that - we have no view. * What is the best architecture? We're thinking of this as being a bit of C# managed code to interface with the C extension, and a thin Python wrapper on top. The module's existing C extension and Python code would "sandwich" this layer. Let us know if this is a silly idea :-) * Is there anything else we should be thinking about to get this started? Any thoughts much appreciated! Regards, Giles -- Giles Thomas MD & CTO, Resolver Systems Ltd. giles.thomas at resolversystems.com +44 (0) 20 7253 6372 We're hiring! http://www.resolversystems.com/jobs/ 17a Clerkenwell Road, London EC1M 5RD, UK VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329. Registered address: 843 Finchley Road, London NW11 8NA, UK From nick.collier at gmail.com Fri Oct 19 00:24:35 2007 From: nick.collier at gmail.com (Nick Collier) Date: Thu, 18 Oct 2007 18:24:35 -0400 Subject: [python-win32] 'No such interface supported' question Message-ID: <16297C28-057B-4299-A004-AE7405FBF9B9@gmail.com> Hi, I'm trying to use python to work with the various ESRI (the GIS folks) com libraries. However, I'm running into some difficulties. I've run makepy on the type library I'm interested in working with and that yields: ... # This CoClass is known by the name 'esriSystem.AoInitialize.1' class AoInitialize(CoClassBaseClass): # A CoClass ... But dispatching to that >>> client.Dispatch("esriSystem.AoInitialize.1") Traceback (most recent call last): File "", line 1, in File "C:\Python25\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName (dispatch,userName,clsctx) File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147467262, 'No such interface supported', None, None) I'm assuming that this is because this doesn't implement IDispatch. The relevant VB code does: Set m_pAoInitialize = New AoInitialize Is there any equivalent in win32com (or even ctypes) that I can use to get this working or is Python out of the question here? thanks very much, Nick From Andrew.MacIntyre at acma.gov.au Fri Oct 19 02:25:53 2007 From: Andrew.MacIntyre at acma.gov.au (Andrew MacIntyre) Date: Fri, 19 Oct 2007 10:25:53 +1000 Subject: [python-win32] 'No such interface supported' question [SEC=UNCLASSIFIED] Message-ID: <7B01D7143C4AD54899EA079D4557562A5CDAFB@ACT01EXC02.internal.govt> Nick Collier wrote: > I'm trying to use python to work with the various ESRI (the GIS > folks) com libraries. However, I'm running into some difficulties. > > I've run makepy on the type library I'm interested in working with > and that yields: > > ... > # This CoClass is known by the name 'esriSystem.AoInitialize.1' > class AoInitialize(CoClassBaseClass): # A CoClass ... > > > But dispatching to that > > >>> client.Dispatch("esriSystem.AoInitialize.1") > Traceback (most recent call last): > File "", line 1, in > File "C:\Python25\Lib\site-packages\win32com\client\__init__.py", > line 95, in Dispatch > dispatch, userName = dynamic._GetGoodDispatchAndUserName > (dispatch,userName,clsctx) > File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", > line 98, in _GetGoodDispatchAndUserName > return (_GetGoodDispatch(IDispatch, clsctx), userName) > File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", > line 78, in _GetGoodDispatch > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, > pythoncom.IID_IDispatch) > com_error: (-2147467262, 'No such interface supported', None, None) > > I'm assuming that this is because this doesn't implement IDispatch. > > The relevant VB code does: > > Set m_pAoInitialize = New AoInitialize > > Is there any equivalent in win32com (or even ctypes) that I can use to > get this working or is Python out of the question here? A lot of the ESRI COM stuff doesn't support IDispatch. ctypes, with the comtypes add-on module, can be used to call the ESRI COM interfaces quite successfully in my experience. I've not tried using the ESRI 9.x stuff yet - still using 8.3 and an ancient version of ctypes. With the ESRI 8.x TLBs, there were issues where many of the names were declared out of order as far as Python was concerned and the generated modules had to be manually edited to rectify this. With 9.x, ESRI split the TLBs up a lot more so I don't know how much this affects what gets generated. -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre National Licensing and Allocations Branch tel: +61 2 6219 5356 Inputs to Industry Division fax: +61 2 6253 3277 Australian Communications & Media Authority email: andrew.macintyre at acma.gov.au From nick.collier at gmail.com Sat Oct 20 00:15:40 2007 From: nick.collier at gmail.com (Nick Collier) Date: Fri, 19 Oct 2007 18:15:40 -0400 Subject: [python-win32] comtypes methods vs. properties question In-Reply-To: <7B01D7143C4AD54899EA079D4557562A5CDAFB@ACT01EXC02.internal.govt> References: <7B01D7143C4AD54899EA079D4557562A5CDAFB@ACT01EXC02.internal.govt> Message-ID: <0DF27548-C957-4C9E-9851-BA054EC96580@gmail.com> Thanks very much for the reply -- that got me a good way there, but now I have further questions. I'm working with some ESRI com libraries. I've managed to retrieve an ILayer from an IMap and then cast IFeatureLayer from the ILayer. fc = layer.QueryInterface(comtypes.gen.esriGeoDatabase.IFeatureLayer) I don't have much experience at all with COM and what's confusing me now is difference between methods and properties as they are seen by comtypes. I can do feature.DataSourceType and get: u'Personal Geodatabase Feature Class' but doing: feature.FeatureClass which is what I really need to do, yields: > And feature.FeatureClass() yields: Traceback (most recent call last): File "", line 1, in TypeError: required argument 'fclass' missing fclass needs to be a pointer to an IFeatureClass whose CoClass, FeatureClass, is a non-creatable COM class. I'm not sure if matters but the relevant parts of feature._methods_ are: (, '_get_FeatureClass', (,), ((10, 'fclass'),), ('propget', u"The layer's feature class."), u" The layer's feature class.") (, 'FeatureClass', (,), ((1, 'fclass'),), ('propputref', u"The layer's feature class."), u"The layer's feature class.") (, '_get_DataSourceType', (,), ((10, 'Text'),), ('propget', u'Data source type.'), u'Data source type.') (, '_set_DataSourceType', (,), ((1, 'Text'),), ('propput', u'Data source type.'), u'Data source type.') Lastly, feature.FeatureClass works fine in VB, for what that's worth. FeatureClass is read-only. Would that have anything to do with it? thanks very much, Nick On Oct 18, 2007, at 8:25 PM, Andrew MacIntyre wrote: > Nick Collier wrote: > >> I'm trying to use python to work with the various ESRI (the GIS >> folks) com libraries. However, I'm running into some difficulties. >> >> I've run makepy on the type library I'm interested in working with >> and that yields: >> >> ... >> # This CoClass is known by the name 'esriSystem.AoInitialize.1' >> class AoInitialize(CoClassBaseClass): # A CoClass ... >> >> >> But dispatching to that >> >>>>> client.Dispatch("esriSystem.AoInitialize.1") >> Traceback (most recent call last): >> File "", line 1, in >> File "C:\Python25\Lib\site-packages\win32com\client\__init__.py", >> line 95, in Dispatch >> dispatch, userName = dynamic._GetGoodDispatchAndUserName >> (dispatch,userName,clsctx) >> File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", >> line 98, in _GetGoodDispatchAndUserName >> return (_GetGoodDispatch(IDispatch, clsctx), userName) >> File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", >> line 78, in _GetGoodDispatch >> IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, >> pythoncom.IID_IDispatch) >> com_error: (-2147467262, 'No such interface supported', None, None) >> >> I'm assuming that this is because this doesn't implement IDispatch. >> >> The relevant VB code does: >> >> Set m_pAoInitialize = New AoInitialize >> >> Is there any equivalent in win32com (or even ctypes) that I can >> use to > >> get this working or is Python out of the question here? > > A lot of the ESRI COM stuff doesn't support IDispatch. ctypes, > with the > comtypes add-on module, can be used to call the ESRI COM interfaces > quite successfully in my experience. > > I've not tried using the ESRI 9.x stuff yet - still using 8.3 and an > ancient version of ctypes. With the ESRI 8.x TLBs, there were issues > where many of the names were declared out of order as far as Python > was > concerned and the generated modules had to be manually edited to > rectify > this. With 9.x, ESRI split the TLBs up a lot more so I don't know how > much this affects what gets generated. > > -------------------------> "These thoughts are mine alone!" <--------- > Andrew MacIntyre National Licensing and Allocations Branch > tel: +61 2 6219 5356 Inputs to Industry Division > fax: +61 2 6253 3277 Australian Communications & Media Authority > email: andrew.macintyre at acma.gov.au > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From Andrew.MacIntyre at acma.gov.au Mon Oct 22 03:02:05 2007 From: Andrew.MacIntyre at acma.gov.au (Andrew MacIntyre) Date: Mon, 22 Oct 2007 11:02:05 +1000 Subject: [python-win32] comtypes methods vs. properties question [SEC=UNCLASSIFIED] Message-ID: <7B01D7143C4AD54899EA079D4557562A5CDB06@ACT01EXC02.internal.govt> Nick Collier wrote: > Thanks very much for the reply -- that got me a good way there, but > now I have further questions. I'd suggest joining the ctypes & comtypes mailing lists - they're low volume & high SNR, and this subject is getting O/T for the Win32 list. I'll reply in detail separately without the cc to the Win32 list. -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre National Licensing and Allocations Branch tel: +61 2 6219 5356 Inputs to Industry Division fax: +61 2 6253 3277 Australian Communications & Media Authority email: andrew.macintyre at acma.gov.au From andy.atkinson at hydrix.com Mon Oct 22 05:54:22 2007 From: andy.atkinson at hydrix.com (Andy Atkinson) Date: Mon, 22 Oct 2007 13:54:22 +1000 Subject: [python-win32] Exception whilst using pySerial & Win32 Message-ID: <002c01c8145f$3e6d7ab0$e600a8c0@boomer> Hi All, I am running Python 2.5 on Windows and I have an issue/problem whilst accessing/using a serial port. I have a piece of test equipment that needs a control line to enable/disable its power. So I have connected the DTR of a serial port to my equipment and I can happily control power by opening the serial port and then enabling/disabling the DTR line (using pySerial). However, occasionally I get an exception raised (win32file.EscapeCommFunction (self.hCommPort, win32file.SETDTR), pywintypes.error : (5, 'EscapeCommFunction', 'Access is Denied') ) From what I can gather, this exception is raised when the resource in question (in this case my serial port) if already in use by another entity. Now that's fine, but no other process / application on the machine is (to the best of my knowledge) accessing this serial port. My application is single threaded. The frequency with which this issue occurs also leaves me little in the way of clues - I can run the SW for 3 days or so until it happens or it will run for only about 12-hours before I run into trouble. Can anyone offer any insights into this either in terms of telling me why this may be happening or suggest how I may gather some info from the system as to who or what currently has the serial port 'locked'. As the serial port is giving me 'access denied' I am also a little unsure of what is a sensible course of action. If the port is not under my control, then I may not be able to close it. If I can't close it then I may be in a spot of bother regarding a path for recovery from this situation. Any help appreciated. Regards Andy Atkinson -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071022/037a2d78/attachment.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: Andy Atkinson.vcf Type: text/x-vcard Size: 487 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20071022/037a2d78/attachment.vcf From howard at eegsoftware.com Mon Oct 22 07:10:45 2007 From: howard at eegsoftware.com (howard at eegsoftware.com) Date: Sun, 21 Oct 2007 22:10:45 -0700 Subject: [python-win32] Exception whilst using pySerial & Win32 In-Reply-To: <002c01c8145f$3e6d7ab0$e600a8c0@boomer> References: <002c01c8145f$3e6d7ab0$e600a8c0@boomer> Message-ID: <471BCE65.25351.F8E59CF@howard.eegsoftware.com> > occasionally I get an exception raised (win32file.EscapeCommFunction (self.hCommPort, > win32file.SETDTR), pywintypes.error : (5, 'EscapeCommFunction', 'Access is Denied') ) From > what I can gather, this exception is raised when the resource in question (in this case my serial > port) if already in use by another entity. Now that's fine, but no other process / application on the > machine is (to the best of my knowledge) accessing this serial port. My application is single > threaded. I have had weird things happen if "somehow" Windows decides to turn on DTR handshaking when I am using a serial port (again with nobody else using the port). Try reading the status of DTR handshaking when you get the error and see if something toggled it on. I know you get some kind of error (but memory escapes me ...) setting/clearing DTR if handshaking is on. From rwupole at msn.com Mon Oct 22 22:21:18 2007 From: rwupole at msn.com (Roger Upole) Date: Mon, 22 Oct 2007 16:21:18 -0400 Subject: [python-win32] Server Busy messages Message-ID: Oliver T. Nelson wrote: > I'm using MapPoint 2006 successfully, but I'm stuck on a problem that I > can't find settings for. > > MapPoint sometimes runs long processes that can cause a server busy > message to come up. In VB there are some settings you can adjust to > deal with this (see > http://www.codeguru.com/forum/showthread.php?t=328534). But I don't see > how I would accomplish this. There is another article in MSDN on this > issue (it is not MapPoint specific, but MPs processing needs really can > make it an issue) that says how to deal with this is C++ .NET > (http://support.microsoft.com/kb/248019). > > Does anyone have a way of dealing with this? > > Thanx, > > OLIVER I haven't used Mappoint, but in most Office apps (Excel, Word, etc) you can use DisplayAlerts=False to disable the OLE timeout message. Does the Mappoint.Application object expose this property ? Roger From gal.aviel at intel.com Tue Oct 23 09:49:08 2007 From: gal.aviel at intel.com (=?utf-8?b?QXZpZWws?= Gal) Date: Tue, 23 Oct 2007 07:49:08 +0000 (UTC) Subject: [python-win32] Python COM Server, C++ Client - How ??? (multiple arguments) References: Message-ID: For posterity ... I posted a recepie a while ago on how to write a simple C++ client for a Python com server. FYI to handle a COM method that has more than 1 argument, for some reason you have to reverse the order of arguments. For example, if the method is defined def my_method(self, a,b,c,d): ... Then your C++ client should look like : vargs[0]=arg4; vargs[1]=arg3; vargs[2]=arg2; vargs[3]=arg1; dp.rgvarg=vargs; dp.cArgs = 4; //how many args Where 'arg4' is the *last* argument ('d') (place it at array index 0 rather than 3). Don't know why. Hope this helps future googlers.. thanks - Gal. From mhammond at skippinet.com.au Tue Oct 23 12:16:22 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 23 Oct 2007 20:16:22 +1000 Subject: [python-win32] Python COM Server, C++ Client - How ??? (multiple arguments) In-Reply-To: References: Message-ID: <036c01c8155d$d319bbc0$794d3340$@com.au> > For posterity ... > > I posted a recepie a while ago on how to write a simple C++ > client for a Python com server. > > FYI to handle a COM method that has more than 1 argument, for some > reason you > have to reverse the order of arguments. > > For example, if the method is defined > > def my_method(self, a,b,c,d): > ... > > Then your C++ client should look like : > > vargs[0]=arg4; > vargs[1]=arg3; > vargs[2]=arg2; > vargs[3]=arg1; > > dp.rgvarg=vargs; > dp.cArgs = 4; //how many args > > Where 'arg4' is the *last* argument ('d') (place it at array index 0 > rather > than 3). > > Don't know why. This is how IDispatch is documented to behave - eg, see http://msdn2.microsoft.com/en-us/library/ms221653.aspx - "The arguments in the array should be placed from last to first, so rgvarg[0] has the last argument and rgvarg[cArgs -1] has the first argument." On a somewhat related note, pywin32 recently had a bug where 'named params' would be reversed when passed to python code, and while this fix will appear in build 211, it doesn't relate directly to your observation. Cheers, Mark From singhai.nish at gmail.com Wed Oct 24 11:44:19 2007 From: singhai.nish at gmail.com (kNish) Date: Wed, 24 Oct 2007 15:14:19 +0530 Subject: [python-win32] Mysqldb Message-ID: <81bfef2e0710240244u2ccda158p6170057ac4fea608@mail.gmail.com> Hi, Command in use : conn = MySQLdb.connect(host = "localhost",port = 3306, user = "root",passwd = "",db = "dailies",cursorclass=MySQLdb.cursors.DictCursor) Error : OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)") Is it possible to have MySQLdb.connect run successfully from one machine to the server machine. This command run well from the server machine itself. Background premise : wamp5 on windowsxp. Is their a workaround for this. BRgds, kNish -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071024/65b58d33/attachment.htm From simon.dahlbacka at gmail.com Wed Oct 24 12:45:32 2007 From: simon.dahlbacka at gmail.com (Simon Dahlbacka) Date: Wed, 24 Oct 2007 13:45:32 +0300 Subject: [python-win32] Mysqldb In-Reply-To: <81bfef2e0710240244u2ccda158p6170057ac4fea608@mail.gmail.com> References: <81bfef2e0710240244u2ccda158p6170057ac4fea608@mail.gmail.com> Message-ID: <57124720710240345x412517d3r2b0d8a325e925f2c@mail.gmail.com> the obvious? answer here is at least not with 'localhost' as hostname On 10/24/07, kNish wrote: > > Hi, > > Command in use : > > conn = MySQLdb.connect(host = "localhost",port = 3306, user = > "root",passwd = "",db = "dailies",cursorclass=MySQLdb.cursors.DictCursor) > > Error : > > OperationalError: (2003, "Can't connect to MySQL server on 'localhost' > (10061)") > > > Is it possible to have MySQLdb.connect run successfully from one > machine to the server machine. > > This command run well from the server machine itself. > > Background premise : wamp5 on windowsxp. > > Is their a workaround for this. > > BRgds, > > > kNish > > _______________________________________________ > 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/20071024/7ca06cfd/attachment.htm From singhai.nish at gmail.com Wed Oct 24 13:34:23 2007 From: singhai.nish at gmail.com (kNish) Date: Wed, 24 Oct 2007 17:04:23 +0530 Subject: [python-win32] Mysqldb In-Reply-To: <81bfef2e0710240244u2ccda158p6170057ac4fea608@mail.gmail.com> References: <81bfef2e0710240244u2ccda158p6170057ac4fea608@mail.gmail.com> Message-ID: <81bfef2e0710240434l551a57a3u422c284f03ee977c@mail.gmail.com> Hi, I must admit I know more of python than SQL. When you say not with localhost as hostname. You are saying that given a computer A which is acting as a server, has a user name created as root and passwd "", When another computer B on the same network, domain (without a firewall) tries to connect to Computer A using the command conn = MySQLdb.connect(host = "localhost",port = 3306, user = "root",passwd = "",db = "dailies",cursorclass=MySQLdb.cursors.DictCursor) How else will it communicate to access the records on computer A from B. BRgds, kNish On 10/24/07, kNish wrote: > > Hi, > > Command in use : > > conn = MySQLdb.connect(host = "localhost",port = 3306, user = > "root",passwd = "",db = "dailies",cursorclass=MySQLdb.cursors.DictCursor) > > Error : > > OperationalError: (2003, "Can't connect to MySQL server on 'localhost' > (10061)") > > > Is it possible to have MySQLdb.connect run successfully from one > machine to the server machine. > > This command run well from the server machine itself. > > Background premise : wamp5 on windowsxp. > > Is their a workaround for this. > > BRgds, > > > kNish > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071024/fe221895/attachment.htm From singhai.nish at gmail.com Wed Oct 24 13:43:43 2007 From: singhai.nish at gmail.com (kNish) Date: Wed, 24 Oct 2007 17:13:43 +0530 Subject: [python-win32] Mysqldb In-Reply-To: <81bfef2e0710240244u2ccda158p6170057ac4fea608@mail.gmail.com> References: <81bfef2e0710240244u2ccda158p6170057ac4fea608@mail.gmail.com> Message-ID: <81bfef2e0710240443x234e452atc4fc5a760f7ea636@mail.gmail.com> Hi, Does anybody think it may be an issue with odbc and wamp5. BRgds, kNish On 10/24/07, kNish wrote: > > Hi, > > Command in use : > > conn = MySQLdb.connect(host = "localhost",port = 3306, user = > "root",passwd = "",db = "dailies",cursorclass=MySQLdb.cursors.DictCursor) > > Error : > > OperationalError: (2003, "Can't connect to MySQL server on 'localhost' > (10061)") > > > Is it possible to have MySQLdb.connect run successfully from one > machine to the server machine. > > This command run well from the server machine itself. > > Background premise : wamp5 on windowsxp. > > Is their a workaround for this. > > BRgds, > > > kNish > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071024/6a4d8ca8/attachment.htm From simon.dahlbacka at gmail.com Wed Oct 24 14:03:36 2007 From: simon.dahlbacka at gmail.com (Simon Dahlbacka) Date: Wed, 24 Oct 2007 15:03:36 +0300 Subject: [python-win32] Mysqldb In-Reply-To: <81bfef2e0710240434l551a57a3u422c284f03ee977c@mail.gmail.com> References: <81bfef2e0710240244u2ccda158p6170057ac4fea608@mail.gmail.com> <81bfef2e0710240434l551a57a3u422c284f03ee977c@mail.gmail.com> Message-ID: <57124720710240503i318f071atcda8b4ee3ad86a47@mail.gmail.com> What I was trying to say has actually nothing to do with python nor sql but networking in general. The host name 'localhost' (and IP address 127.0.0.1 for that matter) always refers to the current machine, and if the server is running on computer a and the client on computer b the client will always fail if you use localhost as the host to connect to (unless computer a == computer b or computer b has a mysql server running with the same credentials and database) So to have a chance of success you need to find the hostname or ip address of computer a and replace use that info instead when connecting from the client on computer b. hope this helps Simon On 10/24/07, kNish wrote: > > Hi, > I must admit I know more of python than SQL. When you say not > with localhost as hostname. You are saying that given a computer A which is > acting as a server, has a user name created as root and passwd "", When > another computer B on the same network, domain (without a firewall) tries to > connect to Computer A using the command > > conn = MySQLdb.connect(host = "localhost",port = 3306, user = > "root",passwd = "",db = "dailies",cursorclass=MySQLdb.cursors.DictCursor) > > How else will it communicate to access the records on computer A from B. > > BRgds, > > kNish > > > > > > On 10/24/07, kNish wrote: > > > > Hi, > > > > Command in use : > > > > conn = MySQLdb.connect(host = "localhost",port = 3306, user = > > "root",passwd = "",db = "dailies",cursorclass=MySQLdb.cursors.DictCursor > > ) > > > > Error : > > > > OperationalError: (2003, "Can't connect to MySQL server on 'localhost' > > (10061)") > > > > > > Is it possible to have MySQLdb.connect run successfully from > > one machine to the server machine. > > > > This command run well from the server machine itself. > > > > Background premise : wamp5 on windowsxp. > > > > Is their a workaround for this. > > > > BRgds, > > > > > > kNish > > > > > _______________________________________________ > 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/20071024/8c21e645/attachment.htm From timr at probo.com Wed Oct 24 20:03:31 2007 From: timr at probo.com (Tim Roberts) Date: Wed, 24 Oct 2007 11:03:31 -0700 Subject: [python-win32] Mysqldb In-Reply-To: <81bfef2e0710240434l551a57a3u422c284f03ee977c@mail.gmail.com> References: <81bfef2e0710240244u2ccda158p6170057ac4fea608@mail.gmail.com> <81bfef2e0710240434l551a57a3u422c284f03ee977c@mail.gmail.com> Message-ID: <471F88F3.5000107@probo.com> kNish wrote: > > I must admit I know more of python than SQL. When you say > not with localhost as hostname. You are saying that given a computer A > which is acting as a server, has a user name created as root and > passwd "", When another computer B on the same network, > domain (without a firewall) tries to connect to Computer A using the > command > > conn = MySQLdb.connect(host = "localhost",port = 3306, user = > "root",passwd = "",db = "dailies",cursorclass=MySQLdb.cursors.DictCursor) > > How else will it communicate to access the records on computer A from B. "localhost" is a shortcut that always refers to the current computer. If you are on computer B, then "localhost" means computer B. If you want to talk to computer A, you have to specify the name of computer A. This is exactly like trying to contact a web server. If you want to talk to the web server on the computer where you are sitting, you say "http://localhost". But if you want to contact Google, it is clear that you can't type "http://localhost". It's the same thing here. You have to tell MySQLdb the real name of the machine that is running the database server. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From singhai.nish at gmail.com Thu Oct 25 15:18:17 2007 From: singhai.nish at gmail.com (kNish) Date: Thu, 25 Oct 2007 18:48:17 +0530 Subject: [python-win32] mysqldb python Message-ID: <81bfef2e0710250618u4c7a7a48q3ebfb17f1fa348d3@mail.gmail.com> Hi, After trouble shooting error 10061, 1130, 1045 and 1044. Finally, the following code works in a python shell. import MySQLdb import MySQLdb.cursors conn = MySQLdb.connect(host="ENG-3", user = "Any", passwd = "", db = "daily", cursorclass=MySQLdb.cursors.DictCursor) user='root' also works. I now have a small cgi script, the values from the user are taken and inserted in the database. When this script is called with a click of a button, the throws the error page, saying " Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin at renderunit-19 and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. " Is it possible to have the connect work thru a script just as it works thru a python shell. BRgds, kNish -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071025/52cec963/attachment.htm From simon.dahlbacka at gmail.com Thu Oct 25 15:26:44 2007 From: simon.dahlbacka at gmail.com (Simon Dahlbacka) Date: Thu, 25 Oct 2007 16:26:44 +0300 Subject: [python-win32] mysqldb python In-Reply-To: <81bfef2e0710250618u4c7a7a48q3ebfb17f1fa348d3@mail.gmail.com> References: <81bfef2e0710250618u4c7a7a48q3ebfb17f1fa348d3@mail.gmail.com> Message-ID: <57124720710250626r583d933cy1144599fd70dc77c@mail.gmail.com> Yes it should work from a script just as well from the shell, but with this info we cannot say whats wrong .. If you follow the suggestion: what does the server error log say? One possible cause for such an error is that you haven't sent the http headers correctly On 10/25/07, kNish wrote: > > Hi, > > After trouble shooting error 10061, 1130, 1045 and 1044. > Finally, the following code works in a python shell. > > import MySQLdb > import MySQLdb.cursors > conn = MySQLdb.connect(host="ENG-3", user = "Any", passwd = "", db = > "daily", cursorclass=MySQLdb.cursors.DictCursor) > > user='root' also works. I now have a small cgi script, the values from the > user are taken and inserted in the database. When this script is called with > a click of a button, the throws the error page, saying > > " > Internal Server Error > The server encountered an internal error or misconfiguration and was > unable to complete your request. > > Please contact the server administrator, admin at renderunit-19 and inform > them of the time the error occurred, and anything you might have done that > may have caused the error. > > More information about this error may be available in the server error > log. > > " > > Is it possible to have the connect work thru a script just as it works > thru a python shell. > > > BRgds, > > kNish > > _______________________________________________ > 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/20071025/356e6391/attachment.htm From singhai.nish at gmail.com Thu Oct 25 15:18:17 2007 From: singhai.nish at gmail.com (kNish) Date: Thu, 25 Oct 2007 18:48:17 +0530 Subject: [python-win32] mysqldb python Message-ID: <81bfef2e0710250618u4c7a7a48q3ebfb17f1fa348d3@mail.gmail.com> Hi, After trouble shooting error 10061, 1130, 1045 and 1044. Finally, the following code works in a python shell. import MySQLdb import MySQLdb.cursors conn = MySQLdb.connect(host="ENG-3", user = "Any", passwd = "", db = "daily", cursorclass=MySQLdb.cursors.DictCursor) user='root' also works. I now have a small cgi script, the values from the user are taken and inserted in the database. When this script is called with a click of a button, the throws the error page, saying " Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin at renderunit-19 and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. " Is it possible to have the connect work thru a script just as it works thru a python shell. BRgds, kNish -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20071025/52cec963/attachment-0001.htm From timr at probo.com Thu Oct 25 20:32:41 2007 From: timr at probo.com (Tim Roberts) Date: Thu, 25 Oct 2007 11:32:41 -0700 Subject: [python-win32] mysqldb python In-Reply-To: <81bfef2e0710250618u4c7a7a48q3ebfb17f1fa348d3@mail.gmail.com> References: <81bfef2e0710250618u4c7a7a48q3ebfb17f1fa348d3@mail.gmail.com> Message-ID: <4720E149.8090704@probo.com> kNish wrote: > > Hi, > > After trouble shooting error 10061, 1130, 1045 and 1044. > Finally, the following code works in a python shell. > > import MySQLdb > import MySQLdb.cursors > conn = MySQLdb.connect(host="ENG-3", user = "Any", passwd = "", db = > "daily", cursorclass=MySQLdb.cursors.DictCursor) > > user='root' also works. I now have a small cgi script, the values from > the user are taken and inserted in the database. When this script is > called with a click of a button, the throws the error page, saying > > " > Internal Server Error > The server encountered an internal error or misconfiguration and was > unable to complete your request. > > Please contact the server administrator, admin at renderunit-19 > and inform them of the time the error > occurred, and anything you might have done that may have caused the error. > > More information about this error may be available in the server error > log. > > " > The last line of the error page is the key. If you look in the Apache error log on your server, you will see the Python traceback of the error. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From paul.rudin at ntlworld.com Wed Oct 31 05:50:16 2007 From: paul.rudin at ntlworld.com (Paul Rudin) Date: Wed, 31 Oct 2007 04:50:16 +0000 Subject: [python-win32] pythonservice.exe and sys.exitfunc Message-ID: <87wst3dh13.fsf@rudin.co.uk> It seems that when using pythonservice.exe sys.exitfunc does not run. Can anyone confirm this? This is particularly a problem if you have any code that uses atexit. From mhammond at skippinet.com.au Wed Oct 31 07:08:43 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 31 Oct 2007 17:08:43 +1100 Subject: [python-win32] pythonservice.exe and sys.exitfunc In-Reply-To: <87wst3dh13.fsf@rudin.co.uk> References: <87wst3dh13.fsf@rudin.co.uk> Message-ID: <07de01c81b84$817f3650$847da2f0$@com.au> That's correct - see http://sourceforge.net/tracker/index.php?func=detail&aid=1273738&group_id=78 018&atid=551954 Mark > -----Original Message----- > From: python-win32-bounces at python.org [mailto:python-win32- > bounces at python.org] On Behalf Of Paul Rudin > Sent: Wednesday, 31 October 2007 3:50 PM > To: python-win32 at python.org > Subject: [python-win32] pythonservice.exe and sys.exitfunc > > > It seems that when using pythonservice.exe sys.exitfunc does not > run. Can anyone confirm this? This is particularly a problem if you > have any code that uses atexit. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32