From shahmed at sfwmd.gov Fri Mar 2 14:39:52 2007 From: shahmed at sfwmd.gov (Ahmed, Shakir) Date: Fri, 2 Mar 2007 08:39:52 -0500 Subject: [python-win32] GIS Shape file upload FTP server Message-ID: <14A2A120D369B6469BB154B2D2DC34D206F1ED3E@EXCHVS01.ad.sfwmd.gov> HI Group, As I am very new in python field so this question might be very silly but if I get any help that is highly appreciated. Problem: I wrote a python script which is working fine to upload files to the ftp server but the problem it is reducing the actual size of the after transferring. I need to upload a GIS Shape file to the ftp server but want to keep the same size and format. Any idea or help is highly appreciated. Thanks Shakir Staff Geographer Sfwmd.gov The code is as follows: # Import system modules import os import sys import win32com.client import zipfile import os.path import ftplib from ftplib import FTP ftp=ftplib.FTP("ftp.mysite.*","","") ftp.login('*****','*****') #ftp.cwd("/export/pub/****") ffile = open('c:\\test\\*.shp', 'r') ftp.storbinary("stor *.shp", ffile) ffile.close() print "OK" ftp.quit() From theller at ctypes.org Fri Mar 2 15:09:49 2007 From: theller at ctypes.org (Thomas Heller) Date: Fri, 02 Mar 2007 15:09:49 +0100 Subject: [python-win32] GIS Shape file upload FTP server In-Reply-To: <14A2A120D369B6469BB154B2D2DC34D206F1ED3E@EXCHVS01.ad.sfwmd.gov> References: <14A2A120D369B6469BB154B2D2DC34D206F1ED3E@EXCHVS01.ad.sfwmd.gov> Message-ID: Ahmed, Shakir schrieb: > HI Group, > > > As I am very new in python field so this question might be very silly > but if I get any help that is highly appreciated. > > > Problem: > > I wrote a python script which is working fine to upload files to the ftp > server but the problem it is reducing the actual size of the after > transferring. I need to upload a GIS Shape file to the ftp server but > want to keep the same size and format. Any idea or help is highly > appreciated. > > > > Thanks > Shakir > Staff Geographer > Sfwmd.gov > > > The code is as follows: > > # Import system modules > import os > import sys > import win32com.client > import zipfile > import os.path > import ftplib > from ftplib import FTP > > > ftp=ftplib.FTP("ftp.mysite.*","","") > ftp.login('*****','*****') > #ftp.cwd("/export/pub/****") > ffile = open('c:\\test\\*.shp', 'r') > ftp.storbinary("stor *.shp", ffile) > ffile.close() > print "OK" > ftp.quit() On Windows, you have to open binary files in binary mode: > ffile = open('c:\\test\\*.shp', 'rb') ^^ otherwise the file will be truncated at the first ^Z character. Thomas From cappy2112 at gmail.com Sat Mar 3 07:51:20 2007 From: cappy2112 at gmail.com (Tony Cappellini) Date: Fri, 2 Mar 2007 22:51:20 -0800 Subject: [python-win32] win32gui.GetOpenFileName() Message-ID: <8249c4ac0703022251k198adf83r2d00801215c234d0@mail.gmail.com> Hello I'm using Python 2.5, and PythonWin build 210. GetOpenFileName() This function takes one argument, but there is no info in the help for this. What is the argument and the type of the argument? win32gui.GetOpenFileNameW() takes several args, but there is lots of help GetOpenFileNameW(hwndOwner, hInstance , Filter , CustomFilter , FilterIndex , File , MaxFile , InitialDir , Title , Flags , DefExt , TemplateName ) However, what I'd like to have is this same dialog, that allows me to select multiple files. I can do this with PyQt calling getOpenFileNames(), and I'd like to be able to do it natively. Is there a way I can select multiple files with either of the above mentioned calls? (pressing Control doesn't work) thanks From kf9150 at gmail.com Sun Mar 4 12:56:18 2007 From: kf9150 at gmail.com (Kelie) Date: Sun, 4 Mar 2007 11:56:18 +0000 (UTC) Subject: [python-win32] win32gui.GetOpenFileName() References: <8249c4ac0703022251k198adf83r2d00801215c234d0@mail.gmail.com> Message-ID: Tony Cappellini gmail.com> writes: > > GetOpenFileName() > This function takes one argument, but there is no info in the help for this. > What is the argument and the type of the argument? Tony, maybe this page is helpful http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq21.013.htp From rwupole at msn.com Sun Mar 4 22:18:55 2007 From: rwupole at msn.com (Roger Upole) Date: Sun, 4 Mar 2007 16:18:55 -0500 Subject: [python-win32] Re: win32gui.GetOpenFileName() Message-ID: <000401c75ea2$b8a12570$0100a8c0@rupole> Tony Cappellini wrote: > Hello > > I'm using Python 2.5, and PythonWin build 210. > > > GetOpenFileName() > This function takes one argument, but there is no info in the help for this. > What is the argument and the type of the argument? This function expects a buffer containing an OPENFILENAME structure, created using the struct module or some other means. > win32gui.GetOpenFileNameW() takes several args, but there is lots of help > GetOpenFileNameW(hwndOwner, hInstance , Filter , CustomFilter , > FilterIndex , File , MaxFile , InitialDir , Title , Flags , DefExt , > TemplateName ) > > > However, what I'd like to have is this same dialog, that allows me to > select multiple files. > > I can do this with PyQt calling getOpenFileNames(), and I'd like to be > able to do it natively. > > > Is there a way I can select multiple files with either of the above > mentioned calls? > (pressing Control doesn't work) Pass win32con.OFN_ALLOWMULTISELECT|win32con.OFN_EXPLORER in the Flags to enable this. hth Roger From beat.niederhauser at gmx.ch Sun Mar 4 21:37:22 2007 From: beat.niederhauser at gmx.ch (Beat Niederhauser) Date: Sun, 04 Mar 2007 21:37:22 +0100 Subject: [python-win32] COM: change in Python object does not get registered Message-ID: <45EB2E02.50407@gmx.ch> Hallo I am completely new to COM and have trouble getting changes in python code be passed to the COM interface. When I apply changes to a Python class which is exposed as a COM object, these changes somehow don't get registered correctly - meaning that I cannot see the changes when accessing the COM object from Excel/VBA. In detail, I did the following. 1) created a python class exposed as a COM server following Hammond/Robinson (chapter 12) with a function foo and registered it in the registry 2) foo is called from Excel/VBA. This works fine. 3) Now I unregister the class and apply a change, say implement a function bar, and registered again. Calling bar from VBA gives me an error 438 (object does not support method). I assume that I must be doing some trivial error. Any help or pointer to more information is much appreciated. thanks, Beat From mc at mclaveau.com Sun Mar 4 23:11:54 2007 From: mc at mclaveau.com (Michel Claveau) Date: Sun, 4 Mar 2007 23:11:54 +0100 Subject: [python-win32] COM: change in Python object does not get registered References: <45EB2E02.50407@gmx.ch> Message-ID: <000501c75eaa$2068aa50$0701a8c0@PORTABLES> Hi! You must exit Excel, to register COM serveur, run again Excel. Change on COM server are not view by Excel, as long as Excel is not closed, and re-open. @+ Michel Claveau From mhammond at skippinet.com.au Sun Mar 4 23:29:07 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 5 Mar 2007 09:29:07 +1100 Subject: [python-win32] COM: change in Python object does not get registered In-Reply-To: <45EB2E02.50407@gmx.ch> Message-ID: <020201c75eac$866880d0$0200a8c0@enfoldsystems.local> > I am completely new to COM and have trouble getting changes > in python code be passed to the COM interface. When > I apply changes to a Python class which is exposed as a COM > object, these changes somehow don't get registered correctly - > meaning that I cannot see the changes when accessing the COM > object from Excel/VBA. You need to either restart excel, or arrange for your module to be 'reload'ed. One way would be to add a 'reload' method to your object. For example, the .py code might have: def reload(self): import mymod reload(mymod) And your VB code could then look like: ob.reload() ; reload the module using the 'old' object set ob = CreateObject("Your.ProgID") ; re-create ob with the new code and from then on, 'ob' should have any changes you have made. Mark From beat.niederhauser at gmx.ch Sun Mar 4 23:59:13 2007 From: beat.niederhauser at gmx.ch (Beat Niederhauser) Date: Sun, 04 Mar 2007 23:59:13 +0100 Subject: [python-win32] COM: change in Python object does not get registered In-Reply-To: <020201c75eac$866880d0$0200a8c0@enfoldsystems.local> References: <020201c75eac$866880d0$0200a8c0@enfoldsystems.local> Message-ID: <45EB4F41.1020900@gmx.ch> Mark Hammond escreveu: > > You need to either restart excel, or arrange for your module to be > 'reload'ed. One way would be to add a 'reload' method to your object. For > example, the .py code might have: > > def reload(self): > import mymod > reload(mymod) > > And your VB code could then look like: > > ob.reload() ; reload the module using the 'old' object > set ob = CreateObject("Your.ProgID") ; re-create ob with the new code > > and from then on, 'ob' should have any changes you have made. > > Mark > > Thanks. Everything works fine now. Beat From nytrokiss at gmail.com Mon Mar 5 08:13:08 2007 From: nytrokiss at gmail.com (James Matthews) Date: Sun, 4 Mar 2007 23:13:08 -0800 Subject: [python-win32] Wiki Message-ID: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> After fighting with my Hosting company to support and give me a shell.... I got nowhere for a week! so i have installed TikiWiki and hope it works out well... (if anyone has a better one with a simple installation please tell me) Anyways here is the site www.wazoozle.com please take things away! -- http://www.goldwatches.com/watches.asp?Brand=39 http://www.wazoozle.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070304/b5f863af/attachment.htm From davidf at sjsoft.com Mon Mar 5 16:10:57 2007 From: davidf at sjsoft.com (David Fraser) Date: Mon, 05 Mar 2007 17:10:57 +0200 Subject: [python-win32] Media Wiki In-Reply-To: <45DED170.8060705@trihedral.com> References: <8a6b8e350702222241w2919f02dw41517efddf429bf6@mail.gmail.com> <45DEAE18.2010204@timgolden.me.uk> <71b6302c0702230121j123c4a4ey8d382e43848f91b@mail.gmail.com> <45DEB2E8.5000906@timgolden.me.uk> <8a6b8e350702230156y3ec55b34occ0f6b4efdbc49ba@mail.gmail.com> <71b6302c0702230202i726df2aev1f95ca7bafec841e@mail.gmail.com> <45DEBE14.6020106@timgolden.me.uk> <8a6b8e350702230227x2b40fed3k2079553aeba09979@mail.gmail.com> <45DED170.8060705@trihedral.com> Message-ID: <45EC3301.9070109@sjsoft.com> Graham Bloice wrote: > James Matthews wrote: > >> I will leave the final verdict to the great users of the python mailing >> list! I will decide on later based on the majority! >> >> > > +1 for MoinMoin > > +1 for MediaWiki Despite despising PHP it always seems to look better and feel nicer than MoinMoin :-) David From nytrokiss at gmail.com Mon Mar 5 18:21:09 2007 From: nytrokiss at gmail.com (James Matthews) Date: Mon, 5 Mar 2007 09:21:09 -0800 Subject: [python-win32] Media Wiki In-Reply-To: <45EC3301.9070109@sjsoft.com> References: <8a6b8e350702222241w2919f02dw41517efddf429bf6@mail.gmail.com> <45DEAE18.2010204@timgolden.me.uk> <71b6302c0702230121j123c4a4ey8d382e43848f91b@mail.gmail.com> <45DEB2E8.5000906@timgolden.me.uk> <8a6b8e350702230156y3ec55b34occ0f6b4efdbc49ba@mail.gmail.com> <71b6302c0702230202i726df2aev1f95ca7bafec841e@mail.gmail.com> <45DEBE14.6020106@timgolden.me.uk> <8a6b8e350702230227x2b40fed3k2079553aeba09979@mail.gmail.com> <45DED170.8060705@trihedral.com> <45EC3301.9070109@sjsoft.com> Message-ID: <8a6b8e350703050921w2d97a488lea70d502e851afec@mail.gmail.com> I would agree however i do like the fedora core website which runs moin moin On 3/5/07, David Fraser wrote: > > Graham Bloice wrote: > > James Matthews wrote: > > > >> I will leave the final verdict to the great users of the python mailing > >> list! I will decide on later based on the majority! > >> > >> > > > > +1 for MoinMoin > > > > > +1 for MediaWiki > > Despite despising PHP it always seems to look better and feel nicer than > MoinMoin :-) > > David > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- http://www.goldwatches.com/watches.asp?Brand=39 http://www.wazoozle.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070305/58d2f24a/attachment.htm From cappy2112 at gmail.com Mon Mar 5 19:41:09 2007 From: cappy2112 at gmail.com (Tony Cappellini) Date: Mon, 5 Mar 2007 10:41:09 -0800 Subject: [python-win32] Python-win32 Digest, Vol 48, Issue 2 In-Reply-To: References: Message-ID: <8249c4ac0703051041t39896d36meb943e6dd14ec040@mail.gmail.com> Date: Sun, 4 Mar 2007 16:18:55 -0500 From: "Roger Upole" Subject: [python-win32] Re: win32gui.GetOpenFileName() To: Message-ID: <000401c75ea2$b8a12570$0100a8c0 at rupole> Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original This function expects a buffer containing an OPENFILENAME structure, created using the struct module or some other means. > Is there a way I can select multiple files with either of the above > mentioned calls? > (pressing Control doesn't work) >>Pass win32con.OFN_ALLOWMULTISELECT|win32con.OFN_EXPLORER >> in the Flags to enable this. Thanks Roger, where did you find this information? "From the Pythin Win help file" win32gui (more).GetOpenFileName int = GetOpenFileName() Creates an Open dialog box that lets the user specify the drive, directory, and the name of a file or set of files to open. Return Value If the user presses OK, the function returns TRUE. Otherwise, use CommDlgExtendedError for error details. From bgailer at alum.rpi.edu Mon Mar 5 20:23:26 2007 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Mon, 05 Mar 2007 11:23:26 -0800 Subject: [python-win32] Wiki In-Reply-To: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> References: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> Message-ID: <45EC6E2E.1090708@alum.rpi.edu> James Matthews wrote: > After fighting with my Hosting company to support and give me a > shell.... I got nowhere for a week! so i have installed TikiWiki and > hope it works out well... (if anyone has a better one with a simple > installation please tell me) Anyways here is the site www.wazoozle.com > please take things away! I just went there, registered, logged in. Now what? I see no way to add pages, and 5 minutes more than I wanted to spend looking at documentation contents I still have no clue! And what in heck does this refer to: "Click the :: options in the Menu for more options." -- Bob Gailer 510-978-4454 From mc at mclaveau.com Tue Mar 6 00:52:00 2007 From: mc at mclaveau.com (Michel Claveau) Date: Tue, 6 Mar 2007 00:52:00 +0100 Subject: [python-win32] Wiki References: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> <45EC6E2E.1090708@alum.rpi.edu> Message-ID: <000401c75f81$463ad870$0701a8c0@PORTABLES> Hi! >>> I see no way to add pages +1 Michel Claveau From nytrokiss at gmail.com Tue Mar 6 00:54:35 2007 From: nytrokiss at gmail.com (James Matthews) Date: Mon, 5 Mar 2007 15:54:35 -0800 Subject: [python-win32] Wiki In-Reply-To: <000401c75f81$463ad870$0701a8c0@PORTABLES> References: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> <45EC6E2E.1090708@alum.rpi.edu> <000401c75f81$463ad870$0701a8c0@PORTABLES> Message-ID: <8a6b8e350703051554i419dfe60mb291bb41e1da582c@mail.gmail.com> Changed to MediaWiki sorry i only informed Bob On 3/5/07, Michel Claveau wrote: > > Hi! > > >>> I see no way to add pages > > +1 > > > Michel Claveau > > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- http://www.goldwatches.com/watches.asp?Brand=39 http://www.wazoozle.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070305/d2abf568/attachment.html From bruce at brucewebber.us Tue Mar 6 03:01:13 2007 From: bruce at brucewebber.us (Bruce Webber) Date: Tue, 06 Mar 2007 02:01:13 +0000 Subject: [python-win32] PID of a process created by win32com.client.Dispatch() Message-ID: <200703060201.l2621DcW026272@rs34.luxsci.com> I've written a program which automates the running of Business Objects (a query generator and reporting tool). The command which creates the process (and the corresponding Python object) is: boApp = win32com.client.Dispatch('BusinessObjects.Application') This works fine, and I have successfully run the application. However, sometimes the Business Objects process hangs (perhaps because the query takes too long or perhaps due to some error in my code) and I would like to kill the process in Task Manager. If I am running this on my PC, it's easy to identify the process to kill. If, however, I'm running this on a server and there are other Business Objects processes running I cannot tell which process to end. Upon calling Dispatch() I would like to log the PID of the process, so if I have to kill, I would know which one. Is there a way to do this? (I have looked through the Python for Windows documentation and searched on the web, but have not found any answers.) Thanks. -- Bruce Webber bruce at brucewebber.us http://brucewebber.us From davidf at sjsoft.com Tue Mar 6 09:53:57 2007 From: davidf at sjsoft.com (David Fraser) Date: Tue, 06 Mar 2007 10:53:57 +0200 Subject: [python-win32] Media Wiki In-Reply-To: <8a6b8e350703050921w2d97a488lea70d502e851afec@mail.gmail.com> References: <8a6b8e350702222241w2919f02dw41517efddf429bf6@mail.gmail.com> <45DEAE18.2010204@timgolden.me.uk> <71b6302c0702230121j123c4a4ey8d382e43848f91b@mail.gmail.com> <45DEB2E8.5000906@timgolden.me.uk> <8a6b8e350702230156y3ec55b34occ0f6b4efdbc49ba@mail.gmail.com> <71b6302c0702230202i726df2aev1f95ca7bafec841e@mail.gmail.com> <45DEBE14.6020106@timgolden.me.uk> <8a6b8e350702230227x2b40fed3k2079553aeba09979@mail.gmail.com> <45DED170.8060705@trihedral.com> <45EC3301.9070109@sjsoft.com> <8a6b8e350703050921w2d97a488lea70d502e851afec@mail.gmail.com> Message-ID: <45ED2C25.6030502@sjsoft.com> James Matthews wrote: > I would agree however i do like the fedora core website which runs > moin moin OK great - if it looks like that switch my +1 MediaWiki to +1 MoinMoin From mail at timgolden.me.uk Tue Mar 6 10:27:01 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 06 Mar 2007 09:27:01 +0000 Subject: [python-win32] Wiki In-Reply-To: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> References: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> Message-ID: <45ED33E5.2090003@timgolden.me.uk> James Matthews wrote: > After fighting with my Hosting company to support and give me a shell.... I > got nowhere for a week! so i have installed TikiWiki and hope it works out > well... (if anyone has a better one with a simple installation please tell > me) Anyways here is the site www.wazoozle.com please take things away! Any chance of adding the OpenID extension[1], James? I prefer to use my OpenID than to remember several different logons. TJG [1] http://www.mediawiki.org/wiki/Extension:OpenID From gagsl-py2 at yahoo.com.ar Tue Mar 6 07:31:57 2007 From: gagsl-py2 at yahoo.com.ar (Gabriel Genellina) Date: Tue, 06 Mar 2007 03:31:57 -0300 Subject: [python-win32] win32gui.GetOpenFileName() References: <8249c4ac0703051041t39896d36meb943e6dd14ec040@mail.gmail.com> Message-ID: En Mon, 05 Mar 2007 15:41:09 -0300, Tony Cappellini escribi?: >> Is there a way I can select multiple files with either of the above >> mentioned calls? >> (pressing Control doesn't work) > >>> Pass win32con.OFN_ALLOWMULTISELECT|win32con.OFN_EXPLORER >>> in the Flags to enable this. > > Thanks Roger, where did you find this information? Look at the Microsoft site, MSDN, the primary source of information. Many win32xxx modules are just a thin wrapper around the related Windows functions. In this case, see http://msdn2.microsoft.com/en-us/library/ms646839.aspx -- Gabriel Genellina From it at crummock.com Tue Mar 6 13:51:20 2007 From: it at crummock.com (Ross McKerchar) Date: Tue, 06 Mar 2007 12:51:20 +0000 Subject: [python-win32] Reusing a local com server object Message-ID: <45ED63C8.2060003@crummock.com> I am having trouble connecting to an already running python com server. I have set CLSCTX_LOCAL_SERVER for my com object and I am using the "GetObject" function in my vbscripts which connect to the com server. I have written a simple test server that behaves very similarly to my real server (except the thread will actually do some work) ------------------------------------------------------------ sleeper = threading.Thread(target=time.sleep,args=(20,)) class Test(object): _public_methods_ = ["go"] _reg_progid_ = "pythonutils.test" _reg_clsid_ = "{57E47876-69CB-4822-92F1-B8D2716F54A4}" _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER def go(self): if sleeper.isAlive(): return "Server is already running" else: sleeper.start() #start a thread that sleep for 20 seconds return "Server NOT running" ------------------------------------------------------------ Now, if I run two test clients it works fine if client #2 get's a reference to my com server before client #1 stops running (i.e. client#1 sleeps for 10 seconds and I run client#2, in a seperate process before client#1 finishes). However, if I run my test clients sequentially each one creates a new pythonw process. The old com server is definitely still running, GetObject just decides to return a new one and I am unsure how the change this behaviour. After browsing Mark's win32 book I've tried playing with the _reg_threading_ but I'm not convinced it's relevant (I full admit I'm dont understand com threading 100%). I also thought I was onto something with the pythoncom.REGCLS_MULTIPLEUSE variable until I discovered that this is used by default (in win32com.server.factory). Any suggestions would be much appreciated - even just some key phrases that may help energise my search efforts... Many thanks, -ross From mark.m.mcmahon at gmail.com Tue Mar 6 14:05:20 2007 From: mark.m.mcmahon at gmail.com (Mark Mc Mahon) Date: Tue, 6 Mar 2007 08:05:20 -0500 Subject: [python-win32] Wiki In-Reply-To: <45ED33E5.2090003@timgolden.me.uk> References: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> <45ED33E5.2090003@timgolden.me.uk> Message-ID: <71b6302c0703060505p5183de1el8bc1fba0f7c0c066@mail.gmail.com> Hi, I just created an account, logged in, and I couldn't figure out how to modify a page. I added the topics that Tim and I mentioned from the earlier thread to the "Discussion" page. Mark From mail at timgolden.me.uk Tue Mar 6 14:40:40 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 06 Mar 2007 13:40:40 +0000 Subject: [python-win32] Wiki In-Reply-To: <71b6302c0703060505p5183de1el8bc1fba0f7c0c066@mail.gmail.com> References: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> <45ED33E5.2090003@timgolden.me.uk> <71b6302c0703060505p5183de1el8bc1fba0f7c0c066@mail.gmail.com> Message-ID: <45ED6F58.4080000@timgolden.me.uk> Mark Mc Mahon wrote: > I just created an account, logged in, and I couldn't figure out how to > modify a page. Well, likewise. James, is there some switch you have to set to allow logged-in users to edit main pages? TJG From ghankiewicz at rastertech.es Tue Mar 6 17:06:36 2007 From: ghankiewicz at rastertech.es (Grzegorz Adam Hankiewicz) Date: Tue, 06 Mar 2007 17:06:36 +0100 Subject: [python-win32] Adding a really odd feature to Access as an odbc driver Message-ID: <45ED918C.70607@rastertech.es> Hi. I have an old application which uses Access, and possibly the reason why concurrent access wasn't designed is because transactions are not supported, so multiple writes could be trouble. I was wondering if it would be possible to serialise all the read/write operations through a micro server with pywin32+twisted. I guess this is possible since the server just reads requests and deals them in a syncronous way. However, would it be possible to connect from the application to this serialisation server through odbc? Would this mean implementing a dummy odbc driver which just relays/gets the information and install it in the client? The idea is implementing this behind the scenes without requiring to touch the original application. Is this possible at all? -- 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.18) *?* Fax +34 918 457 889 ghankiewicz at rastertech.es *?* www.rastertech.es -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070306/d1d96396/attachment.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: sig.png Type: image/png Size: 10038 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20070306/d1d96396/attachment.png From timr at probo.com Tue Mar 6 19:16:15 2007 From: timr at probo.com (Tim Roberts) Date: Tue, 06 Mar 2007 10:16:15 -0800 Subject: [python-win32] Adding a really odd feature to Access as an odbc driver In-Reply-To: <45ED918C.70607@rastertech.es> References: <45ED918C.70607@rastertech.es> Message-ID: <45EDAFEF.1070406@probo.com> Grzegorz Adam Hankiewicz wrote: > > I have an old application which uses Access, and possibly the reason > why concurrent access wasn't designed is because transactions are not > supported, so multiple writes could be trouble. Access is trouble any time you have more than about 2 people using a single database. It just wasn't designed for that environment. > I was wondering if it would be possible to serialise all the > read/write operations through a micro server with pywin32+twisted. I > guess this is possible since the server just reads requests and deals > them in a syncronous way. However, would it be possible to connect > from the application to this serialisation server through odbc? Would > this mean implementing a dummy odbc driver which just relays/gets the > information and install it in the client? Surely it would be MUCH less trouble to move the backend to Postgres, SQLite, or even SQL Server Express, all of which are free. > The idea is implementing this behind the scenes without requiring to > touch the original application. Is this possible at all? Is the original application in Access? Or is it another language that just happens to use the Jet database? What API does it use to talk to the database? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Tue Mar 6 19:23:18 2007 From: timr at probo.com (Tim Roberts) Date: Tue, 06 Mar 2007 10:23:18 -0800 Subject: [python-win32] PID of a process created by win32com.client.Dispatch() In-Reply-To: <200703060201.l2621DcW026272@rs34.luxsci.com> References: <200703060201.l2621DcW026272@rs34.luxsci.com> Message-ID: <45EDB196.2000307@probo.com> Bruce Webber wrote: > I've written a program which automates the running of Business Objects (a query generator and reporting tool). The command which creates the process (and the corresponding Python object) is: > > boApp = win32com.client.Dispatch('BusinessObjects.Application') > > This works fine, and I have successfully run the application. However, sometimes the Business Objects process hangs (perhaps because the query takes too long or perhaps due to some error in my code) and I would like to kill the process in Task Manager. If I am running this on my PC, it's easy to identify the process to kill. If, however, I'm running this on a server and there are other Business Objects processes running I cannot tell which process to end. > > Upon calling Dispatch() I would like to log the PID of the process, so if I have to kill, I would know which one. > > Is there a way to do this? (I have looked through the Python for Windows documentation and searched on the web, but have not found any answers.) This is tricky. Remember that win32com.client.Dispatch doesn't actually know whether the COM server is in-process (meaning a DLL within the current process) or out-of-process (meaning a separate executable). That's all hidden by COM. When you talk to the boApp object, you're just calling into an object in your address space. The fact that the object is just a proxy that calls into another process is a COM detail that is hidden from view. Do you have the object model for BusinessObjects? If you are lucky, perhaps their object model includes a "get process ID" property. If not, I'm not convinced there is a way to map a COM object to a process ID, and some Google searching did not come up with an answer. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From rwupole at msn.com Tue Mar 6 19:28:23 2007 From: rwupole at msn.com (Roger Upole) Date: Tue, 6 Mar 2007 13:28:23 -0500 Subject: [python-win32] Re: Reusing a local com server object Message-ID: <001201c7601d$3ab35da0$0100a8c0@rupole> Ross McKerchar wrote: >I am having trouble connecting to an already running python com server. > > I have set CLSCTX_LOCAL_SERVER for my com object and I am using the > "GetObject" function in my vbscripts which connect to the com server. > > I have written a simple test server that behaves very similarly to my > real server (except the thread will actually do some work) > > ------------------------------------------------------------ > sleeper = threading.Thread(target=time.sleep,args=(20,)) > > class Test(object): > _public_methods_ = ["go"] > _reg_progid_ = "pythonutils.test" > _reg_clsid_ = "{57E47876-69CB-4822-92F1-B8D2716F54A4}" > _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER > > def go(self): > if sleeper.isAlive(): > return "Server is already running" > else: > sleeper.start() #start a thread that sleep for 20 seconds > return "Server NOT running" > ------------------------------------------------------------ > > Now, if I run two test clients it works fine if client #2 get's a > reference to my com server before client #1 stops running (i.e. client#1 > sleeps for 10 seconds and I run client#2, in a seperate process before > client#1 finishes). > > However, if I run my test clients sequentially each one creates a new > pythonw process. The old com server is definitely still running, > GetObject just decides to return a new one and I am unsure how the > change this behaviour. > > After browsing Mark's win32 book I've tried playing with the > _reg_threading_ but I'm not convinced it's relevant (I full admit I'm > dont understand com threading 100%). I also thought I was onto something > with the pythoncom.REGCLS_MULTIPLEUSE variable until I discovered that > this is used by default (in win32com.server.factory). > > Any suggestions would be much appreciated - even just some key phrases > that may help energise my search efforts... An object needs to be registered in the Running Object Table (ROT) for this to work. See pythoncom.RegisterActiveObject. hth Roger From ghankiewicz at rastertech.es Tue Mar 6 19:48:40 2007 From: ghankiewicz at rastertech.es (Grzegorz Adam Hankiewicz) Date: Tue, 06 Mar 2007 19:48:40 +0100 Subject: [python-win32] Adding a really odd feature to Access as an odbc driver In-Reply-To: <45EDAFEF.1070406@probo.com> References: <45ED918C.70607@rastertech.es> <45EDAFEF.1070406@probo.com> Message-ID: <45EDB788.4070802@rastertech.es> Tim Roberts wrote: > Access is trouble any time you have more than about 2 people using a > single database. It just wasn't designed for that environment. > I know, I know... just imagine that before accepting this job I didn't even know Access *could* be used *like* one, I always thought it was like a toy sqlite with fancy UI for single users. > Surely it would be MUCH less trouble to move the backend to Postgres, > SQLite, or even SQL Server Express, all of which are free. > Indeed, which is what I'm going to do in the long term, rewrite the application. > Is the original application in Access? Or is it another language that > just happens to use the Jet database? What API does it use to talk to > the database? > It is just a VB without source code which talks to the database through a DNSless connection, which really means I can't do what I was proposing, since that would mean changing the original VB application to use a specific ODBC, and I can't. I'm just asking because I'm curious about this sort of serializing gateway "architecture". In fact, does sqlite run on windows with multiple writers shared through SMB? I know sqlite works with multiple writers, but my experience so far is only under linux, so I would like to know if that works on windows the same way or there are problems like the horror stories I've heard about NFS locking. Any weird suggestions appreciated, not doing anything real here, just toying with the idea of doing something perverse (if using Access wasn't enough!). -- 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.18) *?* Fax +34 918 457 889 ghankiewicz at rastertech.es *?* www.rastertech.es -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070306/41412652/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: sig.png Type: image/png Size: 10038 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20070306/41412652/attachment.png From timr at probo.com Tue Mar 6 20:17:41 2007 From: timr at probo.com (Tim Roberts) Date: Tue, 06 Mar 2007 11:17:41 -0800 Subject: [python-win32] Adding a really odd feature to Access as an odbc driver In-Reply-To: <45EDB788.4070802@rastertech.es> References: <45ED918C.70607@rastertech.es> <45EDAFEF.1070406@probo.com> <45EDB788.4070802@rastertech.es> Message-ID: <45EDBE55.5020901@probo.com> Grzegorz Adam Hankiewicz wrote: > Tim Roberts wrote: >> Access is trouble any time you have more than about 2 people using a >> single database. It just wasn't designed for that environment. >> > I know, I know... just imagine that before accepting this job I didn't > even know Access *could* be used *like* one, I always thought it was > like a toy sqlite with fancy UI for single users. That's not a bad description, actually. However, I have encountered many clients who have built large applications with Access. As long as they're all running on the same machine, it actually works OK for less than a dozen users. Once you try to share it across a network, things get dicier. >> Is the original application in Access? Or is it another language that >> just happens to use the Jet database? What API does it use to talk to >> the database? >> > It is just a VB without source code which talks to the database > through a DNSless connection, which really means I can't do what I was > proposing, since that would mean changing the original VB application > to use a specific ODBC, and I can't. I'm just asking because I'm > curious about this sort of serializing gateway "architecture". I've heard of other people who wanted to do what you asked -- essentially build a multi-user client/server front-end for an Access Jet database. In virtually every case, it was less work to switch to a real database. The advantage of SQL is that most database backends look pretty much the same these days. Sure, there are odd details, and the APIs are spelled differently, but the concepts are the same. > In fact, does sqlite run on windows with multiple writers shared > through SMB? I know sqlite works with multiple writers, but my > experience so far is only under linux, so I would like to know if that > works on windows the same way or there are problems like the horror > stories I've heard about NFS locking. On the NT systems (2000/XP/Vista), I believe this works just as well as it does on Linux. File locking on NTFS file systems is pretty solid. Now, if you're actually talking about involving Samba -- having a file on a Windows file system shared by SQLite clients on both Windows and Linux -- then I do not know. My experiences with Samba have not been universally good, so I'm afraid I've learned not to rely on it too heavily. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From torriem at chem.byu.edu Tue Mar 6 23:58:17 2007 From: torriem at chem.byu.edu (Michael L Torrie) Date: Tue, 06 Mar 2007 15:58:17 -0700 Subject: [python-win32] Adding a really odd feature to Access as an odbc driver In-Reply-To: <45EDB788.4070802@rastertech.es> References: <45ED918C.70607@rastertech.es> <45EDAFEF.1070406@probo.com> <45EDB788.4070802@rastertech.es> Message-ID: <1173221897.7322.5.camel@contra> On Tue, 2007-03-06 at 19:48 +0100, Grzegorz Adam Hankiewicz wrote: > > Surely it would be MUCH less trouble to move the backend to Postgres, > > SQLite, or even SQL Server Express, all of which are free. > > > Indeed, which is what I'm going to do in the long term, rewrite the > application. No need to rewrite the application. Access can happily interface with any "real" database engine via ODBC. I've used MS Access with MySQL before, if I recall. Michael From timr at probo.com Wed Mar 7 01:23:54 2007 From: timr at probo.com (Tim Roberts) Date: Tue, 06 Mar 2007 16:23:54 -0800 Subject: [python-win32] Adding a really odd feature to Access as an odbc driver In-Reply-To: <1173221897.7322.5.camel@contra> References: <45ED918C.70607@rastertech.es> <45EDAFEF.1070406@probo.com> <45EDB788.4070802@rastertech.es> <1173221897.7322.5.camel@contra> Message-ID: <45EE061A.9020903@probo.com> Michael L Torrie wrote: > On Tue, 2007-03-06 at 19:48 +0100, Grzegorz Adam Hankiewicz wrote: > >>> Surely it would be MUCH less trouble to move the backend to Postgres, >>> SQLite, or even SQL Server Express, all of which are free. >>> >>> >> Indeed, which is what I'm going to do in the long term, rewrite the >> application. >> > > No need to rewrite the application. Access can happily interface with > any "real" database engine via ODBC. I've used MS Access with MySQL > before, if I recall. > Well, that's an interesting point. Depending on how the application is written, you may be able to replace the Access database by a shell database that contains nothing but links to external tables in some other database, and do it without touching the application itself. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From nytrokiss at gmail.com Wed Mar 7 05:25:29 2007 From: nytrokiss at gmail.com (James Matthews) Date: Tue, 6 Mar 2007 20:25:29 -0800 Subject: [python-win32] Wiki In-Reply-To: <45ED6F58.4080000@timgolden.me.uk> References: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> <45ED33E5.2090003@timgolden.me.uk> <71b6302c0703060505p5183de1el8bc1fba0f7c0c066@mail.gmail.com> <45ED6F58.4080000@timgolden.me.uk> Message-ID: <8a6b8e350703062025t693af6dw35c83b719e781894@mail.gmail.com> Mark I added a section for editing pages! (the mark-up) and to create pages all you need to do it search for the title and click create the page! Tim i am working on the OpenID ext. It seems it doesn't support the version of mediawiki that we have but i am working on it! P.S Tomorrow i am making a major site overhaul AKA adding new categories,Writing Wiki help docs etc... ( i am doing this off-peak hours ).. So if the site goes down a little don't worry i will have it up and running by Friday morning! If anyone has any suggestions,complaints,tips and/or would like to help administer the wiki please email me! Thanks James On 3/6/07, Tim Golden wrote: > > Mark Mc Mahon wrote: > > I just created an account, logged in, and I couldn't figure out how to > > modify a page. > > Well, likewise. James, is there some switch you have to set > to allow logged-in users to edit main pages? > > TJG > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- http://www.goldwatches.com/watches.asp?Brand=39 http://www.wazoozle.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070306/a7f8a493/attachment.htm From mail at timgolden.me.uk Wed Mar 7 09:38:25 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 07 Mar 2007 08:38:25 +0000 Subject: [python-win32] Wiki In-Reply-To: <8a6b8e350703062025t693af6dw35c83b719e781894@mail.gmail.com> References: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com> <45ED33E5.2090003@timgolden.me.uk> <71b6302c0703060505p5183de1el8bc1fba0f7c0c066@mail.gmail.com> <45ED6F58.4080000@timgolden.me.uk> <8a6b8e350703062025t693af6dw35c83b719e781894@mail.gmail.com> Message-ID: <45EE7A01.6080101@timgolden.me.uk> James Matthews wrote: > Mark I added a section for editing pages! (the mark-up) and to create pages > all you need to do it search for the title and click create the page! Tim i > am working on the OpenID ext. It seems it doesn't support the version of > mediawiki that we have but i am working on it! > > P.S Tomorrow i am making a major site overhaul AKA adding new > categories,Writing Wiki help docs etc... ( i am doing this off-peak hours > ).. So if the site goes down a little don't worry i will have it up and > running by Friday morning! > > If anyone has any suggestions,complaints,tips and/or would like to help > administer the wiki please email me! James, I'm happy to help insofar as other commitments allow. Certainly there's no rush from my point of view; it's good of you to get this started, so take as long as you need to get things going, and feel free to request help -- on the list, even -- to see if anyone can offer. The OpenID thing is not a must, but it does seem to be the way to go these days! I'll wait for updates from you before going anywhere with it for now. TJG From mc at mclaveau.com Wed Mar 7 10:26:11 2007 From: mc at mclaveau.com (Michel Claveau) Date: Wed, 7 Mar 2007 10:26:11 +0100 Subject: [python-win32] send function handler to COM/Jscript ? References: <8a6b8e350703042313g3a238579l635aa5926b31648@mail.gmail.com><45ED33E5.2090003@timgolden.me.uk><71b6302c0703060505p5183de1el8bc1fba0f7c0c066@mail.gmail.com><45ED6F58.4080000@timgolden.me.uk> <8a6b8e350703062025t693af6dw35c83b719e781894@mail.gmail.com> Message-ID: <000801c7609a$a8508db0$0701a8c0@PORTABLES> Hi! *** sorry for my bad english *** I drive Internet-Explorer, with win32com.client.Dispatch It's run very well. Among other things, I can "attach" (with =) jscript function (content in HTML page) to a Python object, callable, and I use it, in Python's script (like a Python function). Now, I search ton send a Python function to the Jscript script (for do callback). But I don't find how send a "handler" of the Python function. All me assays give me a "Objects of type 'function' can not be converted to a COM VARIANT" However, when I use JScript with ActiveScripting (from Python), I can mix Python & Jscript functions, without problem. Consequently, I suppose that my need is possible. Somebody has a track of solution? Thanks by advance. Michel Claveau From it at crummock.com Wed Mar 7 11:05:04 2007 From: it at crummock.com (Ross McKerchar) Date: Wed, 07 Mar 2007 10:05:04 +0000 Subject: [python-win32] Reusing a local com server object In-Reply-To: <001201c7601d$3ab35da0$0100a8c0@rupole> References: <001201c7601d$3ab35da0$0100a8c0@rupole> Message-ID: <45EE8E50.50703@crummock.com> Roger Upole wrote: > Ross McKerchar wrote: > >> Any suggestions would be much appreciated - even just some key phrases >> that may help energise my search efforts... >> > An object needs to be registered in the Running Object Table (ROT) for this to > work. See pythoncom.RegisterActiveObject. > Ta very much - that's exactly the missing snippet I was looking for. For posterity, here's my updated test solution: ----------------------------------------------- class TestThread(threading.Thread): def run(self): pythoncom.CoInitialize() wrapped = win32com.server.util.wrap(self.comobj) handle = pythoncom.RegisterActiveObject(wrapped, self.comobj._reg_clsid_, 0) time.sleep(20) pythoncom.RevokeActiveObject(handle) class FaxJob(object): _public_methods_ = ["go"] _reg_progid_ = "pythonutils.test" _reg_clsid_ = "{57E47876-69CB-4822-92F1-B8D2716F54A4}" _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER testthread = TestThread() def go(self): if self.testthread.isAlive(): return "Server is already running" else: self.testthread.comobj = self self.testthread.start() return "Starting new server" ----------------------------------------------- Many thanks. -ross From gregor at hostgis.com Wed Mar 7 11:25:54 2007 From: gregor at hostgis.com (Gregor Mosheh) Date: Wed, 7 Mar 2007 03:25:54 -0700 (MST) Subject: [python-win32] How to build a Windows service using win32? Message-ID: <3484.168.103.93.50.1173263154.squirrel@maps.hostgis.com> I'm trying to write a Win32 service. The following is straight from Python Programming on Win32 and it doesn't work. Is that book out of date; is there a new way to do services? I searched Google for hours trying to find any other method, and have been beating on this one for 5 more hours. The present error is: C:\Tester>python tester.py debug Debugging service Tester - press Ctrl+C to stop. Error 0xC0000004 - Python could not import the service's module : No module named service The code is: import win32serviceutil, win32service, win32event class Service(win32serviceutil.ServiceFramework): _svc_name_ = "EDMS-to-CG" _svc_display_name_ = "EDMS-to-CG Syncer" _svc_description_ = "Uploaded the EDMS database to Cartograph" def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) def SvcDoRun(self): pausetime = 60 * 1000 while True: stopsignal = win32event.WaitForSingleObject(self.hWaitStop, pausetime) if stopsignal == win32event.WAIT_OBJECT_0: break self.runOneLoop() def runOneLoop(self): import servicemanager servicemanager.LogInfoMsg('Running') win32serviceutil.HandleCommandLine(Service) From rwupole at msn.com Wed Mar 7 13:20:26 2007 From: rwupole at msn.com (Roger Upole) Date: Wed, 7 Mar 2007 07:20:26 -0500 Subject: [python-win32] Re: How to build a Windows service using win32? Message-ID: <002401c760b2$fe6b2b70$0100a8c0@rupole> Gregor Mosheh wrote: > I'm trying to write a Win32 service. The following is straight from Python > Programming on Win32 and it doesn't work. Is that book out of date; is > there a new way to do services? I searched Google for hours trying to find > any other method, and have been beating on this one for 5 more hours. > > The present error is: > > C:\Tester>python tester.py debug > Debugging service Tester - press Ctrl+C to stop. > Error 0xC0000004 - Python could not import the service's module > > : No module named service > > > The code is: > > import win32serviceutil, win32service, win32event > > class Service(win32serviceutil.ServiceFramework): > _svc_name_ = "EDMS-to-CG" > _svc_display_name_ = "EDMS-to-CG Syncer" > _svc_description_ = "Uploaded the EDMS database to Cartograph" > > def __init__(self, args): > win32serviceutil.ServiceFramework.__init__(self, args) > self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) > > def SvcStop(self): > self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) > win32event.SetEvent(self.hWaitStop) > > def SvcDoRun(self): > pausetime = 60 * 1000 > while True: > stopsignal = win32event.WaitForSingleObject(self.hWaitStop, > pausetime) > if stopsignal == win32event.WAIT_OBJECT_0: break > self.runOneLoop() > > def runOneLoop(self): > import servicemanager > servicemanager.LogInfoMsg('Running') > > win32serviceutil.HandleCommandLine(Service) The HandleCommandLine is getting executed within the service itself, but it should only get executed when configuring the service. Try this instead: if __name__=='__main__': win32serviceutil.HandleCommandLine(Service) hth Roger From bruce at brucewebber.us Wed Mar 7 21:59:35 2007 From: bruce at brucewebber.us (Bruce Webber) Date: Wed, 07 Mar 2007 15:59:35 -0500 Subject: [python-win32] PID of a process created by win32com.client.Dispatch() In-Reply-To: <45EDB196.2000307@probo.com> References: <200703060201.l2621DcW026272@rs34.luxsci.com> <45EDB196.2000307@probo.com> Message-ID: <89888FD2BADAB4F2D143E7D4@[10.9.30.130]> --Tim Roberts wrote: > Bruce Webber wrote: >> I've written a program which automates the running of Business Objects >> (a query generator and reporting tool). The command which creates the >> process (and the corresponding Python object) is: >> >> boApp = win32com.client.Dispatch('BusinessObjects.Application') >> >> This works fine, and I have successfully run the application. However, >> sometimes the Business Objects process hangs (perhaps because the query >> takes too long or perhaps due to some error in my code) and I would like >> to kill the process in Task Manager. If I am running this on my PC, it's >> easy to identify the process to kill. If, however, I'm running this on a >> server and there are other Business Objects processes running I cannot >> tell which process to end. >> >> Upon calling Dispatch() I would like to log the PID of the process, so >> if I have to kill, I would know which one. >> >> Is there a way to do this? (I have looked through the Python for Windows >> documentation and searched on the web, but have not found any answers.) > > This is tricky. Remember that win32com.client.Dispatch doesn't actually > know whether the COM server is in-process (meaning a DLL within the > current process) or out-of-process (meaning a separate executable). > That's all hidden by COM. When you talk to the boApp object, you're > just calling into an object in your address space. The fact that the > object is just a proxy that calls into another process is a COM detail > that is hidden from view. > > Do you have the object model for BusinessObjects? If you are lucky, > perhaps their object model includes a "get process ID" property. If > not, I'm not convinced there is a way to map a COM object to a process > ID, and some Google searching did not come up with an answer. Tim, Thanks for the response. I do have the object model for BusinessObjects but there is no property or method that provides the process ID. Since my company has a support contract with them, and since they do provide the object model as part of their SDK, I will contact them and ask if there is some undocumented way of doing it. -- Bruce Webber bruce at brucewebber.us http://brucewebber.us From mhammond at skippinet.com.au Wed Mar 7 23:12:22 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 8 Mar 2007 09:12:22 +1100 Subject: [python-win32] send function handler to COM/Jscript ? In-Reply-To: <000801c7609a$a8508db0$0701a8c0@PORTABLES> Message-ID: <03ad01c76105$ae60aad0$070a0a0a@enfoldsystems.local> > I drive Internet-Explorer, with win32com.client.Dispatch > > It's run very well. > Among other things, I can "attach" (with =) jscript function > (content in > HTML page) to a Python object, callable, and I use it, in > Python's script > (like a Python function). ... > Somebody has a track of solution? You need to pass a pythoncom object that handled DISPID_VALUE. Theoretically, you should just be able to implement a 'normal' pythoncom object, but include a method called '_value_' - this should be called by JS. You may need to register your object for debugging so you can track exactly what JS is doing to your object, and when. Sorry this remains vague, but I hope it helps anyway. Mark From trentm at activestate.com Fri Mar 9 02:50:56 2007 From: trentm at activestate.com (Trent Mick) Date: Thu, 08 Mar 2007 17:50:56 -0800 Subject: [python-win32] suggested change to pywintypes.py for non-admin install Message-ID: <45F0BD80.8050304@activestate.com> Mark and others, For a non-admin install pywintypesXY.dll and pythoncomXY.dll cannot be put in the system directory. The typical alternative is to put them in the install dir, next to python.exe. "pywintypes.py" is setup to know how to find it when doing either of: import pywintypes import pythoncom However, doing any of (and similar): import win32api from win32com.shell import shell fails. You have to do one of the former first. If however we put the system DLLs next to win32api.pyd et al (and update pywintypes.py to look there) then those imports work. The win32comext imports seems to work too because "win32api" will have been imported by then. Thoughts? Cheers, Trent --- pywin32/win32/Lib/pywintypes.py.original Tue Mar 06 09:34:49 2007 +++ pywin32/win32/Lib/pywintypes.py Thu Mar 08 17:26:44 2007 @@ -85,9 +85,17 @@ # This is most likely to happen for "non-admin" installs, where # we can't put the files anywhere else on the global path. - # If there is a version in our Python directory, use that - if os.path.isfile(os.path.join(sys.prefix, filename)): - found = os.path.join(sys.prefix, filename) + # If there is a version in our Python directory or next to + # win32api.pyd, use that + candidates = [ + os.path.join(sys.prefix, filename), + os.path.join(sys.prefix, "Lib", "site-packages", "win32", + filename), + ] + for candidate in candidates: + if os.path.isfile(candidate): + found = candidate + break if found is None: # give up in disgust. raise ImportError, \ -- Trent Mick trentm at activestate.com From mhammond at skippinet.com.au Fri Mar 9 04:53:47 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 9 Mar 2007 14:53:47 +1100 Subject: [python-win32] suggested change to pywintypes.py for non-admininstall In-Reply-To: <45F0BD80.8050304@activestate.com> Message-ID: <014301c761fe$8ad76d70$070a0a0a@enfoldsystems.local> > Mark and others, > > For a non-admin install pywintypesXY.dll and pythoncomXY.dll > cannot be put in > the system directory. The typical alternative is to put them > in the install > dir, next to python.exe. "pywintypes.py" is setup to know how > to find it when > doing either of: > > import pywintypes > import pythoncom > > However, doing any of (and similar): > > import win32api > from win32com.shell import shell > > fails. You have to do one of the former first. Yeah - that sucks. I actually wasn't aware it did it for a normal Python non-admin install (although if I thought more about when I had seen it, I should have worked it out!) > If however we put the system DLLs next to win32api.pyd et al > (and update > pywintypes.py to look there) then those imports work. The > win32comext imports > seems to work too because "win32api" will have been imported by then. That sounds OK I guess - not actually *good*, but sounds like it will be an improvement (and I can't see the "good" answer). It will not help someone who does 'import customwin32' (ie, their own module linked against pywintypes), but OTOH, the change would not make it *more* broken for them than it already is. We'd need a change to win32_postinstall.py to remove an existing copy from the old location too I guess, just to be safe. Now might not be a bad time either - build 210 has proven to be stable and a large number of changes have been checked into CVS since then (notably Roger's 64bit work). This means I'll probably declare build 211 as 'beta quality' and recommend people do not update critical systems, so a change like this could also bake there to see if it has legs. I welcome all other comments though. Cheers, Mark From nytrokiss at gmail.com Fri Mar 9 06:53:44 2007 From: nytrokiss at gmail.com (James Matthews) Date: Fri, 9 Mar 2007 00:53:44 -0500 Subject: [python-win32] The Wiki is Ready Message-ID: <8a6b8e350703082153m5626b764xa8e3f22ea83c238a@mail.gmail.com> Dear Everyone! The Wiki is ready! (Had to get to the point!) =) If anyone has any questions,comments,complaints,suggestions please email them to me! Thanks James -- http://www.goldwatches.com/watches.asp?Brand=39 http://www.wazoozle.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070309/c0df60b4/attachment.html From trentm at activestate.com Fri Mar 9 18:28:57 2007 From: trentm at activestate.com (Trent Mick) Date: Fri, 09 Mar 2007 09:28:57 -0800 Subject: [python-win32] suggested change to pywintypes.py for non-admininstall In-Reply-To: <014301c761fe$8ad76d70$070a0a0a@enfoldsystems.local> References: <014301c761fe$8ad76d70$070a0a0a@enfoldsystems.local> Message-ID: <45F19959.20906@activestate.com> Mark Hammond wrote: >> Mark and others, >> >> For a non-admin install pywintypesXY.dll and pythoncomXY.dll >> cannot be put in >> the system directory. The typical alternative is to put them >> in the install >> dir, next to python.exe. "pywintypes.py" is setup to know how >> to find it when >> doing either of: >> >> import pywintypes >> import pythoncom >> >> However, doing any of (and similar): >> >> import win32api >> from win32com.shell import shell >> >> fails. You have to do one of the former first. > > Yeah - that sucks. I actually wasn't aware it did it for a normal Python > non-admin install (although if I thought more about when I had seen it, I > should have worked it out!) > >> If however we put the system DLLs next to win32api.pyd et al >> (and update >> pywintypes.py to look there) then those imports work. The >> win32comext imports >> seems to work too because "win32api" will have been imported by then. > > That sounds OK I guess - not actually *good*, but sounds like it will be an > improvement (and I can't see the "good" answer). It will not help someone > who does 'import customwin32' (ie, their own module linked against > pywintypes), but OTOH, the change would not make it *more* broken for them > than it already is. Now I'm not sure. I've tried this (in an ActivePython build) and having pywintypes25.dll and pythoncom25.dll next to win32api.pyd causes Pythonwin.exe startup to fail because a simple: import win32ui fails with the system DLLs is *either* location unless you do: (a) "import pythoncom" (or any of the others that work) first; and/or (b) put the dir with the system DLLs on your PATH: > C:\>C:\Python25\python.exe -c "import win32ui" > Traceback (most recent call last): > File "", line 1, in > ImportError: DLL load failed: The specified module could not be found. > > C:\>set PATH=C:\Python25;%PATH% > > C:\>C:\Python25\python.exe -c "import win32ui" So... I'm not longer sure my suggestion is a good one. If the system DLLs are left in the install dir then telling the user to "put the Python install dir on your PATH" would be a sufficient solution to getting *all* the PyWin32 imports to just work. Given that my suggestion is no panacea, perhaps it is better to just leave it at status quo and tell the user about the requirement to update their PATH. Thoughts? Trent -- Trent Mick trentm at activestate.com From oboingo at gmail.com Fri Mar 9 19:08:57 2007 From: oboingo at gmail.com (Boingo) Date: Fri, 9 Mar 2007 10:08:57 -0800 Subject: [python-win32] Works in VB, not in Python? Message-ID: Hello there, I am a bit new to PyWin32, but not new to Python. I am new to the COM object I am trying to work with though. I have code that works in VB to access a COM object, but similar code in Python is not working. I am pretty sure I am doing something wrong. Any help would be greatly appreciated. The VB code is: ---------------------------------------------------- Set oScript = CreateObject ("ProvideX.Script") oScript.Init("C:\\Program Files\\Sage Software\\MAS 90\\Version4\\MAS90\\Home") ' Set the user for the Session Set oSS = oScript.NewObject("SY_Session") r = oSS.nLogon() If r=0 Then ' Please remember to replace the usercode, password with valid info r = oss.nSetUser("xxx","xxx") End If ----------------------------------------------------- There is more code then that, but I can't even get that far in the Python code. The Python so far is: ----------------------------------------------------- >>> import win32com.client >>> oScript = win32com.client.Dispatch("ProvideX.Script") >>> oScript >>> oScript.Init("C:\\Program Files\\Sage Software\\MAS 90\\Version4\\MAS90\\Home") >>> dir(oScript) ['AddNamedObject', 'CLSID', 'DeleteNamedObject', 'Evaluate', 'Execute', 'Init', 'NewObject', 'Parameter', 'Reset', 'Run', 'SetParameter', '_ApplyTypes_', '__cmp__', '__doc__', '__getattr__', '__init__', '__module__', '__repr__', '__setattr__', '_get_good_object_', '_get_good_single_object_', '_oleobj_', '_prop_map_get_', '_prop_map_put_', 'coclass_clsid'] >>> oSS = oScript.NewObject("SY_Session") >>> oSS >>> dir(oSS) ['CLSID', 'DropObject', '_ApplyTypes_', '__cmp__', '__doc__', '__getattr__', '__init__', '__module__', '__repr__', '__setattr__', '_get_good_object_', '_get_good_single_object_', '_oleobj_', '_prop_map_get_', '_prop_map_put_', 'coclass_clsid'] >>> login = oSS.nLogon() Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 454, in __getattr__ raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) AttributeError: '' object has no attribute 'nLogon' >>> l = oSS.SetUser("xxx","xxx") Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 454, in __getattr__ raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) AttributeError: '' object has no attribute 'SetUser' --------------------------------------- Even though the dir(oSS) command shows that list, when I type oSS. in the interactive window, the popup of options lists more options, as does the COM browser. When I try these options in the interactive window, I get the same as above... "object has no attribute". What is VB doing that Python isnt? Any help that anyone could give would be greatly appreciated. Thank you in advance for any help you can provide. From timr at probo.com Fri Mar 9 20:32:04 2007 From: timr at probo.com (Tim Roberts) Date: Fri, 09 Mar 2007 11:32:04 -0800 Subject: [python-win32] Works in VB, not in Python? In-Reply-To: References: Message-ID: <45F1B634.70208@probo.com> Boingo wrote: > Hello there, > > I am a bit new to PyWin32, but not new to Python. I am new to the COM > object I am trying to work with though. I have code that works in VB > to access a COM object, but similar code in Python is not working. I > am pretty sure I am doing something wrong. Not necessarily... Success depends on how the object itself is implemented. COM objects can be implemented as "early bound", where the types and methods are known at compile time, or "late bound", where the types and methods can all be determined at run-time, or both. PythonCom only works with object that support late binding. Have you tried running "makepy" on the ProvideX type library? If you're running Pythonwin, makepy is on the tools menu. > Any help would be greatly appreciated. The VB code is: > > ---------------------------------------------------- > Set oScript = CreateObject ("ProvideX.Script") > oScript.Init("C:\\Program Files\\Sage Software\\MAS 90\\Version4\\MAS90\\Home") > > ' Set the user for the Session > Set oSS = oScript.NewObject("SY_Session") > r = oSS.nLogon() > If r=0 Then > ' Please remember to replace the usercode, password with valid info > r = oss.nSetUser("xxx","xxx") > End If > ----------------------------------------------------- > > There is more code then that, but I can't even get that far in the > Python code. You don't show how the objects are declared. If you have Dim oSS as Object then it's probably using late binding, and you should be able to make it work in Python. If it says: Dim oSS As ProvideX.IPvxDispatch or something similarly specific, then it may be using early binding. > Even though the dir(oSS) command shows that list, when I type oSS. in > the interactive window, the popup of options lists more options, as > does the COM browser. Well, the interactive browser learns gets its list of suggestions partially from the code you have previously executed. When you type oSS.nLogon, it's going to remember that as a suggestion for later. There also may be a method/property confusion, but I don't remember how to deal with that, but I'm sure Mark will reply. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mail at timgolden.me.uk Mon Mar 12 15:10:40 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 12 Mar 2007 14:10:40 +0000 Subject: [python-win32] uAnn: active directory module Message-ID: <45F55F60.3050606@timgolden.me.uk> After a hiatus of about 18 months, I've finally done a bit of work on my active_directory module. There's nothing too radical, but I hope I've made things a bit easier for some people. Treat this release as a bit experimental, but it is functioning ok for me. One area I'm very weak in is multiple domains / trees / forests, basically because we don't use them, so it's hard to test things. http://timgolden.me.uk/python/active_directory.html Principal Changes: + I've added a load more text on the web page + There are module and object-level convenience functions for finding a user, group, computer, ou and public folder. I hope this will meet a lot of simple needs which people have. Suggestions for further convenience functions will be favourably received! + Many of the AD object properties are wrapped, making reading them easier. I intend to do something to make writing back easier, but haven't yet. (You can already set properties if you know what you're doing). + There's an experimental .walk method on the _AD_group object, which mimics the os.walk interface, returning group, groups, users for each group in the list. This was inspired by some code which Dirk Hagemann sent me absolutely ages ago. (Sorry!) + The AD_object call is now a factory function, doing intelligent things with either a path string ("LDAP://...") or an existing AD COM object. As it happens, I don't have all that much use for this module myself, so I'm very grateful to everyone who comes up with use-cases and "Is it possible to...?" questions which spur me on to better understanding. TJG From jose at cybergalvez.com Mon Mar 12 21:50:12 2007 From: jose at cybergalvez.com (jose at cybergalvez.com) Date: Mon, 12 Mar 2007 13:50:12 -0700 Subject: [python-win32] eggs and pythonservices Message-ID: <20070312135012.793903d9610815a5b69d8e8c16c4233d.42f3454acf.wbe@email.secureserver.net> Dear win32 experts I am trying to write a win32 service for a paste/pylons application which works well from the command line, however if I try to make it into a service the application can no longer find "eggs" that it needs. I'm including the command line program (which works) and the winservice (which noes not work) hopping that someone can point me the right direction. One that that I'm doing to complicate things is the eggs it needs to find are not installed in the usual place, which for the command line program simply means manipulating sys.path, however doing the same thing for the windows service does not have the same result. Any and all help is appreciated Jose -------------- next part -------------- A non-text attachment was scrubbed... Name: run.py Type: text/x-java Size: 775 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20070312/5e046227/attachment.java -------------- next part -------------- A non-text attachment was scrubbed... Name: WindowsService.py Type: text/plain,english Size: 3625 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20070312/5e046227/attachment.bin From njp at njp.us Mon Mar 12 22:31:31 2007 From: njp at njp.us (Norm Petterson) Date: Mon, 12 Mar 2007 16:31:31 -0500 Subject: [python-win32] eggs and pythonservices In-Reply-To: <20070312135012.793903d9610815a5b69d8e8c16c4233d.42f3454acf.wbe@email.secureserver.net> References: <20070312135012.793903d9610815a5b69d8e8c16c4233d.42f3454acf.wbe@email.secureserver.net> Message-ID: <9670a730703121431r3a6fc275s8373e63efad1618d@mail.gmail.com> On 3/12/07, jose at cybergalvez.com wrote: > > Dear win32 experts > > I am trying to write a win32 service for a paste/pylons application > which works well from the command line, however if I try to make it > into a service the application can no longer find "eggs" that it needs. > I'm including the command line program (which works) and the winservice > (which noes not work) hopping that someone can point me the right > direction. One that that I'm doing to complicate things is the eggs it > needs to find are not installed in the usual place, which for the > command line program simply means manipulating sys.path, however doing > the same thing for the windows service does not have the same result. > > Any and all help is appreciated I usually put something like: os.chdir(os.path.abspath(os.path.dirname(__file__))) in the initialization of my service and reference other files (like config files and log files) by relative directory locations: opts = LoadConfig('../conf/server.cfg') # Fetch server options This works on any platform I use (win32 service or linux daemon). HTH, Norm _______________________________________________ > 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/20070312/9ae525a8/attachment.htm From jose at cybergalvez.com Mon Mar 12 23:08:16 2007 From: jose at cybergalvez.com (jose at cybergalvez.com) Date: Mon, 12 Mar 2007 15:08:16 -0700 Subject: [python-win32] eggs and pythonservices Message-ID: <20070312150816.793903d9610815a5b69d8e8c16c4233d.2f58729fcc.wbe@email.secureserver.net> can sites be manipulated within a service? I tried to use site.addsitedir to add the correct eggs to my project but that failed Jose > -------- Original Message -------- > Subject: Re: [python-win32] eggs and pythonservices > From: "Norm Petterson" > Date: Mon, March 12, 2007 2:31 pm > To: "jose at cybergalvez.com" > Cc: python-win32 at python.org > > > > On 3/12/07, jose at cybergalvez.com wrote: Dear win32 experts > > I am trying to write a win32 service for a paste/pylons application > which works well from the command line, however if I try to make it > into a service the application can no longer find "eggs" that it needs. > I'm including the command line program (which works) and the winservice > (which noes not work) hopping that someone can point me the right > direction. One that that I'm doing to complicate things is the eggs it > needs to find are not installed in the usual place, which for the > command line program simply means manipulating sys.path, however doing > the same thing for the windows service does not have the same result. > > Any and all help is appreciated > > I usually put something like: > > os.chdir(os.path.abspath(os.path.dirname(__file__))) > > in the initialization of my service and reference other files (like config files and log files) by relative directory locations: > > opts = LoadConfig('../conf/server.cfg') # Fetch server options > > This works on any platform I use (win32 service or linux daemon). > > HTH, > > Norm > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > > From rwupole at msn.com Tue Mar 13 04:48:40 2007 From: rwupole at msn.com (Roger Upole) Date: Mon, 12 Mar 2007 23:48:40 -0400 Subject: [python-win32] Dependencies returned from win32service.QueryServiceConfig Message-ID: <000801c76522$7e85f470$0100a8c0@rupole> There's currently a bug in win32service.QueryServiceConfig. Dependencies are returned as a single string containing only the first dependency. I'm planning on changing it to return the dependencies as a list of unicode strings. Unfortunately, this will break code that's using that one dependency. Apologies in advance. At least the breakage can serve an an indicator where code wasn't getting complete results previously. Roger From andrea.gavana at gmail.com Tue Mar 13 12:15:47 2007 From: andrea.gavana at gmail.com (Andrea Gavana) Date: Tue, 13 Mar 2007 11:15:47 +0000 Subject: [python-win32] Drag and Drop from Outlook Message-ID: Hi All, I am trying to make my application accepting drag and drop emails from Outlook. I was told on the wxPython mailing list to try to use win32com, but actually I have no idea which clipboard data format an Outlook email has. I have tried to set up a custom drop target for that: class MyDropTarget(wx.PyDropTarget): def __init__(self): wx.PyDropTarget.__init__(self) self.data = wx.CustomDataObject("Outlook Express Messages") self.SetDataObject(self.data) But my app doesn't recongnize it with the identifier "Outlook Express Messages". I don't know almost anything about win32com, so I am asking: is there a way to do what I am trying to do with win32com? Does anyone know which is the clipboard data format for a dragged Outlook message? Thank you for your suggestions. Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.virgilio.it/infinity77/ From wedgeandlever at gmail.com Tue Mar 13 12:31:25 2007 From: wedgeandlever at gmail.com (Wedge & Lever) Date: Tue, 13 Mar 2007 03:31:25 -0800 Subject: [python-win32] py2exe all of it Message-ID: <18c037f80703130431t4d623ee8u4435f890fe222dcd@mail.gmail.com> Update in case anybody else wants the info: ** Caveat - I've only tried this on XP Professional If you copy the files from your python installation (i.e. C:\Python24), and try to run python.exe on a machine where python is not installed, you get errors for a few .dll files not found. Copy them into the same folder as python.exe, and you're in business (I think this is specific to how XP handles .dll's) PyWin32 also has at least 1 .dll which must be copied in as well to work. Having done this, I was up and running with everything under \Lib, including site-packages. Copying the wxpython docs and demos, however, only mostly worked. Some of the 'deeper' modules wouldn't import (like the Flash window as an ActiveX control). At that point I did a lot of reading about how the import statement works 'under the hood', how windows associates file extensions to programs, environment variables, etc... I don't think I can summarize all of that stuff very well. It's very interesting if you find such things interesting. I have gone into windows explorer, chose Tools->Folder Options -> (don't remember exactly from here and this definately depends on Windows version), set .py files to go to pythonw.exe, and that has everything working with a double click, even the funky wxpython demo stuff. Long story short (and these are educated guesses until I do some more tinkering) - I believe: 1. A windows user without admin authority cannot run an installer, or edit HKEY_LOCAL_MACHINE. 2. A windows user without admin authority can edit HKEY_CURRENT_USER. (When you pick what program should open .mp3 files, that's writing here) 3. Whenever Windows cares about anything that would be in HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER is checked first (I'm not very sure how universal this is, but it is definately true sometimes at least) 4. Installers typically write to HKEY_LOCAL_MACHINE, the Python installers choice between install for all users or install just for me is really letting you choose between HKEY_LOCAL_MACHINE and HKEY_CURRENT _USER. 5. Through regedit, you can export any piece of the registry, or the whole thing. The output is essentially text. 6. By comparing snapshots of the registry before and after an install, you can find all keys an installer added / deleted / edited 7. IF (and it's a big if) my set of assumptions are correct, I can write a utility to 'watch' an install, translating the local machine keys to current user keys. I can also write a utility to use that output to make any installed program 'portable'. It would check for the appropriate keys first, and add them if needed, mapping the paths based on it's own location. There's probably even a way to have these keys removed with the next system shutdown. At that point, anything could live on a CD or USB drive, waiting for you to pop it into any arbitrary windows machine and run it. I'm pretty happy with results so far. I have Python on a shared network drive living on a file and print server, but I can run scripts from machines where I'm not an admin without installing after 10 - 20 seconds of setup. I will keep tinkering (and reporting results) though. At this point it's worth it as a learning exercise. I've learned as much about Windows and Python internals in the past few weeks as I had in the past few years. Hope somebody finds this helpful, and input is appreciated as always! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070313/811b3426/attachment.html From python at kareta.de Tue Mar 13 12:48:43 2007 From: python at kareta.de (=?ISO-8859-1?Q?J=FCrgen_Kareta?=) Date: Tue, 13 Mar 2007 12:48:43 +0100 Subject: [python-win32] Drag and Drop from Outlook In-Reply-To: References: Message-ID: <45F68F9B.3070905@kareta.de> Andrea Gavana schrieb: >Hi All, > > I am trying to make my application accepting drag and drop emails >from Outlook. I was told on the wxPython mailing list to try to use >win32com, but actually I have no idea which clipboard data format an >Outlook email has. I have tried to set up a custom drop target for >that: > >class MyDropTarget(wx.PyDropTarget): > def __init__(self): > wx.PyDropTarget.__init__(self) > > self.data = wx.CustomDataObject("Outlook Express Messages") > self.SetDataObject(self.data) > >But my app doesn't recongnize it with the identifier "Outlook Express >Messages". I don't know almost anything about win32com, so I am >asking: is there a way to do what I am trying to do with win32com? >Does anyone know which is the clipboard data format for a dragged >Outlook message? > >Thank you for your suggestions. > >Andrea. > >"Imagination Is The Only Weapon In The War Against Reality." >http://xoomer.virgilio.it/infinity77/ >_______________________________________________ >Python-win32 mailing list >Python-win32 at python.org >http://mail.python.org/mailman/listinfo/python-win32 > > > > Hi Andrea, again as I told you on the wxpython ml I think it is not that easy. You have to use Extended Mapi to do that. At least Dmitry Streblechenko, the developer of OutlookSpy(really nice tool which uses a lot of mapi functions) confirms that. See: http://www.pcreview.co.uk/forums/thread-1854594.php Regards, J?rgen From mhammond at skippinet.com.au Tue Mar 13 14:28:02 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 14 Mar 2007 00:28:02 +1100 Subject: [python-win32] Drag and Drop from Outlook In-Reply-To: <45F68F9B.3070905@kareta.de> Message-ID: <05cf01c76573$6dc17d70$070a0a0a@enfoldsystems.local> > > I am trying to make my application accepting drag and drop emails > >from Outlook. I was told on the wxPython mailing list to try to use > >win32com, but actually I have no idea which clipboard data format an > >Outlook email has. I have tried to set up a custom drop target for > >that: > > > >class MyDropTarget(wx.PyDropTarget): > > def __init__(self): > > wx.PyDropTarget.__init__(self) > > > > self.data = wx.CustomDataObject("Outlook Express Messages") > > self.SetDataObject(self.data) > > > >But my app doesn't recongnize it with the identifier "Outlook Express > >Messages". ... > again as I told you on the wxpython ml I think it is not that > easy. You > have to use Extended Mapi to do that. At least Dmitry > Streblechenko, the > developer of OutlookSpy(really nice tool which uses a lot of mapi > functions) confirms that. See: > http://www.pcreview.co.uk/forums/thread-1854594.php There also appears to be some confusion re 'Outlook' and 'Outlook Express', which are quite different beasts. If it really is 'Outlook Express', then I'm afraid neither win32com nor the OutlookSpy reference above are going to be any help. I'm not aware of any Python tools that will help with Outlook express (or indeed any free tools at all!) FWIW, the win32clipboard module should let you get the clipboard data as a binary blob (and win32com.mapi does wrap extended mapi), but I'm not sure that will help you either. Good luck, Mark From cappy2112 at gmail.com Wed Mar 14 01:51:15 2007 From: cappy2112 at gmail.com (Tony Cappellini) Date: Tue, 13 Mar 2007 17:51:15 -0700 Subject: [python-win32] Can't post to the list- who is the admin? Message-ID: <8249c4ac0703131751x49dec844jecb62eff38996c80@mail.gmail.com> I've been trying to post messages for a few days now- I keep getting replies telling me my messages are being held. I've verified that I am subscribed with this address, and I did not post the messages to the sub/ubsub address. Who is the admin? thanks From cappy2112 at gmail.com Wed Mar 14 02:10:39 2007 From: cappy2112 at gmail.com (Tony Cappellini) Date: Tue, 13 Mar 2007 18:10:39 -0700 Subject: [python-win32] win32con Message-ID: <8249c4ac0703131810t4f53930dh5137692c13f1553f@mail.gmail.com> Is it an oversight that the win32con module is not listed in the PythonWin help- even as of 2.5 ? From cappy2112 at gmail.com Wed Mar 14 02:14:34 2007 From: cappy2112 at gmail.com (Tony Cappellini) Date: Tue, 13 Mar 2007 18:14:34 -0700 Subject: [python-win32] How to detect User pressing escape, or clicking cancel in call to win32gui.GetOpenFileNameW() Message-ID: <8249c4ac0703131814w7d9dc76fqd6ab47ccb98238ff@mail.gmail.com> I'm trying to understand how to detect a user pressing Escape, or clicking on Cancel when win32gui.GetOpenFileNameW() is called. When I press escape when the FileOpen dialogue is present, I see the following error with Python2.5/PWin32 Build 210 error: (0, 'GetOpenFileNameW', 'No error message is available') Would someone explain what this means, or how to detect the above situations? My call looks like this filter='Patches' customfilter='All Files' unicodeFilenames=None unicodeFilenames, customfilter, flags = win32gui.GetOpenFileNameW(Filter=filter, CustomFilter=customfilter, FilterIndex=1, File='*.pch', InitialDir=os.getcwd(), Title='Select Input Files', Flags=win32con.OFN_ALLOWMULTISELECT|win32con.OFN_EXPLORER, DefExt='.pch') From mhammond at skippinet.com.au Wed Mar 14 02:16:24 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 14 Mar 2007 12:16:24 +1100 Subject: [python-win32] Can't post to the list- who is the admin? In-Reply-To: <8249c4ac0703131751x49dec844jecb62eff38996c80@mail.gmail.com> Message-ID: <000701c765d6$629afe40$0f0a0a0a@enfoldsystems.local> > I've been trying to post messages for a few days now- I keep getting > replies telling me my messages are being held. > > I've verified that I am subscribed with this address, and I did not > post the messages to the sub/ubsub address. > > Who is the admin? I believe the admin is Itamar Shtull-Trauring (CCd), who initially set the list up many years ago after chatting to me at a pycon. I haven't seen Itamar around for a while, so maybe this has dropped off his priorities. Itamar - if you are no longer active here, would you be willing to pass the admin on to someone else? Any volunteers on the pywin32 list for the admin role? I've plenty enough to manage as it is :) Mark From mhammond at skippinet.com.au Wed Mar 14 02:17:49 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 14 Mar 2007 12:17:49 +1100 Subject: [python-win32] win32con In-Reply-To: <8249c4ac0703131810t4f53930dh5137692c13f1553f@mail.gmail.com> Message-ID: <000801c765d6$963aef80$0f0a0a0a@enfoldsystems.local> > Is it an oversight that the win32con module is not listed in the > PythonWin help- even as of 2.5 ? Yes. It is also a side-effect of the doc building process - as win32con has no autoduck markup it is skipped. It should be possible to generate docs for this module using the same technique we use to build the ISAPI docs, by introspecting the module contents - but as yet this hasn't been done. As always, contributions welcome. Cheers, Mark From mhammond at skippinet.com.au Wed Mar 14 02:37:30 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 14 Mar 2007 12:37:30 +1100 Subject: [python-win32] How to detect User pressing escape, or clicking cancel in call to win32gui.GetOpenFileNameW() In-Reply-To: <8249c4ac0703131814w7d9dc76fqd6ab47ccb98238ff@mail.gmail.com> Message-ID: <001a01c765d9$55029650$0f0a0a0a@enfoldsystems.local> > I'm trying to understand how to detect a user pressing Escape, or > clicking on Cancel when win32gui.GetOpenFileNameW() is called. > > When I press escape when the FileOpen dialogue is present, I see the > following error with Python2.5/PWin32 Build 210 > > error: (0, 'GetOpenFileNameW', 'No error message is available') > > Would someone explain what this means, or how to detect the > above situations? > > My call looks like this > > > filter='Patches' > customfilter='All Files' > unicodeFilenames=None > unicodeFilenames, customfilter, flags = > win32gui.GetOpenFileNameW(Filter=filter, > CustomFilter=customfilter, > FilterIndex=1, > File='*.pch', > InitialDir=os.getcwd(), > Title='Select Input Files', > Flags=win32con.OFN_ALLOWMULTISELECT|win32con.OFN_EXPLORER, > DefExt='.pch') As currently implemented, you must detect cancel by trapping win32gui.error, and checking the hresult is zero. While this is slightly ugly, it is more convenient than returning None, as in the usual case there are 3 return values. Returning (None, None, None) might have been possible, but was not implemented, and I'm reluctant to change the semantics of the return value in this case. I'll document this. Mark From mail at timgolden.me.uk Wed Mar 14 09:37:20 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 14 Mar 2007 08:37:20 +0000 Subject: [python-win32] Can't post to the list- who is the admin? In-Reply-To: <000701c765d6$629afe40$0f0a0a0a@enfoldsystems.local> References: <000701c765d6$629afe40$0f0a0a0a@enfoldsystems.local> Message-ID: <45F7B440.4020200@timgolden.me.uk> Mark Hammond wrote: >> I've been trying to post messages for a few days now- I keep getting >> replies telling me my messages are being held. >> >> I've verified that I am subscribed with this address, and I did not >> post the messages to the sub/ubsub address. >> >> Who is the admin? > > I believe the admin is Itamar Shtull-Trauring (CCd), who initially set the > list up many years ago after chatting to me at a pycon. I haven't seen > Itamar around for a while, so maybe this has dropped off his priorities. > > Itamar - if you are no longer active here, would you be willing to pass the > admin on to someone else? Any volunteers on the pywin32 list for the admin > role? I've plenty enough to manage as it is :) > > Mark I'm willing to help out on this. Although I don't really know what degree of time/effort is required, I guess it's not a lot. Ideally not alone: like most people I have commitments of my own. I'm in the UK timezone so I suppose that someone in another timezone would be helpful, too. Let me know if I can be of use and how. TJG From nawalkg at esi-india.com Wed Mar 14 11:16:37 2007 From: nawalkg at esi-india.com (Nawal) Date: Wed, 14 Mar 2007 15:46:37 +0530 Subject: [python-win32] Scintilla Code Folding In-Reply-To: References: <7.0.1.0.0.20070120231148.03e47cf8@yahoo.com.ar> Message-ID: <45F7CB85.1070501@esi-india.com> Hi all, How is the code folding implemented in Python Win IDE? It uses the custom lexer for colorize but I can't see any code where the code folding logic is implemented. Is ii using the inbuilt SCILex_PYTHON for code folding? Regards, Nawal From python_nabble at fah-consulting.co.uk Mon Mar 5 10:21:59 2007 From: python_nabble at fah-consulting.co.uk (new2com) Date: Mon, 5 Mar 2007 01:21:59 -0800 (PST) Subject: [python-win32] COM works from IDLE but not when file executed from Windows Explorer Message-ID: <9308083.post@talk.nabble.com> Installed: Python25, pywin32-210.win32-py2.5.exe Being new to COM, I have a simple question. When I execute the following code from within IDLE, I hear the mp3 file played out but when I run the file from Windows Explorer I get no sound (and no errors) ? I'm sure the answer is very simple ! ( http://www.nabble.com/file/6954/playFile.py playFile.py ): from win32com.client import Dispatch if __name__ == "__main__": mp = Dispatch("WMPlayer.OCX") tune = mp.newMedia('my_file.mp3') mp.currentPlaylist.appendItem(tune) mp.controls.play() raw_input("Press Enter to stop playing") mp.controls.stop() -- View this message in context: http://www.nabble.com/COM-works-from-IDLE-but-not-when-file-executed-from-Windows-Explorer-tf3347619.html#a9308083 Sent from the Python - python-win32 mailing list archive at Nabble.com. From Muthu_T at Dell.com Tue Mar 6 17:16:21 2007 From: Muthu_T at Dell.com (Muthu_T at Dell.com) Date: Tue, 6 Mar 2007 21:46:21 +0530 Subject: [python-win32] Microsoft VDS Interface in Python Message-ID: <9924ACE3FD56024BAC2FC5E99B3CB6F75E5954@blrx3m02.blr.amer.dell.com> Hi, Does python-win32 has API calls to VDS (Virtual Disk Service) Service? If not, how to implement one? Thanks & Regards, T. Muthu Mohan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070306/5933a8f2/attachment.html From cappy2112 at gmail.com Mon Mar 12 07:06:59 2007 From: cappy2112 at gmail.com (Tony Cappellini) Date: Sun, 11 Mar 2007 23:06:59 -0700 Subject: [python-win32] How to detect User presseing escape, or clicking cancel in call to win32gui.GetOpenFileNameW() Message-ID: <8249c4ac0703112306q48a08c59u71f59df7b5eece52@mail.gmail.com> I'm trying to understand how to detect a user pressing Escape, or clicking on Cancel when win32gui.GetOpenFileNameW() is called. When I press escape when the FileOpen dialogue is present, I see the following error with Python2.5/PWin32 Build 210 error: (0, 'GetOpenFileNameW', 'No error message is available') Would someone explain what this means, or how to detect the above situatiions? From cappy2112 at gmail.com Mon Mar 12 07:08:17 2007 From: cappy2112 at gmail.com (Tony Cappellini) Date: Sun, 11 Mar 2007 23:08:17 -0700 Subject: [python-win32] win32con Message-ID: <8249c4ac0703112308x681ab830ofa9df61464073bb9@mail.gmail.com> Is it an oversight that the win32con constants are not listed in the PythonWin help? From sven.wikstrom at scania.com Tue Mar 13 14:31:58 2007 From: sven.wikstrom at scania.com (=?iso-8859-1?Q?Wikstr=F6m_Sven?=) Date: Tue, 13 Mar 2007 14:31:58 +0100 Subject: [python-win32] Accessing a COM-objects type name Message-ID: Hi! What is the most appropriate way to access a COM-objects type name in Python like Vbscript's "TypeName" function? The concerned COM-objects are developed using .NET interop. I have previously solved it, with .NET 1.1 COM-objects, by calling the COM exposed derived "System.Object.GetType()" method from Python. This is not possible after moving to .NET 2.0, as the "Type" only seem to have IUnknown (not Idispatch). Still works in Vbscript though with "TypeName"...! >> dotNet11 = win32com.client.Dispatch("DotNet11.ComObject") >> print dotNet11.GetType() DotNet11.ComObject >> >> otherDotNet11 = dotNet11.CreateOther() >> print otherDotNet11.GetType() DotNet11.OtherComObject >> dotNet20 = win32com.client.Dispatch("DotNet20.ComObject") >> print dotNet20.GetType() >> >> otherDotNet20 = dotNet20.CreateOther() >> print otherDotNet20.GetType() Thanks and best regards. /Sven From itamar at itamarst.org Wed Mar 14 13:22:22 2007 From: itamar at itamarst.org (Itamar Shtull-Trauring) Date: Wed, 14 Mar 2007 08:22:22 -0400 Subject: [python-win32] List moderation Message-ID: <1173874943.9197.1.camel@localhost.localdomain> Hi, Apparently I broke moderation when I changed some of my spam settings. Hopefully it's fixed now. I approved some emails from March, and discarded pending messages from before that on the theory that posters will have subscribed and re-posted. My apologies, I am investigating ways to make this not happen in the future -- Itamar Shtull-Trauring http://itamarst.org From mark.m.mcmahon at gmail.com Wed Mar 14 17:31:22 2007 From: mark.m.mcmahon at gmail.com (Mark Mc Mahon) Date: Wed, 14 Mar 2007 11:31:22 -0500 Subject: [python-win32] Microsoft VDS Interface in Python In-Reply-To: <9924ACE3FD56024BAC2FC5E99B3CB6F75E5954@blrx3m02.blr.amer.dell.com> References: <9924ACE3FD56024BAC2FC5E99B3CB6F75E5954@blrx3m02.blr.amer.dell.com> Message-ID: <71b6302c0703140931y1d623ad1re41d44df3f0d9da2@mail.gmail.com> Hi On 3/6/07, Muthu_T at dell.com wrote: > > > Hi, > > Does python-win32 has API calls to VDS (Virtual Disk Service) Service? > If not, how to implement one? > I don' t know the answer to this one (and I guess you have searched - so no point in me doing it). For the 2nd I would suggest looking at ctypes if the VDS API is made up of functions exported from DLL's and if it is a COM API - then look at win32com (part of pywin32). Thanks MarkM > Thanks & Regards, > T. Muthu Mohan > From timr at probo.com Wed Mar 14 17:41:17 2007 From: timr at probo.com (Tim Roberts) Date: Wed, 14 Mar 2007 09:41:17 -0700 Subject: [python-win32] COM works from IDLE but not when file executed from Windows Explorer In-Reply-To: <9308083.post@talk.nabble.com> References: <9308083.post@talk.nabble.com> Message-ID: <45F825AD.1090908@probo.com> new2com wrote: > Installed: Python25, pywin32-210.win32-py2.5.exe > Being new to COM, I have a simple question. When I execute the following > code from within IDLE, I hear the mp3 file played out but when I run the > file from Windows Explorer I get no sound (and no errors) ? > By "run the file from Windows Explorer", do you mean you double-click on the icon? > I'm sure the answer is very simple ! > > ( http://www.nabble.com/file/6954/playFile.py playFile.py ): > > from win32com.client import Dispatch > > if __name__ == "__main__": > mp = Dispatch("WMPlayer.OCX") > tune = mp.newMedia('my_file.mp3') > mp.currentPlaylist.appendItem(tune) > mp.controls.play() > raw_input("Press Enter to stop playing") > mp.controls.stop() My guess is that you aren't in the same directory, so that "my_file.mp3" is not found. Explorer might be setting the starting directory to the directory that contains python.exe (since that's what it is really executing) instead of the directory with your script. You might try providing the full path to the file, instead of just a relative path. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From 3dbernard at gmail.com Wed Mar 14 18:21:50 2007 From: 3dbernard at gmail.com (Bernard Lebel) Date: Wed, 14 Mar 2007 12:21:50 -0500 Subject: [python-win32] List moderation In-Reply-To: <1173874943.9197.1.camel@localhost.localdomain> References: <1173874943.9197.1.camel@localhost.localdomain> Message-ID: <61d0e2b40703141021p7688808buef551fbf8e8e1ad6@mail.gmail.com> My announcement of pywin32 for x64, provided by Softimage, as a free download, was refused with "no reason given". Could that be it? Bernard On 3/14/07, Itamar Shtull-Trauring wrote: > Hi, > > Apparently I broke moderation when I changed some of my spam settings. > Hopefully it's fixed now. I approved some emails from March, and > discarded pending messages from before that on the theory that posters > will have subscribed and re-posted. > > My apologies, I am investigating ways to make this not happen in the > future > > -- > Itamar Shtull-Trauring > http://itamarst.org > > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From mhammond at skippinet.com.au Wed Mar 14 23:19:56 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 15 Mar 2007 09:19:56 +1100 Subject: [python-win32] COM works from IDLE but not when file executed from Windows Explorer In-Reply-To: <9308083.post@talk.nabble.com> Message-ID: <015701c76686$e61c65a0$0f0a0a0a@enfoldsystems.local> > Installed: Python25, pywin32-210.win32-py2.5.exe > Being new to COM, I have a simple question. When I execute > the following > code from within IDLE, I hear the mp3 file played out but > when I run the > file from Windows Explorer I get no sound (and no errors) ? > > I'm sure the answer is very simple ! > > ( http://www.nabble.com/file/6954/playFile.py playFile.py ): > > from win32com.client import Dispatch > > if __name__ == "__main__": > mp = Dispatch("WMPlayer.OCX") > tune = mp.newMedia('my_file.mp3') > mp.currentPlaylist.appendItem(tune) > mp.controls.play() > raw_input("Press Enter to stop playing") > mp.controls.stop() In addition to Tim's suggestion, try replacing the last 2 lines with: import pythoncom pythoncom.PumpMessages() You will need to press Ctrl+C to terminate the script, but if the sound plays, it means your original code does not have a message loop (while IDLE does). google for python and message loop and you should find lots of messages with more detail. Mark From mhammond at skippinet.com.au Wed Mar 14 23:20:45 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 15 Mar 2007 09:20:45 +1100 Subject: [python-win32] Scintilla Code Folding In-Reply-To: <45F7CB85.1070501@esi-india.com> Message-ID: <015801c76687$03348460$0f0a0a0a@enfoldsystems.local> > Hi all, > > How is the code folding implemented in Python Win IDE? It uses the > custom lexer for colorize but I can't see any code where the code > folding logic is implemented. > > Is ii using the inbuilt SCILex_PYTHON for code folding? IIRC, the folding code is in C++ in the scintilla widget itself. Mark From gagsl-py2 at yahoo.com.ar Thu Mar 15 00:43:17 2007 From: gagsl-py2 at yahoo.com.ar (Gabriel Genellina) Date: Wed, 14 Mar 2007 20:43:17 -0300 Subject: [python-win32] COM works from IDLE but not when file executed from Windows Explorer References: <9308083.post@talk.nabble.com> <45F825AD.1090908@probo.com> Message-ID: En Wed, 14 Mar 2007 13:41:17 -0300, Tim Roberts escribi?: >> if __name__ == "__main__": >> mp = Dispatch("WMPlayer.OCX") >> tune = mp.newMedia('my_file.mp3') >> mp.currentPlaylist.appendItem(tune) >> mp.controls.play() >> raw_input("Press Enter to stop playing") >> mp.controls.stop() > > My guess is that you aren't in the same directory, so that "my_file.mp3" > is not found. Explorer might be setting the starting directory to the > directory that contains python.exe (since that's what it is really > executing) instead of the directory with your script. > > You might try providing the full path to the file, instead of just a > relative path. In addition, you may obtain the directory where your script resides using: import os print os.path.dirname(os.path.abspath(__file__)) (I suggest computing that early on your program, because if the current directory changes, abspath will give a wrong result) -- Gabriel Genellina From sallas at tpg.com.au Thu Mar 15 05:34:21 2007 From: sallas at tpg.com.au (sallas at tpg.com.au) Date: Thu, 15 Mar 2007 15:34:21 +1100 Subject: [python-win32] LDAPS issues Message-ID: <1173933261.45f8cccdcd7e9@postoffice.tpg.com.au> I am trying to connect from a Windows machine to a Windows Active Directory over LDAPS using Python and am getting what seems certificate issues. I can connect fine over LDAP, but in submitting the following: [CODE] import sys import ldap def main(): who = "username" cred = "password" try: ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, "ldapsInt.pem") ld = ldap.initialize("ldaps://ldap.server:636") ld.simple_bind_s(who,cred) print "Successfully bound to server.\n" print "Searching..\n" except ldap.LDAPError, error_message: print "Couldn't Connect. %s " % error_message if __name__ == '__main__': main() [/CODE] ('ldap.server' is a dummy server name for display purposes) I get the following error message: Couldn't Connect. {'info': 'error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed', 'desc': "Can't contact LDAP server"} I have tried adding 'ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT,ldap.OPT_X_TLS_NEVER)', but still get the same error. Port 636 has been verified as being opened. I am using Python 2.4 as latest version isn't compatible with the ldap library. No other libraries are installed. The only thing I am dubious about is how to get the '.pem' file. As I created the file from the ldap server certificate on a unix machine using some openssl command (as the code will need to be finally initiated from a Unix client), how do you do this on a Windows machine? TIA. From nawalkg at esi-india.com Thu Mar 15 06:22:32 2007 From: nawalkg at esi-india.com (Nawal) Date: Thu, 15 Mar 2007 10:52:32 +0530 Subject: [python-win32] Scintilla Code Folding In-Reply-To: <015801c76687$03348460$0f0a0a0a@enfoldsystems.local> References: <015801c76687$03348460$0f0a0a0a@enfoldsystems.local> Message-ID: <45F8D818.2070909@esi-india.com> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070315/35844be6/attachment.htm From mhammond at skippinet.com.au Thu Mar 15 07:46:14 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 15 Mar 2007 17:46:14 +1100 Subject: [python-win32] Scintilla Code Folding In-Reply-To: <45F8D818.2070909@esi-india.com> Message-ID: <01cc01c766cd$a0a427f0$0f0a0a0a@enfoldsystems.local> I believe it is linked with the Python lexer, along with most others. It does use a custom formatter, but if I recall correctly, the folding is still magically done by the C++ code. I'm afraid it has been many years, so you probably need to check out the scintilla source code for a better answer. Mark -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Nawal Sent: Thursday, 15 March 2007 4:23 PM To: Mark Hammond Cc: Python-win32 at python.org Subject: Re: [python-win32] Scintilla Code Folding Dear Mark, Thank you for the reply. Is Pyhone win editor is linked with SCILex_PYTHON? Is it using "FoldPyDoc" in LexPython.cxx As far I can understand from the code is Python win is using SCILex_CUSTOM so that in python level colorise code is implemented. But how is it enabled the fold logic which has been done in c++? Nawal Mark Hammond wrote: Hi all, How is the code folding implemented in Python Win IDE? It uses the custom lexer for colorize but I can't see any code where the code folding logic is implemented. Is ii using the inbuilt SCILex_PYTHON for code folding? IIRC, the folding code is in C++ in the scintilla widget itself. Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070315/aecb19d4/attachment-0001.html From johan.lindvall at gmail.com Thu Mar 15 08:51:56 2007 From: johan.lindvall at gmail.com (Johan Lindvall) Date: Thu, 15 Mar 2007 08:51:56 +0100 Subject: [python-win32] List moderation In-Reply-To: <61d0e2b40703141021p7688808buef551fbf8e8e1ad6@mail.gmail.com> References: <1173874943.9197.1.camel@localhost.localdomain> <61d0e2b40703141021p7688808buef551fbf8e8e1ad6@mail.gmail.com> Message-ID: Hi, On 3/14/07, Bernard Lebel <3dbernard at gmail.com> wrote: > My announcement of pywin32 for x64, provided by Softimage, as a free > download, was refused with "no reason given". Could that be it? Please resend the announcement. I have been looking for an x64-version for quite some time. -- /Johan. From gregpinero at gmail.com Fri Mar 16 16:28:30 2007 From: gregpinero at gmail.com (=?ISO-8859-1?Q?Gregory_Pi=F1ero?=) Date: Fri, 16 Mar 2007 11:28:30 -0400 Subject: [python-win32] How to Tell Windows that a file Changed Message-ID: <312cfe2b0703160828y3dcbc93ctc1759caad6cca909@mail.gmail.com> Hi guys, Here's the situation, I'm hoping Python-win32 can help. I have a program that puts files to be OCR'd into a directory where Omnipage sees them and then performs OCR on them. Everything was working great, until yesterday when Omnipage stopped "seeing" files added to the folder. What's odd though is that if I manually place a file in the folder Omnipage sees it. So I'm wondering if I can use Python and (the windows API) to tell the OS that I've placed a file in the folder? (I'm on Windows 2000 professional if that matters) Thanks in advance for any help or tips. -Greg From mail at timgolden.me.uk Fri Mar 16 16:41:08 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 16 Mar 2007 15:41:08 +0000 Subject: [python-win32] How to Tell Windows that a file Changed In-Reply-To: <312cfe2b0703160828y3dcbc93ctc1759caad6cca909@mail.gmail.com> References: <312cfe2b0703160828y3dcbc93ctc1759caad6cca909@mail.gmail.com> Message-ID: <45FABA94.8040600@timgolden.me.uk> Gregory Pi?ero wrote: > I have a program that puts files to be OCR'd into a directory where > Omnipage sees them and then performs OCR on them. Everything was > working great, until yesterday when Omnipage stopped "seeing" files > added to the folder. > > What's odd though is that if I manually place a file in the folder > Omnipage sees it. So I'm wondering if I can use Python and (the > windows API) to tell the OS that I've placed a file in the folder? > (I'm on Windows 2000 professional if that matters) Well, it's bizarre behaviour for sure, but in case it helps you might try the SHChangeNotify routine exposed in the pywin32 modules. It's one of those does-everything functions MS seems to love. The docs, such as they are, are here: http://tinyurl.com/f5olb (msdn link) but I suspect you'll have to poke around the web to find examples of the parameters. TJG From gregpinero at gmail.com Fri Mar 16 16:45:48 2007 From: gregpinero at gmail.com (=?ISO-8859-1?Q?Gregory_Pi=F1ero?=) Date: Fri, 16 Mar 2007 11:45:48 -0400 Subject: [python-win32] How to Tell Windows that a file Changed In-Reply-To: <45FABA94.8040600@timgolden.me.uk> References: <312cfe2b0703160828y3dcbc93ctc1759caad6cca909@mail.gmail.com> <45FABA94.8040600@timgolden.me.uk> Message-ID: <312cfe2b0703160845j1427dce6g149e986fd69ce6fd@mail.gmail.com> On 3/16/07, Tim Golden wrote: > > Well, it's bizarre behaviour for sure, but in case it helps you > might try the SHChangeNotify routine exposed in the pywin32 > modules. It's one of those does-everything functions MS seems > to love. The docs, such as they are, are here: > > http://tinyurl.com/f5olb > (msdn link) > > but I suspect you'll have to poke around the web to find > examples of the parameters. > Thanks for the advice Tim. I'm looking at the docs now. I'll send an update on my progress. -Greg From nebpro at gmail.com Fri Mar 16 16:54:23 2007 From: nebpro at gmail.com (Ben) Date: Fri, 16 Mar 2007 11:54:23 -0400 Subject: [python-win32] looking for pythonwin gui tutorials Message-ID: Hi all, I have been using Python just for two weeks, and I feel very comfortable with it. The only stumbling blocks is on learning to build gui with pywin (pythonwin). Is there any good tutorials or good documentations out there ? (I can not find any good one on the internet). I really appreciate for any pointer where I can find a good tutorial about gui development with python. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070316/a15d4a6c/attachment.html From ghankiewicz at rastertech.es Fri Mar 16 17:46:10 2007 From: ghankiewicz at rastertech.es (Grzegorz Adam Hankiewicz) Date: Fri, 16 Mar 2007 17:46:10 +0100 Subject: [python-win32] looking for pythonwin gui tutorials In-Reply-To: References: Message-ID: <45FAC9D2.5020802@rastertech.es> Ben wrote: > Hi all, > > I have been using Python just for two weeks, and I feel very > comfortable with it. The only stumbling blocks is on learning to build > gui with pywin (pythonwin). Is there any good tutorials or good > documentations out there ? (I can not find any good one on the > internet). I really appreciate for any pointer where I can find a good > tutorial about gui development with python. I'm not sure if people tend to build GUIs just with pywin32. Usually they play with TK (comes with Python), wxPython (http://wxpython.org/), pyQT (http://www.riverbankcomputing.co.uk/pyqt/), and other specialised GUI toolkits. Each of these comes with a good amount of documentation. -- 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.18) *?* Fax +34 918 457 889 ghankiewicz at rastertech.es *?* www.rastertech.es -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070316/d3786847/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: sig.png Type: image/png Size: 10038 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20070316/d3786847/attachment-0001.png From nytrokiss at gmail.com Fri Mar 16 20:29:38 2007 From: nytrokiss at gmail.com (James Matthews) Date: Fri, 16 Mar 2007 15:29:38 -0400 Subject: [python-win32] looking for pythonwin gui tutorials In-Reply-To: <45FAC9D2.5020802@rastertech.es> References: <45FAC9D2.5020802@rastertech.es> Message-ID: <8a6b8e350703161229q10b343c5j513c15c37920ef64@mail.gmail.com> I use wxPython and really like it! There are some books for it and they should have some info on there site On 3/16/07, Grzegorz Adam Hankiewicz wrote: > > Ben wrote: > > Hi all, > > I have been using Python just for two weeks, and I feel very comfortable > with it. The only stumbling blocks is on learning to build gui with pywin > (pythonwin). Is there any good tutorials or good documentations out there ? > (I can not find any good one on the internet). I really appreciate for any > pointer where I can find a good tutorial about gui development with python. > > > I'm not sure if people tend to build GUIs just with pywin32. Usually they > play with TK (comes with Python), wxPython (http://wxpython.org/), pyQT ( > http://www.riverbankcomputing.co.uk/pyqt/), and other specialised GUI > toolkits. Each of these comes with a good amount of documentation. > > -- > [image: 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.18) *?* Fax +34 918 457 889 > ghankiewicz at rastertech.es *?* www.rastertech.es > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > -- http://www.goldwatches.com/watches.asp?Brand=39 http://www.wazoozle.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070316/17f7d892/attachment.htm From gregpinero at gmail.com Fri Mar 16 23:04:53 2007 From: gregpinero at gmail.com (=?ISO-8859-1?Q?Gregory_Pi=F1ero?=) Date: Fri, 16 Mar 2007 18:04:53 -0400 Subject: [python-win32] How to Tell Windows that a file Changed In-Reply-To: <312cfe2b0703160845j1427dce6g149e986fd69ce6fd@mail.gmail.com> References: <312cfe2b0703160828y3dcbc93ctc1759caad6cca909@mail.gmail.com> <45FABA94.8040600@timgolden.me.uk> <312cfe2b0703160845j1427dce6g149e986fd69ce6fd@mail.gmail.com> Message-ID: <312cfe2b0703161504t7153ed10u2d24be016e85d5fd@mail.gmail.com> On 3/16/07, Gregory Pi?ero wrote: > Thanks for the advice Tim. I'm looking at the docs now. I'll send an > update on my progress. > Ok, turns out it was easier just to have Omnipage running before I moved the file, then it sees it. But I'm sure I'll need this approach one day anyway. Thanks again for the help. -Greg From kf9150 at gmail.com Sat Mar 17 08:30:02 2007 From: kf9150 at gmail.com (Kelie) Date: Sat, 17 Mar 2007 07:30:02 +0000 (UTC) Subject: [python-win32] odd problem with Microsoft Word Message-ID: Hello, The simple code shown below runs fine. It adds a custom document property to the active word document. But as soon as i use makepy on the "Microsoft Office 11.0 Object Library (2.3)", i get an AttributeError when run the same code: AttributeError: '' object has no attribute 'Add' I tested a few times and the behavior is consistent. Btw, the code also runs fine after i use makepy on the "Microsoft Word 11.0 Object Library (8.3)". Because i wanted to access some constants which are common to Microsoft Office applications, i tried use makepy on the office11 object library which seems to be causing the problem. Btw, i'm using Office 2003 on WinXP pro. Thanks for you help. kelie import win32com.client wdApp = win32com.client.gencache.EnsureDispatch("Word.Application") doc = wdApp.ActiveDocument doc.CustomDocumentProperties.Add("VarName", False, 4, "VarValue") print "Done." From jjjanse at home.nl Sun Mar 18 10:16:20 2007 From: jjjanse at home.nl (JJJanse) Date: Sun, 18 Mar 2007 10:16:20 +0100 Subject: [python-win32] Vista's win32 Message-ID: <308C9A4F822E4CF38AED4866F400BD1D@pc2janj> On WinXP I used to import win32api import win32con import win32event from win32com.shell import shell, shellcon in order to call exResult=shell.ShellExecuteEx( lpFile=r"C:\Program Files\MLDownloader\MLDownloader.exe", lpParameters="-MLD_daily", nShow=win32con.SW_NORMAL, fMask=shellcon.SEE_MASK_NOCLOSEPROCESS ) Now, I installed Vista Python 2.5 and Python2.5 pywin32-210 and get the exception: ImportError: DLL load failed: The specified module could not be found. Is there a solution to this problem? w.k.regards Joost Janse -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070318/67973529/attachment.html From mc at mclaveau.com Sun Mar 18 11:59:52 2007 From: mc at mclaveau.com (Michel Claveau) Date: Sun, 18 Mar 2007 11:59:52 +0100 Subject: [python-win32] Vista's win32 References: <308C9A4F822E4CF38AED4866F400BD1D@pc2janj> Message-ID: <000b01c7694c$8fadc6f0$0701a8c0@PORTABLES> Hi! This is no a PyWin32 problem. It's a Vista resctriction. You must configure your software, for give to rights of launch. Your code run OK, for execute a(nother) software, in another directory (I had try). @-salutations Michel Claveau From it at crummock.com Sun Mar 18 12:20:45 2007 From: it at crummock.com (Ross McKerchar) Date: Sun, 18 Mar 2007 11:20:45 +0000 Subject: [python-win32] odd problem with Microsoft Word In-Reply-To: References: Message-ID: <45FD208D.2060606@crummock.com> Kelie wrote: > The simple code shown below runs fine. It adds a custom document property to the > active word document. But as soon as i use makepy on the "Microsoft Office 11.0 > Object Library (2.3)", i get an AttributeError when run the same code: > AttributeError: ' Library.DocumentProperties instance at 0x28416160>' object has no attribute 'Add' > When you use early bound code everything becomes case sensitive when it wasn't before. Admmitedly, however 'Add' with an uppercase A does seem right for office. Another less well documented difference I've found when using early binding is that keyword arguments work when they didn't before. I doubt it's relevant but worth bearing in mind. HTH. -ross From mail at timgolden.me.uk Sun Mar 18 21:03:21 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Sun, 18 Mar 2007 20:03:21 +0000 Subject: [python-win32] screen size/resolution in win32 in python In-Reply-To: References: <1174225888.752421.56410@l75g2000hse.googlegroups.com> <45FD67B8.1040705@timgolden.me.uk> Message-ID: <45FD9B09.8000507@timgolden.me.uk> [copying back to the list in case it's of more general interest] adrian villanustre wrote: > Tim: > > Tank you very much, that solve my problem (just one of them) > BTW can you give me a good link related to python-win32 reference and use The best reference, I'm afraid, is the .chm file which comes with the pywin32 extensions. That and a lot of experience. We're trying to put together some sort of Wiki (only very recently begun) where this kind of information could be dumped, but often searching the archives of the mailing lists is the best starting point: http://www.google.co.uk/search?q=site%3Amail.python.org I do have a small series of pages: http://timgolden.me.uk/python/win32_how_do_i.html which tries to address some common problems, but they are pitifully few compared to the questions which get asked. I'll try to add your question on so at least that one's covered. The book written several years ago by Mark Hammond and Andy Robinson called (something like) Python for Win32 is still published by O'Reilly I think and is still recommended: http://www.oreilly.com/catalog/pythonwin32/ Also, bear in mind that many "How do I..." questions for Python on Windows are near enough identical to "How do I..." questions for any language on Windows. So if you can find a VB or Delphi or a C# solution, the chances are it can be fairly easily translated into Python. That's all I did to give you your answer: I looked around the net a bit and then back-fitted the answer into Python. (Of course I may have the advantage of know the kind of search terms which would bite and remembering one or two API calls which were not right but which came close!) TJG From mail at timgolden.me.uk Sun Mar 18 21:15:14 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Sun, 18 Mar 2007 20:15:14 +0000 Subject: [python-win32] screen size/resolution in win32 in python In-Reply-To: <45FD9B09.8000507@timgolden.me.uk> References: <1174225888.752421.56410@l75g2000hse.googlegroups.com> <45FD67B8.1040705@timgolden.me.uk> <45FD9B09.8000507@timgolden.me.uk> Message-ID: <45FD9DD2.5010600@timgolden.me.uk> Tim Golden wrote: > I do have a small series of pages: > > http://timgolden.me.uk/python/win32_how_do_i.html > > which tries to address some common problems, but > they are pitifully few compared to the questions > which get asked. I'll try to add your question on > so at least that one's covered. And in fact it's now there: http://timgolden.me.uk/python/win32_how_do_i/find-the-screen-resolution.html TJG From kf9150 at gmail.com Mon Mar 19 01:18:35 2007 From: kf9150 at gmail.com (Kelie) Date: Mon, 19 Mar 2007 00:18:35 +0000 (UTC) Subject: [python-win32] odd problem with Microsoft Word References: <45FD208D.2060606@crummock.com> Message-ID: Ross McKerchar crummock.com> writes: > When you use early bound code everything becomes case sensitive when it > wasn't before. Admmitedly, however 'Add' with an uppercase A does seem > right for office. > Thanks for your reply Ross. But it seems to me early-binding is not the cause of problem, at least not from Microsoft Word. As i mentioned the code runs fine after i ran makepy on Word 2003's object library "Microsoft Word 11.0 Object Library (8.3)". But after i used makepy on Microsoft Office 2003's object library "Microsoft Office 11.0 Object Library (2.3)", the code stopped working. Seems there is something conflicting between these two object libraries. i'm totally guessing. From cappy2112 at gmail.com Mon Mar 19 20:12:50 2007 From: cappy2112 at gmail.com (Tony Cappellini) Date: Mon, 19 Mar 2007 12:12:50 -0700 Subject: [python-win32] Release notes for Build 210 Message-ID: <8249c4ac0703191212x29916dc6ib7b22d0d1ddef6e5@mail.gmail.com> I'm trying to find the release notes (bug fixes plus new features) for Build 210. http://sourceforge.net/project/showfiles.php?group_id=78018 but don't see these in the PyWin32 project in sourceforge. Are these available online, or does one have to download and install Build 210 to get the release notes? From Jim.Vickroy at noaa.gov Mon Mar 19 20:28:18 2007 From: Jim.Vickroy at noaa.gov (Jim.Vickroy at noaa.gov) Date: Mon, 19 Mar 2007 13:28:18 -0600 Subject: [python-win32] Release notes for Build 210 Message-ID: Hmmmm. They are visible for me. What do you see when you click on the "Notes" icon adjacent to the "Monitor" icon? -- jv ----- Original Message ----- From: Tony Cappellini Date: Monday, March 19, 2007 1:12 pm Subject: [python-win32] Release notes for Build 210 > I'm trying to find the release notes (bug fixes plus new features) for > Build 210. > http://sourceforge.net/project/showfiles.php?group_id=78018 > > but don't see these in the PyWin32 project in sourceforge. > > Are these available online, or does one have to download and install > Build 210 to get the release notes? > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From cappy2112 at gmail.com Mon Mar 19 23:12:50 2007 From: cappy2112 at gmail.com (Tony Cappellini) Date: Mon, 19 Mar 2007 15:12:50 -0700 Subject: [python-win32] Release notes for Build 210 In-Reply-To: References: Message-ID: <8249c4ac0703191512y7da8576qedc126c49dd32a5f@mail.gmail.com> For some reason my notes icon is not clickable. It's likely to be another problem with FireFox (on my end) though. On 3/19/07, Jim.Vickroy at noaa.gov wrote: > Hmmmm. They are visible for me. What do you see when you click on > the "Notes" icon adjacent to the "Monitor" icon? > > -- jv > > ----- Original Message ----- > From: Tony Cappellini > Date: Monday, March 19, 2007 1:12 pm > Subject: [python-win32] Release notes for Build 210 > > > I'm trying to find the release notes (bug fixes plus new features) > for > > Build 210. > > http://sourceforge.net/project/showfiles.php?group_id=78018 > > > > but don't see these in the PyWin32 project in sourceforge. > > > > Are these available online, or does one have to download and install > > Build 210 to get the release notes? > > _______________________________________________ > > Python-win32 mailing list > > Python-win32 at python.org > > http://mail.python.org/mailman/listinfo/python-win32 > > > From emlynj at gmail.com Thu Mar 22 19:20:42 2007 From: emlynj at gmail.com (Emlyn Jones) Date: Thu, 22 Mar 2007 18:20:42 +0000 Subject: [python-win32] Debugging Advice Message-ID: Hello, I'm running a web application using a set of Windows services written in Python and a front end using ASP/Python. For historical reasons the interface between the ASP and the services uses the SoapPy package (using the built in threaded server with a little 'hack' to use HTTPConnection rather than HTTP). Every now and then the http connection between the services and the ASP breaks, I'll get a bad set of headers or an empty response. I can paper over this by retrying the call when the error happens but I'd like to get to the bottom of the problem. Has anybody come across socket/httplib problem like this on a Windows machine? Does anybody have any advice on a good way to debug this threaded client/server interaction? I'm guessing it's load related but I've not seen any significant resource usage, is there something specific I should keep and eye on? Any pointers greatfully received (expect for "don't use SOAPpy", unfortunately that's not an option at the moment). Regards, Emlyn. From fumanchu at amor.org Thu Mar 22 22:41:37 2007 From: fumanchu at amor.org (Robert Brewer) Date: Thu, 22 Mar 2007 14:41:37 -0700 Subject: [python-win32] MS Access: silent overflow failure Message-ID: <435DF58A933BA74397B42CDEB8145A860A56B3D7@ex9.hostedexchange.local> Hi all, The small demo script below makes ADO calls to a Microsoft Access (Jet) database via win32com. But it fails in a potentially dangerous way; "SELECT int * int;" can return None with no warning if the result is large enough. This can also occur if one or both of the operands is a column reference. The same SQL run as a Query inside the Access GUI works as expected. Manually changing one of the ints to a Single by appending ".0" works as expected. Any ideas about where I need to look next to find the cause of, and then fix, this behavior? Robert Brewer System Architect Amor Ministries fumanchu at amor.org # demo_access_overflow.py import os import win32com.client adOpenForwardOnly = 0 adLockReadOnly = 1 dbname = "test.mdb" def create_db(): cat = win32com.client.Dispatch(r'ADOX.Catalog') cat.Create("PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=%s;" % dbname) cat.ActiveConnection.Close() def fetch(query, conn): try: # Call conn.Open(query) directly, skipping win32com overhead. res = win32com.client.Dispatch(r'ADODB.Recordset') res.Open(query, conn, adOpenForwardOnly, adLockReadOnly) data = res.GetRows() finally: res.Close() return data if __name__ == '__main__': try: create_db() conn = win32com.client.Dispatch(r'ADODB.Connection') try: conn.Open("PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=%s;" % dbname) # This works fine. assert fetch("SELECT 86400;", conn) == ((86400,),) # This fails because data is ((None,),) data = fetch("SELECT 62647 * 86400;", conn) assert (data == ((62647 * 86400,),)), data finally: conn.Close() finally: if os.path.exists(dbname): os.remove(dbname) From mhammond at skippinet.com.au Thu Mar 22 23:53:09 2007 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 23 Mar 2007 09:53:09 +1100 Subject: [python-win32] MS Access: silent overflow failure In-Reply-To: <435DF58A933BA74397B42CDEB8145A860A56B3D7@ex9.hostedexchange.local> Message-ID: <099801c76cd4$dd347e60$0f0a0a0a@enfoldsystems.local> > The small demo script below makes ADO calls to a Microsoft > Access (Jet) > database via win32com. But it fails in a potentially dangerous way; > "SELECT int * int;" can return None with no warning if the result is > large enough. This can also occur if one or both of the operands is a > column reference. > > The same SQL run as a Query inside the Access GUI works as expected. > Manually changing one of the ints to a Single by appending > ".0" works as > expected. > > Any ideas about where I need to look next to find the cause > of, and then > fix, this behavior? I'd suggest using VB to see if the behaviour is different than with Python. If it is and we can narrow a test case to a very small snippet, then we can probably sort out why. If VB works the same, it is likely to be a "feature" of ADO as implemented, and not much we can do. Cheers, Mark -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 2092 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20070323/9c9c3b51/attachment.bin From fumanchu at amor.org Tue Mar 27 22:55:39 2007 From: fumanchu at amor.org (Robert Brewer) Date: Tue, 27 Mar 2007 13:55:39 -0700 Subject: [python-win32] MS Access: silent overflow failure In-Reply-To: <099801c76cd4$dd347e60$0f0a0a0a@enfoldsystems.local> Message-ID: <435DF58A933BA74397B42CDEB8145A860A787181@ex9.hostedexchange.local> Mark Hammond wrote: > Robert Brewer wrote: > > The small demo script below makes ADO calls to a Microsoft > > Access (Jet) > > database via win32com. But it fails in a potentially dangerous way; > > "SELECT int * int;" can return None with no warning if the result is > > large enough. This can also occur if one or both of the > > operands is a column reference. > > > > The same SQL run as a Query inside the Access GUI works as expected. > > Manually changing one of the ints to a Single by appending > > ".0" works as expected. > > > > Any ideas about where I need to look next to find the cause > > of, and then fix, this behavior? > > I'd suggest using VB to see if the behaviour is different > than with Python. If it is and we can narrow a test case to > a very small snippet, then we can probably sort out why. If > VB works the same, it is likely to be a "feature" of ADO as > implemented, and not much we can do. Below is a VB 4 demo (wow, that takes me back! :). The return value on overflow is a zero-length string. Robert Brewer System Architect Amor Ministries fumanchu at amor.org ' demo_access_overflow.bas Attribute VB_Name = "Module1" Option Explicit Const adOpenForwardOnly = 0 Const adLockReadOnly = 1 Const dbname = "test.mdb" Sub create_db() Dim cat As New ADOX.Catalog cat.Create "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbname cat.ActiveConnection.Close End Sub Function fetch(query, conn) As String Dim res As New ADODB.Recordset res.Open query, conn, adOpenForwardOnly, adLockReadOnly, -1 Dim Data As Variant Data = res.GetRows(1, 0) fetch = Data(0, 0) res.Close End Function Sub Main() create_db Dim conn As New ADODB.Connection conn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source='" & dbname & "'", "", "", -1 ' This works fine. Dim Data As String Data = fetch("SELECT 86400;", conn) If Data <> 86400 Then MsgBox (Data) ' This fails because data is "" Data = fetch("SELECT 62647 * 86400;", conn) If Data <> CStr(CSng(62647) * CSng(86400)) Then MsgBox (Data & " (len " & Len(Data) & ")") End If conn.Close Kill dbname End Sub From vernon.cole at wirelessbeehive.com Fri Mar 30 02:27:23 2007 From: vernon.cole at wirelessbeehive.com (Vernon Cole) Date: Thu, 29 Mar 2007 18:27:23 -0600 Subject: [python-win32] adodbapi update - where to post? Message-ID: <460C596B.1050109@wirelessbeehive.com> I am presently working on an update to Henrik Ekelund's adodbapi package. For those who don't know, adodbapi is a python DB API 2.0 interface using Microsoft ADO. It is an alternative to the ODBC module which ships with python-win32 and is better in some ways, particularly in that it does not require defining a DSN in order to access data. I have used it now with MS-SQL, Access, MySQL, and AS-400 DB2. I have applied all of the patches I can find, and am altering it to use decimal data (pythoncom.__future_currency__ = True) and updating the unit test. I am also tracking down a new bug which seems to have arrived with Python 2.5 which causes it to store only the first character of a string into a database field. (Most annoying... I have had to leave all my users running older versions of Python.) Henrik seems to have disappeared from the Internet and no maintenance of the adodbapi site on soureceforge has happened in several years. Question for this group: Should I attempt to take over the project on sourceforge, or should adodbapi be added to python-win as part of its library? --- Vernon Cole Old programmer and young Python hacker. From mail at timgolden.me.uk Fri Mar 30 10:07:32 2007 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 30 Mar 2007 09:07:32 +0100 Subject: [python-win32] adodbapi update - where to post? In-Reply-To: <460C596B.1050109@wirelessbeehive.com> References: <460C596B.1050109@wirelessbeehive.com> Message-ID: <460CC544.7020907@timgolden.me.uk> Vernon Cole wrote: > I am presently working on an update to Henrik Ekelund's > adodbapi package. Good news. Can I suggest -- in case the relevant people don't track this list -- that you post also to the sqlalchemy list. There's a fair bit of activity over there at the moment concerning the use of different MSSQL dialects. The recent pyodbc module seems to be the favoured contender at present, but adodbapi is still supported and I think they'd be interested in the news. FWIW, I'd be inclined to announce publicly as you've done, and then to take over the sf project if that's straightforward. If not, start a new one with a distinct name but with an obvious indication of its provenance. TJG From ghankiewicz at rastertech.es Fri Mar 30 10:21:38 2007 From: ghankiewicz at rastertech.es (Grzegorz Adam Hankiewicz) Date: Fri, 30 Mar 2007 10:21:38 +0200 Subject: [python-win32] adodbapi update - where to post? In-Reply-To: <460CC544.7020907@timgolden.me.uk> References: <460C596B.1050109@wirelessbeehive.com> <460CC544.7020907@timgolden.me.uk> Message-ID: <460CC892.30207@rastertech.es> Tim Golden wrote: > Vernon Cole wrote: >> I am presently working on an update to Henrik Ekelund's >> adodbapi package. > > Good news. Can I suggest -- in case the relevant people > don't track this list -- that you post also to the > sqlalchemy list. Well, the db-sig list could also be ok, especially since I asked about these patches there and got no answer. I don't know about taking over SF projects, but most likely the author still reads emails, so he could add somebody else to maintain the project. -- 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.18) *?* Fax +34 918 457 889 ghankiewicz at rastertech.es *?* www.rastertech.es From mc at mclaveau.com Sat Mar 31 10:17:34 2007 From: mc at mclaveau.com (Michel Claveau) Date: Sat, 31 Mar 2007 10:17:34 +0200 Subject: [python-win32] access to attribute non-(full)-Ascii References: <460C596B.1050109@wirelessbeehive.com> Message-ID: <000701c7736d$0ea96340$0701a8c0@PORTABLES> Hi! >From Python+PyWin32, when I want access to properties (attributes) containing some characters no-Ascii (e.g. letters with accents, or unicode characters), Python screech! I need this in bridges Python-Javascript (via ActiveScripting or via drive InternetExplorer.Application). When I control the Javascript side, I make a little function who return (a pointer on) the object ; if the attribute is an object. But, if you know a way for access to these kind of attributes, I will read your answer, with mental thanks. @-salutations Michel Claveau (sorry for my bad english) From tomer.ha at gmail.com Sat Mar 31 16:59:32 2007 From: tomer.ha at gmail.com (Tomer Haimovich) Date: Sat, 31 Mar 2007 16:59:32 +0200 Subject: [python-win32] Using Simple MAPI with MS Outlook 2007 Message-ID: <3ec6a7b90703310759h514e28c1m65b78a12269aa1be@mail.gmail.com> Hi there, I'd like to send emails from a Python program using Simple MAPI. I've tried this code: http://mail.python.org/pipermail/python-list/2004-December/298066.html and it works well with Outlook Express 6 and Thunderbird 1.5, but it doens't work at all with Microsoft Outlook 2007. I keep getting this message: "WindowsError: MAPI error 2". I don't want to use Extended MAPI because it doesn't support thunderbird not OE. Therefore, Simple MAPI is the only option for me. So, what did I miss here? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20070331/17178ae0/attachment.html