From sjb@lucent.com Wed Apr 4 15:52:54 2001 From: sjb@lucent.com (Steve Buroff) Date: Wed, 4 Apr 2001 10:52:54 -0400 Subject: [python-win32] win32 extensions and python 2.1 Message-ID: <01fe01c0bd16$edfd1410$6484968d@ldv.lucent.com> This is a multi-part message in MIME format. ------=_NextPart_000_01FF_01C0BCF5.66EB7410 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Is there a version of the win32 extensions that will work with python 2.1B2? I tried installing 138 and it failed (said I didn't have 2.0 installed). Will there be a new win32 package to go with the released version of 2.1? Thanks. Steve Buroff ------=_NextPart_000_01FF_01C0BCF5.66EB7410 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Is = there a version=20 of the win32 extensions that will work with
python = 2.1B2? I=20 tried installing 138 and it failed (said I didn't = have
2.0 = installed). Will=20 there be a new win32 package to go with the
released version of=20 2.1? Thanks.
 
Steve=20 Buroff
------=_NextPart_000_01FF_01C0BCF5.66EB7410-- From M.Strasser@myrealbox.com Thu Apr 5 03:21:24 2001 From: M.Strasser@myrealbox.com (Michael Strasser) Date: Thu, 05 Apr 2001 12:21:24 +1000 Subject: [python-win32] Change TCP/IP config in Win2K? Message-ID: <3ACBD6A4.B33DE1D9@myrealbox.com> I want to be able to change the TCP/IP configuration of my Windows 2000 laptop. I use it in a couple of different networks without DHCP. Currently I have Python scripts that change the relevant registry entries. I then have to disable the network connection and enable it again so the registry is read. (If I manually change settings the effect is immediate when I click "OK".) I can't find API calls to set new values or force the registry to be re-read. Are these public APIs? Are they available from Python? Thanks in advance for any help. -- Michael Strasser Brisbane, Australia From itamarst@yahoo.com Thu Apr 5 10:44:19 2001 From: itamarst@yahoo.com (Itamar S.-T.) Date: Thu, 5 Apr 2001 02:44:19 -0700 (PDT) Subject: [python-win32] Checking if connected to Internet Message-ID: <20010405094419.41292.qmail@web13004.mail.yahoo.com> Certain programs (e.g. AIM or ICQ) only start up when Windows connects to the Internet. How could I do this in Python? Trying to connect to the remote server and seeing if this fails is no good, since a "Connect to the Inteernet" dialog pops-up automatically. Another thing I can do is use the win32ras functions, and every few seconds check if the number of connections has increased. Presumably a new one means the user has conneted to the internet, but it can also in theory be something else. Any other suggestions? ===== Itamar Shtull-Trauring, itamar(at)shtull-trauring.org __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ From sjb@lucent.com Thu Apr 5 13:51:54 2001 From: sjb@lucent.com (Steve Buroff) Date: Thu, 5 Apr 2001 08:51:54 -0400 Subject: [python-win32] question on odbc package Message-ID: <027a01c0bdcf$313746c0$6484968d@ldv.lucent.com> This is a multi-part message in MIME format. ------=_NextPart_000_027B_01C0BDAD.AA25A6C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Can anyone tell me how to get the type objects for use with the odbc package? The online documentation for this package is essentially useless. I'm looking the Hammond & Robinson book "Python Programming on Win32". Appendix C talks about the odbc package. They show some type classes like "Date, Binary, ...". However, I can't find these classes. I can't import them. Anyone know how to get them? Thanks. Steve Buroff ------=_NextPart_000_027B_01C0BDAD.AA25A6C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Can = anyone tell me=20 how to get the type objects for use with the
odbc = package? The=20 online documentation for this package is
essentially useless.=20 I'm looking the Hammond & Robinson book
"Python Programming=20 on Win32". Appendix C talks about the odbc
package.
 
They = show some type=20 classes like "Date, Binary, ...". However,
I = can't find these=20 classes. I can't import them. Anyone know
how to = get them?=20 Thanks.
 
Steve=20 Buroff
------=_NextPart_000_027B_01C0BDAD.AA25A6C0-- From john_hopkins@bigfoot.com Thu Apr 5 15:49:15 2001 From: john_hopkins@bigfoot.com (John Hopkins) Date: Thu, 5 Apr 2001 07:49:15 -0700 Subject: [python-win32] Making a "Windows-like" app with wxPython Message-ID: <002f01c0bddf$96b9f5a0$01000059@hopkinsit.com> This is a multi-part message in MIME format. ------=_NextPart_000_002C_01C0BDA4.E9A402A0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Newbie question: I've built a number of applications on MS-Access (2.0 through 2000), and = little things like tabbing through controls and trapping events when = entering and exiting a control are trivial. I've burrowed through the = documentation on wxPython, and can't quite figure out how to reproduce = this behavior as I port my most recent app to Python/MySQL/wxPython. Can anyone send me or point me at sample code which shows how to manage = these "simple" tasks? Thanks in advance, John Hopkins john_hopkins@bigfoot.com ------=_NextPart_000_002C_01C0BDA4.E9A402A0 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
Newbie question:
 
I've built a number of applications on MS-Access = (2.0 through=20 2000), and little things like tabbing through controls and trapping = events when=20 entering and exiting a control are trivial.  I've burrowed = through the=20 documentation on wxPython, and can't quite figure out how to reproduce = this=20 behavior as I port my most recent app to = Python/MySQL/wxPython.
 
Can anyone send me or point me at sample code which = shows how=20 to manage these "simple" tasks?
 
Thanks in advance,
 
John Hopkins
john_hopkins@bigfoot.com
------=_NextPart_000_002C_01C0BDA4.E9A402A0-- From itamarst@yahoo.com Thu Apr 5 16:38:17 2001 From: itamarst@yahoo.com (Itamar S.-T.) Date: Thu, 5 Apr 2001 08:38:17 -0700 (PDT) Subject: [python-win32] Taskbar demo in win32all is broken? Message-ID: <20010405153817.49793.qmail@web13008.mail.yahoo.com> I've been playing around with the win32gui_taskbar.py demo, of embedding an icon in the windows taskbar. It runs ok, but if I move my mouse over the icon, the program crashes. This is win32all 135 on BeOpen Python 2.0. If I change the WM_ event that the icon calls from WM_USER+20 to something else in one of the locations this value is stops crashing, but I think that's only because the events don't get passed, cause if I change everything to WM_MOUSEMOVE (as in the MSDN examples) it also crashes. ===== Itamar Shtull-Trauring, itamar(at)shtull-trauring.org __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ From Dan.Rolander@marriott.com Thu Apr 5 16:40:26 2001 From: Dan.Rolander@marriott.com (Rolander, Dan) Date: Thu, 5 Apr 2001 11:40:26 -0400 Subject: [python-win32] Making a "Windows-like" app with wxPython Message-ID: <6176E3D8E36FD111B58900805FA7E0F80CCF64F4@mcnc-mdm1-ex01> You'll probably get a better response by posting your question to the wxpython list: wxpython-users mailing list wxpython-users@lists.wxwindows.org http://lists.wxwindows.org/mailman/listinfo/wxpython-users -----Original Message----- From: John Hopkins To: python-win32@python.org Sent: 4/5/01 10:49 AM Subject: [python-win32] Making a "Windows-like" app with wxPython Newbie question: I've built a number of applications on MS-Access (2.0 through 2000), and little things like tabbing through controls and trapping events when entering and exiting a control are trivial. I've burrowed through the documentation on wxPython, and can't quite figure out how to reproduce this behavior as I port my most recent app to Python/MySQL/wxPython. Can anyone send me or point me at sample code which shows how to manage these "simple" tasks? Thanks in advance, John Hopkins john_hopkins@bigfoot.com From caz@tcdi.com Thu Apr 5 17:22:49 2001 From: caz@tcdi.com (Corey Zimmet) Date: Thu, 05 Apr 2001 12:22:49 -0400 Subject: [python-win32] How do I read a raw floppy device on win98? Message-ID: <3ACC9BD9.758225E7@tcdi.com> I am try to use win32file to access the raw floppy disk on win98. On WINNT I create a handle like this: BUFFSIZE=512 INITIAL_OFFSET=0 floppydisk=win32file.CreateFile("\\\\.\\A:", win32file.GENERIC_READ, win32file.FILE_SHARE_READ|win32file.FILE_SHARE_WRITE, None, win32file.OPEN_EXISTING, win32file.FILE_ATTRIBUTE_READONLY, None) win32file.SetFilePointer(floppydisk,INITIAL_OFFSET,win32file.FILE_BEGIN) rc,data=win32file.ReadFile(floppydisk,BUFFSIZE) However, on win98, I believe I have to use a different methodology using DeviceIOControl. I have yet to succeed. Does anyone know how to access the floppy device on win98? Thanks, Corey From robin@alldunn.com Thu Apr 5 17:39:58 2001 From: robin@alldunn.com (Robin Dunn) Date: Thu, 5 Apr 2001 09:39:58 -0700 Subject: [python-win32] Making a "Windows-like" app with wxPython References: <6176E3D8E36FD111B58900805FA7E0F80CCF64F4@mcnc-mdm1-ex01> Message-ID: <075401c0bdef$0f62a3d0$0100a8c0@Rogue> > > Newbie question: > > I've built a number of applications on MS-Access (2.0 through 2000), and > little things like tabbing through controls Put the controls on a wxPanel. Tab-traversal is implemented there. > and trapping events when > entering and exiting a control are trivial. Create event handlers for EVT_SET_FOCUS and EVT_KILL_FOCUS. -- Robin Dunn Software Craftsman robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython! From Peteris_Martinsons@swh-t.lv Thu Apr 5 17:45:40 2001 From: Peteris_Martinsons@swh-t.lv (Peteris_Martinsons@swh-t.lv) Date: Thu, 5 Apr 2001 08:45:40 -0800 Subject: [python-win32] Taskbar demo in win32all is broken? Message-ID: I observe the same. So this is the reason why I am trying to build a simple window from scratch. Not too successful so far. The main problem is message loop and exiting from it; when the main window is closed, it disappears, but the interpreter stays in memory, and either does not respond at all or has to be closed explicitly. May be somewhere in the net there is an example how to implement a simple window correctly? I have searched a lot, but found nothing. Peteris From sjb@lucent.com Fri Apr 6 11:44:57 2001 From: sjb@lucent.com (Steve Buroff) Date: Fri, 6 Apr 2001 06:44:57 -0400 Subject: [python-win32] pythonwin file open dialog Message-ID: <002f01c0be86$9f51d7d0$3982968d@ldv.lucent.com> This is a multi-part message in MIME format. ------=_NextPart_000_0030_01C0BE65.184037D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I'm using pythonwin and I find it a pretty great tool. There is one thing I find annoying though so I thought I'd suggest it as a possible enhancement if development is continuing on it. The file open dialog in pythonwin only allows me to open one file at a time. Most file open dialogs on Windows allows one to select multiple files using either shift or cntrl. Could the pythonwin dialog be enhanced to do this? Another, much less important request would be to indicate in some way that a file open in an edit window has been modified and not saved. Other IDE's I've used put an asterisk in the title bar when you modify the file and remove it when you do a save. Steve Buroff ------=_NextPart_000_0030_01C0BE65.184037D0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I'm = using pythonwin=20 and I find it a pretty great tool. There is one
thing = I find=20 annoying though so I thought I'd suggest it as a = possible
enhancement if=20 development is continuing on it.
 
The = file open dialog=20 in pythonwin only allows me to open one file
at a = time. Most file=20 open dialogs on Windows allows one to
select = multiple=20 files using either shift or cntrl. Could the = pythonwin
dialog = be enhanced=20 to do this?
 
Another, much less=20 important request would be to indicate in
some = way that a file=20 open in an edit window has been modified
and = not saved. Other=20 IDE's I've used put an asterisk in the title
bar = when you modify=20 the file and remove it when you do a save.
 
Steve=20 Buroff
------=_NextPart_000_0030_01C0BE65.184037D0-- From SWidney@ci.las-vegas.nv.us Fri Apr 6 16:47:28 2001 From: SWidney@ci.las-vegas.nv.us (Scott Widney) Date: Fri, 6 Apr 2001 08:47:28 -0700 Subject: [python-win32] NetMessageName* implementations Message-ID: It looks like neither 'NetMessageNameEnum()' nor 'NetMessageNameGetInfo()' were implemented in the win32net module. Any suggestions on how I can access these functions? From itamarst@yahoo.com Mon Apr 9 09:10:44 2001 From: itamarst@yahoo.com (Itamar S.-T.) Date: Mon, 9 Apr 2001 01:10:44 -0700 (PDT) Subject: Fwd: RE: [python-win32] Taskbar demo in win32all is broken? Message-ID: <20010409081044.3087.qmail@web13006.mail.yahoo.com> This didn't get to the list, so I'm forwarding it. Should the list have a Reply-To: header so that replies reach the list by default? --- Mark Hammond wrote: > From: "Mark Hammond" > To: "Itamar S.-T." > Subject: RE: [python-win32] Taskbar demo in win32all > is broken? > Date: Fri, 6 Apr 2001 11:07:57 +1000 > > This can be fixed with the following patch. It will > be in future builds, or > I could mail anyone a .pyd for use against > win32all-139. > > At least I knew I was being naughty :) > > Mark. > > > Index: win32gui.i > =================================================================== > RCS file: > /home/cvsroot/PyWin32/win32/src/win32gui.i,v > retrieving revision 1.14 > diff -r1.14 win32gui.i > 222,227c222,224 > < // XXX - this is very very naughty. > < // for speed's sake, we support a map, so > < // that we only call into Python for messages we > < // process. BUT - we use the Python dictionary > < // without the thread-lock! Acquiring the > thread lock > < // is quite expensive, so I want to avoid that > too. > --- > > // Acquiring the thread lock is quite expensive > > // It would be nice to avoid! > > CEnterLeavePython _celp; > ===== Itamar Shtull-Trauring, itamar(at)shtull-trauring.org __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ From christoforou@gaaros.com Tue Apr 10 01:25:23 2001 From: christoforou@gaaros.com (christoforou@gaaros.com) Date: Tue, 10 Apr 2001 00:25:23 GMT Subject: [python-win32] Any problems with Win ME?? Message-ID: <20010410002523.9826.qmail@mail.yifansoft.com> Hello Everyone, We have been using python2.0 with the win32 extensions (built 138) on win2000 and win98 without any problems. Recently we have shipped the app to a client that runs win ME and there seems to be problems with the COM layer. Unfortunately we do not have detailed info so I am just wondering if anybody has experienced problems with it. Basically accessing pythonCOM servers from python seems to be working fine but trying the same server from VB gives an error when an attempt is made to create a reference to the COM server. I am not giving much info, just wondering if anyone had problems with ME. Pavlos From adolfo.benin@riskmap.it Tue Apr 10 15:11:50 2001 From: adolfo.benin@riskmap.it (Adolfo Benin) Date: Tue, 10 Apr 2001 16:11:50 +0200 Subject: [python-win32] DCOM activation Message-ID: <5.0.2.1.0.20010410154504.00aa4c70@mail1.cs.interbusiness.it> Hi all, I have created a COM object using python and I use it as a DCOM on a server machine. This DCOM dynamically creates python objects, wraps them using the win32com.server.util.wrap utility and tries to return these objects to a remote client (a VB application). The client is unable to create the objects remotely, and raises an error message. All the objects, except for the main DCOM object, are not registered on the client side. The whole system works if both client and server run on the same machine. Could anybody helps me to solve this problem? Thanks a lot, Adolfo. o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o Adolfo Benin Managing Partner RiskMap s.r.l. - Risk Management Solutions via G.B. Vico, 4 20123 Milano - Italy phone: +39 02 43317504 fax: +39 02 43911424 e-mail: adolfo.benin@riskmap.it web site: www.riskmap.net o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o From niki@vintech.bg Tue Apr 10 18:17:18 2001 From: niki@vintech.bg (Niki Spahiev) Date: Tue, 10 Apr 2001 20:17:18 +0300 Subject: [python-win32] Build 203 BUG? Message-ID: <3AD3401E.B21FDA7@vintech.bg> I am working on NT4 SP6, ActiveState Build 203 I get 'access violation' when i type >>> import win32file >>> dir( win32file ) is this known BUG? regards, Niki Spahiev From aleksei.guzev@disainis.e-burg.ru Wed Apr 11 04:51:00 2001 From: aleksei.guzev@disainis.e-burg.ru (=?koi8-r?B?4czFy9PFyiDn1drF1w==?=) Date: Wed, 11 Apr 2001 09:51:00 +0600 Subject: [python-win32] unicode support? Message-ID: Tk does work well on my Win2k while using English. But it doesn't show labels and other controls containing Cyrillic. It shows labels, but those are not in Russian. Have I to rewrite and rebuild the Tk code by myself? From jesper.groth.loehr@almbrand.dk Wed Apr 11 10:36:12 2001 From: jesper.groth.loehr@almbrand.dk (jesper.groth.loehr@almbrand.dk) Date: Wed, 11 Apr 2001 10:36:12 +0100 Subject: Vedr: [python-win32] Build 203 BUG? Message-ID: <41256A2B.003475A8.00@ABRNOT0.ALMBRAND.DK> --0__=cnmda63OeeZ13WyB1EUlKp3DjdtCOKuKozIV1F7bbZyzM2msgQj5Facw Content-type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-transfer-encoding: quoted-printable Running Win2k SP1, ActivePython 203.4 and PythonWin generates an application error and a runtime error when I try to do it. Jesper Niki Spahiev - 10-04-2001 18:17:18 Til: python win32 cc: (bcc: Jesper Groth L=F8hr/ABR/ALMBRAND) Vedr=F8rende: [python-win32] Build 203 BUG? = --0__=cnmda63OeeZ13WyB1EUlKp3DjdtCOKuKozIV1F7bbZyzM2msgQj5Facw Content-type: text/plain; charset=us-ascii Content-Disposition: inline I am working on NT4 SP6, ActiveState Build 203 I get 'access violation' when i type >>> import win32file >>> dir( win32file ) is this known BUG? regards, Niki Spahiev _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 --0__=cnmda63OeeZ13WyB1EUlKp3DjdtCOKuKozIV1F7bbZyzM2msgQj5Facw-- From MarkH@ActiveState.com Wed Apr 11 14:10:17 2001 From: MarkH@ActiveState.com (Mark Hammond) Date: Wed, 11 Apr 2001 23:10:17 +1000 Subject: Vedr: [python-win32] Build 203 BUG? In-Reply-To: <41256A2B.003475A8.00@ABRNOT0.ALMBRAND.DK> Message-ID: This is a known problem - the version of scintilla used crashes on very long lines. Mark. > -----Original Message----- > From: python-win32-admin@python.org > [mailto:python-win32-admin@python.org]On Behalf Of > jesper.groth.loehr@almbrand.dk > Sent: Wednesday, 11 April 2001 7:36 PM > To: python-win32@python.org > Subject: Vedr: [python-win32] Build 203 BUG? > > > > Running Win2k SP1, ActivePython 203.4 and PythonWin generates an > application error and a runtime error when I try to do it. > > Jesper From syang@xplantechnology.com Thu Apr 12 03:51:07 2001 From: syang@xplantechnology.com (Scott Yang) Date: Thu, 12 Apr 2001 12:51:07 +1000 Subject: [python-win32] Python COM problem with IE Message-ID: <20010412125107.A27242@yoda.yang.wattle.id.au> Hi, I am trying to implement a GUI application using IE as an ActiveX control. I need to manipulate the content of the browser depending on the URL. I implemented a class that handles the events as DWebBrowserEvents2, and Python crashes everytime when I return "Cancel" to be true in BeforeNavigate2 (it is a ByRef value). I can re-produce that when I use IE as an ActiveX control or as an automation object. For example, the following code will crash python when you try to go to any link. We tried similar code on both Perl and Delphi, and both of them work fine. Any ideas? ----------------------------------------------------------- from win32com.client import DispatchWithEventsN=10import pythoncom class IEEvents: def OnBeforeNavigate2(self, disp, url, *args): return url !=3D u"about:blank" ie =3D DispatchWithEvents("InternetExplorer.Application", IEEvents)=20 ie.Visible =3D 1 ie.Navigate2("about:blank") pythoncom.PumpMessages() -- Scott Yang Xplan Technology Pty = Ltd Exchange Square, 10 Bridge Street, Sydney NSW 2000 P +61 2 8220 8116 F +61 2 8220 8117 From jens.jorgensen@tallan.com Thu Apr 12 18:12:25 2001 From: jens.jorgensen@tallan.com (Jorgensen, Jens) Date: Thu, 12 Apr 2001 12:12:25 -0500 Subject: [python-win32] Python COM problem with IE References: <20010412125107.A27242@yoda.yang.wattle.id.au> Message-ID: <3AD5E1F9.C48FFE3D@tallan.com> This is curious indeed. I tried doing a makepy.py on the type library and using that but going that route I couldn't even get it to call events period. I'm sure there must be a way and I thought this might be the better route but I just couldn't get any events to be called. I'm not sure if I'm doing this right, I just guessed after poring over the COM python modules. Here's what I tried (IE is the module I generated with makepy): from win32com.client import DispatchWithEvents import IE import pythoncom class IEEvents(IE.DWebBrowserEvents2): # def OnBeforeNavigate2(self, pDisp=pythoncom.Missing, URL=pythoncom.Missing, Flags=pythoncom.Missing, TargetFrameName=pythoncom.Missing, PostData=pythoncom.Missing, Headers=pythoncom.Missing, Cancel=pythoncom.Missing) : # def OnBeforeNavigate2(self, disp, url, *args): print repr(URL) if URL != "about:blank" : return 1 else : return 0 class MyIE(IE.InternetExplorer) : def __init__(self) : IE.InternetExplorer.__init__(self) print 'coclass_interfaces', repr(self.coclass_sources) coclass_sources = [IE.DWebBrowserEvents, IEEvents ] default_source = IEEvents ie = MyIE() #ie = DispatchWithEvents("InternetExplorer.Application", IEEvents) ie.Visible = 1 ie.Navigate2("about:blank") pythoncom.PumpMessages() Scott Yang wrote: > Hi, > > I am trying to implement a GUI application using IE as an > ActiveX control. I need to manipulate the content of the browser > depending on the URL. I implemented a class that handles the events > as DWebBrowserEvents2, and Python crashes everytime when I return > "Cancel" to be true in BeforeNavigate2 (it is a ByRef value). I can > re-produce that when I use IE as an ActiveX control or as an automation > object. > > For example, the following code will crash python when you try to go > to any link. We tried similar code on both Perl and Delphi, and both > of them work fine. > > Any ideas? > > ----------------------------------------------------------- > > from win32com.client import DispatchWithEventsNimport pythoncom > > class IEEvents: > def OnBeforeNavigate2(self, disp, url, *args): > return url != u"about:blank" > > ie = DispatchWithEvents("InternetExplorer.Application", IEEvents) > ie.Visible = 1 > ie.Navigate2("about:blank") > > pythoncom.PumpMessages() > > -- > Scott Yang Xplan Technology Pty Ltd > Exchange Square, 10 Bridge Street, Sydney NSW 2000 > P +61 2 8220 8116 F +61 2 8220 8117 > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 -- Jens B. Jorgensen jens.jorgensen@tallan.com From shae@webwitches.com Thu Apr 12 18:30:47 2001 From: shae@webwitches.com (Shae Erisson) Date: Thu, 12 Apr 2001 20:30:47 +0300 Subject: [python-win32] question on odbc package In-Reply-To: <027a01c0bdcf$313746c0$6484968d@ldv.lucent.com> References: <027a01c0bdcf$313746c0$6484968d@ldv.lucent.com> Message-ID: <20010412203047J.shae@webwitches.com> From: "Steve Buroff" Subject: [python-win32] question on odbc package Date: Thu, 5 Apr 2001 08:51:54 -0400 > Can anyone tell me how to get the type objects for use with > the > odbc package? The online documentation for this package is > essentially useless. I'm looking the Hammond & Robinson book > "Python Programming on Win32". Appendix C talks about the > odbc > package. > > They show some type classes like "Date, Binary, ...". > However, > I can't find these classes. I can't import them. Anyone know > how to get them? Thanks. I didn't see an answer to this, though I might have missed it. I agree that the online docs are useless. I think the types you're looking for are in the "dbi" package. I found dbi.dbiDate and a few others in that module. I'm currently fighting with odbc myself, I'm trying to figure out how to correctly escape random characters so I can put them into a large text field. Is there already a function that escapes characters somewhere? Is there a better way to do it? Specifically, I'd like to be able to: "INSERT INTO TABLE_NAME VALUES ('!@#%^&*()')" I'm also curious how to use the vars part of "cursor.execute(sql, vars=[])" That's all the documentation says, does anyone know how to use this? Is it just like parameters to stored procedures? Thanks, ---- Shae Matijs Erisson - http://www.webwitches.com/~shae/ From Chris.Ingram@Synchrologic.com Thu Apr 12 18:45:52 2001 From: Chris.Ingram@Synchrologic.com (Chris Ingram) Date: Thu, 12 Apr 2001 13:45:52 -0400 Subject: [python-win32] question on odbc package Message-ID: The easiest way to send that type of data to the database through ODBC would be to pass the data as bound parameters to the execute call. If you had some Python string variable containing the data (in your case, the '!@#%^&*()'), then you'd replace where that value would be in the SQL statement with a question mark and then refer to the data in the second optional list parameter. For example: theData = '!@#%^&*()' crsr.execute ("INSERT INTO TABLE_NAME VALUES (?)", [theData]) If you had more than one bound parameter (more than one question mark in the SQL statement), then your list would contain more than one element. I hope this helps. -- Chris Ingram Synchrologic, Inc. Email: Chris.Ingram@synchrologic.com -----Original Message----- From: Shae Erisson [mailto:shae@webwitches.com] Sent: Thursday, April 12, 2001 1:31 PM [...] I'm currently fighting with odbc myself, I'm trying to figure out how to correctly escape random characters so I can put them into a large text field. Is there already a function that escapes characters somewhere? Is there a better way to do it? Specifically, I'd like to be able to: "INSERT INTO TABLE_NAME VALUES ('!@#%^&*()')" I'm also curious how to use the vars part of "cursor.execute(sql, vars=[])" That's all the documentation says, does anyone know how to use this? Is it just like parameters to stored procedures? From jens.jorgensen@tallan.com Thu Apr 12 19:29:38 2001 From: jens.jorgensen@tallan.com (Jorgensen, Jens) Date: Thu, 12 Apr 2001 13:29:38 -0500 Subject: [python-win32] question on odbc package References: <027a01c0bdcf$313746c0$6484968d@ldv.lucent.com> <20010412203047J.shae@webwitches.com> Message-ID: <3AD5F412.221638F9@tallan.com> Shae Erisson wrote: > From: "Steve Buroff" > Subject: [python-win32] question on odbc package > Date: Thu, 5 Apr 2001 08:51:54 -0400 > > > Can anyone tell me how to get the type objects for use with > > the > > odbc package? The online documentation for this package is > > essentially useless. I'm looking the Hammond & Robinson book > > "Python Programming on Win32". Appendix C talks about the > > odbc > > package. > > > > They show some type classes like "Date, Binary, ...". > > However, > > I can't find these classes. I can't import them. Anyone know > > how to get them? Thanks. > > I didn't see an answer to this, though I might have missed it. > I agree that the online docs are useless. > > I think the types you're looking for are in the "dbi" package. > I found dbi.dbiDate and a few others in that module. > > I'm currently fighting with odbc myself, I'm trying to figure out how to correctly escape random characters so I can put them into a large text field. > Is there already a function that escapes characters somewhere? Is there a better way to do it? > Specifically, I'd like to be able to: "INSERT INTO TABLE_NAME VALUES ('!@#%^&*()')" > > I'm also curious how to use the vars part of "cursor.execute(sql, vars=[])" > That's all the documentation says, does anyone know how to use this? > Is it just like parameters to stored procedures? > > Thanks, If you're having trouble with escaping characters, have you considered using ADO instead of ODBC? ADO let's you easily add parameters and not worry about quoting or escaping. I've successfully used this to add all sorts of nasty characters like nulls etc.. First use makepy.py to compile the ADO type library, eg.: python c:/Python20/win32com/client/makepy.py -o ADO.py "Microsoft ActiveX Data Objects 2.5 Library" You don't strictly need this but ADO has lots of defined constants and this will define them for you. Now you can write something like this: import ADO # connect to a sql server database (could be odbc, whatever) conn = ADO.Connection() conn.Provider = "sqloledb" conn.Open("server=myserver;user id=auser;password=apassword", "", "", ADO.constants.adConnectUnspecified) # create our command object cmd = ADO.Command() cmd.ActiveConnection = conn cmd.CommandType = ADO.constants.adCmdText cmd.CommandText = "insert into DBLogons values (?, ?)" user = password = lst = [] lst.append(cmd.CreateParameter('', ADO.constants.adVarChar, ADO.constants.adParamInput, len(user), user)) lst.append(cmd.CreateParameter('', ADO.constants.adVarChar, ADO.constants.adParamInput, len(password), password)) cmd.Execute(None, lst, ADO.constants.adExecuteNoRecords) Ok, so maybe it's a little more verbose but ADO is easy and seems to work pretty well. There are ways to shortcut the code like passing the connection string as cmd.ActiveConnection. -- Jens B. Jorgensen jens.jorgensen@tallan.com From greg@electricrain.com Fri Apr 13 07:11:18 2001 From: greg@electricrain.com (Gregory P. Smith) Date: Thu, 12 Apr 2001 23:11:18 -0700 Subject: [python-win32] passing VB Form to python keeps VB process from exiting Message-ID: <20010412231118.A14112@zot.electricrain.com> We're trying to use COM as a Local Server interface to our python code and are running into an annoying problem. If we ever pass the VB Form object to a python function, the VB application never fully exits (even after it has closed down the COM local server object). This appears to be true even if the vbForm passed into python is never used (ie: its just a dummy function parameter; change the VB code to pass 0 instead and the program exits fine, change it to pass Me and it won't exit). any ideas? From rchevrie@austin.rr.com Fri Apr 13 15:56:12 2001 From: rchevrie@austin.rr.com (Rickey Chevrie) Date: Fri, 13 Apr 2001 09:56:12 -0500 Subject: [python-win32] passing VB Form to python keeps VB process from exiting References: <20010412231118.A14112@zot.electricrain.com> Message-ID: <007701c0c429$e7c451c0$2b0110ac@ausinfo.com> I don't know for sure, but it sounds like there is an extra AddRef() being held for the form COM object. I would look to see if there is some way for you to call Release() on the COM object. Good luck. Regards, Rickey Chevrie Dripping Springs, Texas ----- Original Message ----- From: "Gregory P. Smith" To: Sent: Friday, April 13, 2001 1:11 AM Subject: [python-win32] passing VB Form to python keeps VB process from exiting > We're trying to use COM as a Local Server interface to our python code > and are running into an annoying problem. If we ever pass the VB Form > object to a python function, the VB application never fully exits > (even after it has closed down the COM local server object). This > appears to be true even if the vbForm passed into python is never used > (ie: its just a dummy function parameter; change the VB code to pass 0 > instead and the program exits fine, change it to pass Me and it won't > exit). > > any ideas? > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From kelley@bioreason.com Fri Apr 13 19:38:12 2001 From: kelley@bioreason.com (Brian Kelley) Date: Fri, 13 Apr 2001 19:38:12 +0100 Subject: [python-win32] Automation object question Message-ID: <3AD74794.8A430BC5@bioreason.com> I have a scenario where a COM server spits out an automation object say A. This part works beautifully. However, when the automation object delivers ANOTHER automation object (B) B has no available attributes or methods. Do I have to route all automation objects through the initial server? The source code is really simple btw and I'll post it if necessary. Thanks Brian Kelley kelley@bioreason.com From itamarst@yahoo.com Sun Apr 15 14:35:14 2001 From: itamarst@yahoo.com (Itamar S.-T.) Date: Sun, 15 Apr 2001 06:35:14 -0700 (PDT) Subject: [python-win32] Solution to checking if connected to Internet Message-ID: <20010415133514.83922.qmail@web13005.mail.yahoo.com> Hi, I've written a module (win32inet) that wraps this function: http://msdn.microsoft.com/workshop/networking/wininet/reference/functions/InternetGetConnectedState.asp So assuming the user has Internet Explorer 4 installed, you can check whether or not the user is connected. The module can be downloaded from http://itamarst.org/downloads/. ===== Itamar Shtull-Trauring, itamar(at)shtull-trauring.org __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ From greg@electricrain.com Tue Apr 17 02:06:29 2001 From: greg@electricrain.com (Gregory P. Smith) Date: Mon, 16 Apr 2001 18:06:29 -0700 Subject: [python-win32] assigning vb properties from python via COM? Message-ID: <20010416180629.A17259@zot.electricrain.com> Yuck. I just encountered something I was hoping to do in python using COM that may not be possible. A widget has a VB "property" called CellText such that in VB it expects code of this form: Form.CellText(index, col) = "hello" If I pass the Form into python, how can I assign this property using python code? form.CellText(index, col, "hello") leads to an "expected 3 arguments, got 4" error. Any tips other than writing more "code" in VB? -G From MarkH@ActiveState.com Tue Apr 17 03:21:41 2001 From: MarkH@ActiveState.com (Mark Hammond) Date: Tue, 17 Apr 2001 12:21:41 +1000 Subject: [python-win32] assigning vb properties from python via COM? In-Reply-To: <20010416180629.A17259@zot.electricrain.com> Message-ID: > form.CellText(index, col, "hello") leads to an > "expected 3 arguments, got 4" error. > > Any tips other than writing more "code" in VB? Try form.SetCellText(index, col) form.CellText(index, col) should be able to get the value. Mark. From greg@electricrain.com Tue Apr 17 04:29:26 2001 From: greg@electricrain.com (Gregory P. Smith) Date: Mon, 16 Apr 2001 20:29:26 -0700 Subject: [python-win32] assigning vb properties from python via COM? In-Reply-To: ; from MarkH@ActiveState.com on Tue, Apr 17, 2001 at 12:21:41PM +1000 References: <20010416180629.A17259@zot.electricrain.com> Message-ID: <20010416202926.C17259@zot.electricrain.com> On Tue, Apr 17, 2001 at 12:21:41PM +1000, Mark Hammond wrote: > > form.CellText(index, col, "hello") leads to an > > "expected 3 arguments, got 4" error. > > > > Any tips other than writing more "code" in VB? > > Try form.SetCellText(index, col) > > form.CellText(index, col) should be able to get the value. Hmm.. I just tried this and it didn't work (there was no SetCellText method so it raised an AttributeError). The control I'm using is a SftTree/OCX [a 3rd party widget] and doesn't appear to have that method. Oh well, computing and returning a list of tuples to VB for it to loop over and fill in the control is working. -G -- Gregory P. Smith gnupg/pgp: http://electricrain.com/greg/keys/ C379 1F92 3703 52C9 87C4 BE58 6CDA DB87 105D 9163 From greg@electricrain.com Tue Apr 17 04:38:32 2001 From: greg@electricrain.com (Gregory P. Smith) Date: Mon, 16 Apr 2001 20:38:32 -0700 Subject: [python-win32] assigning vb properties from python via COM? In-Reply-To: <004001c0c6ee$f345ae00$9800a8c0@JOEL>; from jjlucsy@concentric.net on Mon, Apr 16, 2001 at 11:31:51PM -0400 References: <20010416180629.A17259@zot.electricrain.com> <004001c0c6ee$f345ae00$9800a8c0@JOEL> Message-ID: <20010416203832.D17259@zot.electricrain.com> On Mon, Apr 16, 2001 at 11:31:51PM -0400, Joel Lucsy wrote: > How about > form.CellText(index,col) = "hello" > SyntaxError in python... cannot assign to a function call. From jens.jorgensen@tallan.com Tue Apr 17 06:45:15 2001 From: jens.jorgensen@tallan.com (Jorgensen, Jens) Date: Tue, 17 Apr 2001 00:45:15 -0500 Subject: [python-win32] assigning vb properties from python via COM? References: Message-ID: <3ADBD86B.36650963@tallan.com> Am I mistaken Mark that VB selects some "default" property if you assign to something that's an object without using the 'Set' keyword? Perhaps for his control form.CellText(index, col, "hello") is actually returning an IDispatch. How can you tell which is this "default" attribute? Can this fact only be had from the type library? Oh, btw Mark you probably don't recognize my name but I was hanging out with you and some others at the Microsoft Professional Developers Conference earlier this year on that night where all the groups were gathered according to category--you guys were I guess the 3rd party languages table. Anyway, just wanted to say that I'm still an adamant and avid Python evangelist. We're using it on the project we're doing right now for ubid.com. Unfortunately we're only using it for testing. Still though it's an amazing tool and you've done a fantastic job with the windows integration. Thanks! Mark Hammond wrote: > > form.CellText(index, col, "hello") leads to an > > "expected 3 arguments, got 4" error. > > > > Any tips other than writing more "code" in VB? > > Try form.SetCellText(index, col) > > form.CellText(index, col) should be able to get the value. > > Mark. > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 -- Jens B. Jorgensen jens.jorgensen@tallan.com From MarkH@ActiveState.com Tue Apr 17 07:28:43 2001 From: MarkH@ActiveState.com (Mark Hammond) Date: Tue, 17 Apr 2001 16:28:43 +1000 Subject: [python-win32] assigning vb properties from python via COM? In-Reply-To: <3ADBD86B.36650963@tallan.com> Message-ID: > Am I mistaken Mark that VB selects some "default" property if you > assign to something that's an object without using the 'Set' > keyword? That is correct. COM itself designates the default property. Python attempts to use it, and if not for the syntax error on assigning to a function, it would work a little better. Generally Python will allow you to use "function call" syntax to call a default method or get a default property, but default property setting doesn't too well. Attempting to use __str__ or __int__ on your COM object will even try :) No real big deal - you just have to use the property explicitly. It does make it harder porting VB code tho. > Perhaps for his control form.CellText(index, col, > "hello") is actually returning an IDispatch. How can you tell > which is this "default" attribute? Can this fact only be had from > the type library? Pretty much. Or from the makepy generated code. You should _always_ be using makepy if you want reasonable behaviour from complex object models. > Oh, btw Mark you probably don't recognize my name but I was > hanging out with you and some others at the Microsoft > Professional Developers Conference earlier this year on that > night where all the groups were gathered according to Ahh yes! It was good chatting with you. I had fun at that conference :) Mark. From itamarst@yahoo.com Thu Apr 19 16:27:56 2001 From: itamarst@yahoo.com (Itamar S.-T.) Date: Thu, 19 Apr 2001 08:27:56 -0700 (PDT) Subject: [python-win32] Extending Windows Shell Namespace Message-ID: <20010419152756.83009.qmail@web13007.mail.yahoo.com> Hi, I'd like to extend the Windows Shell Namespace, as documented at: http://msdn.microsoft.com/library/psdk/shellcc/shell/Shell_Adv/namespace.htm I don't suppose anyone has already done anything like this in Python? If not, any suggestions to go about it? ===== Itamar Shtull-Trauring, itamar(at)shtull-trauring.org __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ From MarkH@ActiveState.com Fri Apr 20 02:10:21 2001 From: MarkH@ActiveState.com (Mark Hammond) Date: Fri, 20 Apr 2001 11:10:21 +1000 Subject: [python-win32] Extending Windows Shell Namespace In-Reply-To: <20010419152756.83009.qmail@web13007.mail.yahoo.com> Message-ID: > I don't suppose anyone has already done anything like > this in Python? If not, any suggestions to go about > it? I made a bit of a start once. The win32com.shell module should be a good place to start... Mark. From Bill@ipathhq.com Mon Apr 23 18:48:38 2001 From: Bill@ipathhq.com (Bill Seitz) Date: Mon, 23 Apr 2001 13:48:38 -0400 Subject: [python-win32] catching odbc errors in Python/ASP pages Message-ID: <8210C9D2F4E1074181EFD72335211A970C4295@dc0.nyc.ipathhq.com> This is a multi-part message in MIME format. ------_=_NextPart_001_01C0CC1D.A03DBDD8 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Having an implementation problem, ASP pages failing when rolled out to production server, when they worked fine on dev machine and on staging server. Trying to track down problem.... I'm re-using code for generic ODBC interaction that some other people gave me. (Basically just have a single class of database-handling code, everything else is just in simple Python within the ASP page.) It all works fine when there's no error. But the error handling never does much. You have to test for a non-null value on an error message string param, rather than doing a "try" on a raised exception (the "except:" clause in a given method sets the param value, then does a "return", not a "raise"). And, there never seems to a value for that error param. So I can't every catch anything. I just see the problem at the end result, like when I try to loop over a resultSet. In an effort to catch the problem at its source (is it when the connection gets created? when the cursor gets created?), and get the detailed error message right there, I tried removing the exception handling completely from the database class, but then I just end up getting an empty page back from the server, rather than an error message. I'm using a current ActiveState Python install, and the generic/base PythonWin ODBC module. Under Win2K, talking to MsSQL2k. Are there any tricks, best-practices, etc. for handling exceptions in this environment? (Or in general: I don't have a lot of experience catching exceptions, and my books are pre-Python-v2, so don't cover the new model...). thx ------_=_NextPart_001_01C0CC1D.A03DBDD8 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable catching odbc errors in Python/ASP pages

Having an implementation problem, ASP pages failing = when rolled out to production server, when they worked fine on dev = machine and on staging server. Trying to track down = problem....

I'm re-using code for generic ODBC interaction that = some other people gave me. (Basically just have a single class of = database-handling code, everything else is just in simple Python within = the ASP page.) It all works fine when there's no error. But the error = handling never does much. You have to test for a non-null value on an = error message string param, rather than doing a "try" on a = raised exception (the "except:" clause in a given method sets = the param value, then does a "return", not a = "raise"). And, there never seems to a value for that error = param. So I can't every catch anything. I just see the problem at the = end result, like when I try to loop over a resultSet.

In an effort to catch the problem at its source (is it = when the connection gets created? when the cursor gets created?), and = get the detailed error message right there, I tried removing the = exception handling completely from the database class, but then I just = end up getting an empty page back from the server, rather than an error = message.

I'm using a current ActiveState Python install, and = the generic/base PythonWin ODBC module. Under Win2K, talking to = MsSQL2k.

Are there any tricks, best-practices, etc. for = handling exceptions in this environment? (Or in general: I don't have a = lot of experience catching exceptions, and my books are pre-Python-v2, = so don't cover the new model...).

thx

------_=_NextPart_001_01C0CC1D.A03DBDD8-- From Bill@ipathhq.com Mon Apr 23 19:10:57 2001 From: Bill@ipathhq.com (Bill Seitz) Date: Mon, 23 Apr 2001 14:10:57 -0400 Subject: [python-win32] catching odbc errors in Python/ASP pages Message-ID: <8210C9D2F4E1074181EFD72335211A97206C6A@dc0.nyc.ipathhq.com> This is a multi-part message in MIME format. ------_=_NextPart_001_01C0CC20.BE8F2684 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Argh, 2 key points I should have mentioned in original post: - dang code seems to work fine when run interactively from within PythonWin debugger on server. - other python-powered ASP pages work fine, so there's not some basic install-config problem -----Original Message----- From: Bill Seitz=20 Sent: Monday, April 23, 2001 1:49 PM To: python-win32@python.org Subject: [python-win32] catching odbc errors in Python/ASP pages Having an implementation problem, ASP pages failing when rolled out to production server, when they worked fine on dev machine and on staging server. Trying to track down problem.... I'm re-using code for generic ODBC interaction that some other people gave me. (Basically just have a single class of database-handling code, everything else is just in simple Python within the ASP page.) It all works fine when there's no error. But the error handling never does much. You have to test for a non-null value on an error message string param, rather than doing a "try" on a raised exception (the "except:" clause in a given method sets the param value, then does a "return", not a "raise"). And, there never seems to a value for that error param. So I can't every catch anything. I just see the problem at the end result, like when I try to loop over a resultSet. In an effort to catch the problem at its source (is it when the connection gets created? when the cursor gets created?), and get the detailed error message right there, I tried removing the exception handling completely from the database class, but then I just end up getting an empty page back from the server, rather than an error message. I'm using a current ActiveState Python install, and the generic/base PythonWin ODBC module. Under Win2K, talking to MsSQL2k. Are there any tricks, best-practices, etc. for handling exceptions in this environment? (Or in general: I don't have a lot of experience catching exceptions, and my books are pre-Python-v2, so don't cover the new model...). thx=20 ------_=_NextPart_001_01C0CC20.BE8F2684 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [python-win32] catching odbc errors in Python/ASP = pages

Argh, 2 key points I should have mentioned in original = post:
- dang code seems to work fine when run interactively = from within PythonWin debugger on server.
- other python-powered ASP pages work fine, so = there's not some basic install-config problem


-----Original Message-----
From: Bill Seitz
Sent: Monday, April 23, 2001 1:49 PM
To: python-win32@python.org
Subject: [python-win32] catching odbc errors in = Python/ASP pages


Having an implementation problem, ASP pages failing = when rolled out to production server, when they worked fine on dev = machine and on staging server. Trying to track down = problem....

I'm re-using code for generic ODBC interaction that = some other people gave me. (Basically just have a single class of = database-handling code, everything else is just in simple Python within = the ASP page.) It all works fine when there's no error. But the error = handling never does much. You have to test for a non-null value on an = error message string param, rather than doing a "try" on a = raised exception (the "except:" clause in a given method sets = the param value, then does a "return", not a = "raise"). And, there never seems to a value for that error = param. So I can't every catch anything. I just see the problem at the = end result, like when I try to loop over a resultSet.

In an effort to catch the problem at its source (is it = when the connection gets created? when the cursor gets created?), and = get the detailed error message right there, I tried removing the = exception handling completely from the database class, but then I just = end up getting an empty page back from the server, rather than an error = message.

I'm using a current ActiveState Python install, and = the generic/base PythonWin ODBC module. Under Win2K, talking to = MsSQL2k.

Are there any tricks, best-practices, etc. for = handling exceptions in this environment? (Or in general: I don't have a = lot of experience catching exceptions, and my books are pre-Python-v2, = so don't cover the new model...).

thx

------_=_NextPart_001_01C0CC20.BE8F2684-- From Peteris_Martinsons@swh-t.lv Mon Apr 23 19:20:51 2001 From: Peteris_Martinsons@swh-t.lv (Peteris_Martinsons@swh-t.lv) Date: Mon, 23 Apr 2001 10:20:51 -0800 Subject: [python-win32] win32all examples Message-ID: Does anybody knows any simple GUI examples of pythonwin? I have looked at the demos that come along the pythonwin, but there are no examples of window creation and the like. Pythonwin IDE itself is not so good as example, because it uses resources and the like. So far I have made a window with a menu, and have stuck on creating a toolbar with pictures from external bitmaps. It simply pops up "illegal operation" and thats all. It would be good to have some more or less simple examples of real window creation, like the ones that come with wxWindows. Peeteris From Peteris_Martinsons@swh-t.lv Mon Apr 23 19:52:36 2001 From: Peteris_Martinsons@swh-t.lv (Peteris_Martinsons@swh-t.lv) Date: Mon, 23 Apr 2001 10:52:36 -0800 Subject: [python-win32] Vb GUI from python Message-ID: Most probably it is a weird idea. Just wonder, maybe someone has tried to build a GUI, dispatching objects in vb runtime dlls? Like using VB dlls for interactively building windows, using COM calls? Peteris From shae@webwitches.com Mon Apr 23 20:15:01 2001 From: shae@webwitches.com (Shae Erisson) Date: Mon, 23 Apr 2001 22:15:01 +0300 Subject: [python-win32] Vb GUI from python In-Reply-To: References: Message-ID: <20010423221501D.shae@webwitches.com> From: Peteris_Martinsons@swh-t.lv Subject: [python-win32] Vb GUI from python Date: Mon, 23 Apr 2001 10:52:36 -0800 > Most probably it is a weird idea. Just wonder, maybe someone has tried to > build a GUI, dispatching objects in vb runtime dlls? Like using VB dlls for > interactively building windows, using COM calls? I think it's a great idea, I'd like to use it. ---- Shae Matijs Erisson - http://www.webwitches.com/~shae/ From Peteris_Martinsons@swh-t.lv Mon Apr 23 21:54:34 2001 From: Peteris_Martinsons@swh-t.lv (Peteris_Martinsons@swh-t.lv) Date: Mon, 23 Apr 2001 12:54:34 -0800 Subject: [python-win32] Vb GUI from python Message-ID: I don't know the details, because I don't know much about COM. Simply - if there is a wrapper for Tk, the same could be possible for Vb. The result - developing GUI in VB without purchasing it from M$ :) Maybe make interface similar to Tk. Theoretically, if it is possible to use ADO and DAO in Python, why not VB GUI? Any opinions? Maybe someone can take this idea and implement. It can cause BOOM of using Python on win32. Peteris Martinsons From baked@attglobal.net Mon Apr 23 22:08:58 2001 From: baked@attglobal.net (Paul Baker) Date: Mon, 23 Apr 2001 14:08:58 -0700 Subject: [python-win32] Vb GUI from python In-Reply-To: Message-ID: <5.0.2.1.2.20010423140219.00a89dc0@pop5.attglobal.net> At 12:54 4/23/2001 -0800, Peteris_Martinsons@swh-t.lv wrote: >I don't know the details, because I don't know much about COM. Simply - if >there is a wrapper for Tk, the same could be possible for Vb. The result - >developing GUI in VB without purchasing it from M$ :) >Maybe make interface similar to Tk. >Theoretically, if it is possible to use ADO and DAO in Python, why not VB >GUI? > >Any opinions? > >Maybe someone can take this idea and implement. It can cause BOOM of using >Python on win32. Isn't this all described in the book by Mark Hammond and Andy Robinson, "Python Programming on Win32" from O'Reilley & Assoc.? Specifically, Chapter 7, titled "Building a GUI with COM". Since Python is COM compatible you could use all of MS's COM based ui tools to build your user interface. Just look as the MSDN and substitute Python for VBScript. Paul From Peteris_Martinsons@swh-t.lv Mon Apr 23 22:21:12 2001 From: Peteris_Martinsons@swh-t.lv (Peteris_Martinsons@swh-t.lv) Date: Mon, 23 Apr 2001 13:21:12 -0800 Subject: [python-win32] Vb GUI from python Message-ID: Maybe it is, but when talking about GUI options for Python, nobody mentions it along with Tk, wxPython, PyQt, PythonWin etc. There are descriptions how to interface VB with Python, but not how to build GUI in VB without using MS IDE, at least as fa as I understand. Peteris From baked@attglobal.net Mon Apr 23 22:40:56 2001 From: baked@attglobal.net (Paul Baker) Date: Mon, 23 Apr 2001 14:40:56 -0700 Subject: [python-win32] Vb GUI from python In-Reply-To: Message-ID: <5.0.2.1.2.20010423143255.00a89dc0@pop5.attglobal.net> I think you pretty much have to buy VB to build a VB interface. I guess a COM UI tool would be kind of cool but it would be a lot of work if you wanted it to be truly flexible. Hmmm, Is this something that there would be a lot of demand for? How would you like to see it work? Why not make up a Python script that would show how you would like to see it work (assume you had it already working in your ideal form). What about Microsoft's HTA (HTML Applications) interface that just uses the IE DOM and VBScript, does that not give you enough GUI control using HTML and IE? This could be a fun project. Are we re-inventing the wheel, has anyone else done this or anything similar? Is this still a Python-win32 specific thread? If not let's move it off line and not post it to the listserv. Paul At 13:21 4/23/2001 -0800, Peteris_Martinsons@swh-t.lv wrote: >Maybe it is, but when talking about GUI options for Python, nobody mentions >it along with Tk, wxPython, PyQt, PythonWin etc. There are descriptions how >to interface VB with Python, but not how to build GUI in VB without using >MS IDE, at least as fa as I understand. > >Peteris > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 From Peteris_Martinsons@swh-t.lv Mon Apr 23 23:06:57 2001 From: Peteris_Martinsons@swh-t.lv (Peteris_Martinsons@swh-t.lv) Date: Mon, 23 Apr 2001 14:06:57 -0800 Subject: [python-win32] Vb GUI from python Message-ID: Not the UI builder, but simply way to build a GUI using vb runtime dlls. I hope to hear an opinion from people more competent than me - is such a thing possible? I'll try to do it, the only obstacle is I don't know where to start :) - that is, where and how a VB application starts. A demand is always for the simple to learn and powerful in use (and free), and, especially, well documented. That's more or less common for Python and VB (except for price). Offtopic concerns depend on whether this is a list for PythonWin or Python on Windows. As there is not too much activity, it could be an appropriate place to discuss. Peteris From tla@research.nj.nec.com Tue Apr 24 05:37:26 2001 From: tla@research.nj.nec.com (Tom Adelman) Date: Tue, 24 Apr 2001 00:37:26 -0400 Subject: [python-win32] COM problems Message-ID: <3.0.1.32.20010424003726.012197d8@mail.nj.nec.com> I was quite excited when I finally looked up what COM was supposed to do, but have been falling flat in my attempts to use it. It seems like a great idea; do people generally have success with this for non-MS products? I've been struggling for quite some time now trying to get Python COM to do some simple tasks with a program called SigmaPlot. I can get things working in VB but not Python. I'm using Windows NT, Python 1.5.2, win32all build 136, and am trying to run SigmaPlot 6.1 as a client. I convinced my boss to upgrade SigmaPlot just so I could hook it up to Python, and then he was going to start using Python once I did this. So far I'm nowhere and could really use some help -- any suggestions would be useful, I'm completely stuck. Here's an example: In VB (only the last two lines are really of interest here -- the other lines work in both languages): Dim sp As Object Set sp = CreateObject("SigmaPlot.Application.1") sp.Visible = True sp.Notebooks.Add sp.ActiveDocument.NotebookItems(2).DataTable.Cell(0, 0) = 5.2 sp.ActiveDocument.NotebookItems.Add (2) TemplatePage = "Bar Chart for Slide" sp.ActiveDocument.CurrentPageItem.ApplyPageTemplate (TemplatePage) Yet in Python, this doesn't work and I get a traceback: from win32com.client import Dispatch sp = Dispatch("SigmaPlot.Application") sp.Visible = 1 sp.Notebooks.Add sp.ActiveDocument.NotebookItems(2).DataTable.Cell(0,0, 5.2) sp.ActiveDocument.NotebookItems.Add(2) TemplatePage = "Bar Chart for Slide" sp.ActiveDocument.CurrentPageItem.ApplyPageTemplate(TemplatePage) Traceback (innermost last): File "", line 1, in ? File "D:\PythonCode\testSP10.py", line 53, in ? sp.ActiveDocument.CurrentPageItem.ApplyPageTemplate(TemplatePage) File "D:\Program Files\python\win32com\client\dynamic.py", line 394, in __getattr__ raise pythoncom.com_error, details com_error: (-2147352567, 'Exception occurred.', (65535, 'SigmaPlot 6.1', 'No template name supplied.', None, 0, 0), None) If you know what's wrong at this point, no need to read further (althoug please tell me). Otherwise, here are some possibly relevent clues: 1) My guess is that PythonCOM is sending the command "ApplyPageTemplate" without the parameter, and then when SigmaPlots gets this it balks and says it needs the parameter. This is consistent with the line "sp.Notebooks.Add" working but "sp.Notebooks.Add()" not working. 2) I've tried an analgous tests for Excel (a few examples from _Python Programming on Win32_) and everything seems to work for Excel. 3) Early binding doesn't get started (for SigmaPlot, it works for Excel), even though I've run MakePy, and even if I start the above script with gencache.EnsureModule('{6E73CA05-CE63-11CF-B59C-0000929132CE}', 0, 1, 0) I'm a bit confused by all of this, but I've tried to trace it through the modules: The line in the function __WrapDispatch in win32com\client\__init__: Typeinfo = dispatch.GetTypeInfo() raises an exception, which then results in a dynamic dispatch. Explicitely, the exception is (found by reraising it). File "D:\Program Files\Python\win32com\client\__init__.py", line 28, in __WrapDispatch typeinfo = dispatch.GetTypeInfo() com_error: (-2147467263, 'Not implemented', None, None) Maybe this is happening because pythoncom.connect was supposed to work and it doesn't. It raises the exception: Traceback (innermost last): File "", line 1, in ? File "D:\PythonCode\testSP12.py", line 12, in ? sp = win32com.client.Dispatch("SigmaPlot.Application") File "D:\Program Files\Python\win32com\client\__init__.py", line 97, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "D:\Program Files\Python\win32com\client\dynamic.py", line 84, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "D:\Program Files\Python\win32com\client\dynamic.py", line 70, in _GetGoodDispatch IDispatch = pythoncom.connect(IDispatch) com_error: (-2147221021, 'Operation unavailable', None, None) At this point I'm completely lost. I've spent many hours on this, and although I would really like to get it running, I'm about to give up. If you've gotten this far, I really appriciate your taking the time to read my ramblings and guesses. And any help would be greatly appriciated. Thanks, Tom TA16@cornell.edu From MarkH@ActiveState.com Tue Apr 24 06:09:54 2001 From: MarkH@ActiveState.com (Mark Hammond) Date: Tue, 24 Apr 2001 15:09:54 +1000 Subject: [python-win32] COM problems In-Reply-To: <3.0.1.32.20010424003726.012197d8@mail.nj.nec.com> Message-ID: > 1) My guess is that PythonCOM is sending the command "ApplyPageTemplate" > without the parameter, and then when SigmaPlots gets this it > balks and says > it needs the parameter. This is consistent with the line > "sp.Notebooks.Add" working but "sp.Notebooks.Add()" not working. Can you post the complete traceback of the failure. > 3) Early binding doesn't get started (for SigmaPlot, it works for Excel), > even though I've run MakePy, and even if I start the above script with > gencache.EnsureModule('{6E73CA05-CE63-11CF-B59C-0000929132CE}', 0, 1, 0) > I'm a bit confused by all of this, but I've tried to trace it through the > modules: You should still be able to use it. I have covered this a few places before. You use "gencache.EnsureModule()" to get the generated module, then you can use the class named in the generated file. Try a google search for EnsureModule(). Mark. From Alexandre.Fayolle@logilab.fr Tue Apr 24 08:16:29 2001 From: Alexandre.Fayolle@logilab.fr (Alexandre Fayolle) Date: Tue, 24 Apr 2001 09:16:29 +0200 (CEST) Subject: [python-win32] Vb GUI from python In-Reply-To: <5.0.2.1.2.20010423140219.00a89dc0@pop5.attglobal.net> Message-ID: On Mon, 23 Apr 2001, Paul Baker wrote: > Isn't this all described in the book by Mark Hammond and Andy Robinson, > "Python Programming on Win32" from O'Reilley & Assoc.? Specifically, > Chapter 7, titled "Building a GUI with COM". No, this chapter actually explains how to build a VB client to a Python COM server. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). From tla@research.nj.nec.com Tue Apr 24 20:02:45 2001 From: tla@research.nj.nec.com (Tom Adelman) Date: Tue, 24 Apr 2001 15:02:45 -0400 Subject: [python-win32] COM problems In-Reply-To: References: <3.0.1.32.20010424003726.012197d8@mail.nj.nec.com> Message-ID: <3.0.1.32.20010424150245.01452cc0@mail.nj.nec.com> I've included gencache.EnsureModule appropriately and now seem to have early binding, although my basic problem still presists (i.e. I can't seem to pass parameters to certain functions). Now the program looks like (only the last line here is really important): import win32com.client mod = win32com.client.gencache.EnsureModule('{6E73CA05-CE63-11CF-B59C-0000929132CE }', 0, 1, 0) sp = mod.Application() sp.Visible = 1 nb = sp.Notebooks.Add nb = mod.Notebook(nb) sp.ActiveDocument.NotebookItems(2).DataTable.Cell(0,0, 5.2) gp = sp.ActiveDocument.NotebookItems.Add(mod.constants.CT_GRAPHICPAGE) gp = mod.GraphItem(gp) TemplatePage = "Bar Chart for Slide" x = sp.ActiveDocument.CurrentPageItem.ApplyPageTemplate(TemplatePage) And running this produces: Traceback (innermost last): File "", line 1, in ? File "D:\PythonCode\testSP21.py", line 19, in ? x = sp.ActiveDocument.CurrentPageItem.ApplyPageTemplate(TemplatePage) File "D:\Program Files\python\win32com\client\dynamic.py", line 429, in __getattr__ raise pythoncom.com_error, details com_error: (-2147352567, 'Exception occurred.', (65535, 'SigmaPlot 6.1', 'No template name supplied.', None, 0, 0), None) or I can make the last line go through the gencache module: x = gp.ApplyPageTemplate(vTemplateName=TemplatePage) to get: Traceback (innermost last): File "", line 1, in ? File "D:\PythonCode\testSP21.py", line 17, in ? gp.ApplyPageTemplate(TemplatePage) File "D:\Program Files\python\win32com\gen_py\6E73CA05-CE63-11CF-B59C-0000929132CEx0x1x0.py", line 1696, in ApplyPageTemplate return self._oleobj_.InvokeTypes(0x9c6, LCID, 1, (11, 0), ((12, 0), (12, 16)),vTemplateName, vTemplateFileName) com_error: (-2147352573, 'Member not found.', None, None) >> 1) My guess is that PythonCOM is sending the command "ApplyPageTemplate" >> without the parameter, and then when SigmaPlots gets this it >> balks and says >> it needs the parameter. This is consistent with the line >> "sp.Notebooks.Add" working but "sp.Notebooks.Add()" not working. > >Can you post the complete traceback of the failure. > If instead of sp.Notebooks.Add in the above I run sp.Notebooks.Add() I get Traceback (innermost last): File "", line 1, in ? File "D:\PythonCode\testSP21.py", line 7, in ? nb = sp.Notebooks.Add() File "D:\Program Files\python\win32com\client\dynamic.py", line 150, in __call__ return self._get_good_object_(apply(self._oleobj_.Invoke,allArgs),self._olerepr_.de faultDispatchName,None) com_error: (-2147352573, 'Member not found.', None, None) What I find particularly weird with the above is that if I type this in interactively and watch SigmaPlot, as soon as I type in the "sp.Notebooks.Add(", and before I type ")", I get a new notebook appearing. Then when I type ")", I get another notebook and the traceback. Tom TA16@cornell.edu