From somesh at qviqsoft.com Fri Apr 2 05:41:38 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Fri Apr 2 05:39:56 2004 Subject: [python-win32] GUI Rad for Python win32 Message-ID: <003901c4189f$18932660$436a640a@qsoft25> can n e on esuggest best way to develope Rapid Applications with Python+win32all for windows platform ? Somesh Bartakke Q-Soft Pvt Ltd,Pune. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040402/864c35fb/attachment.html From jkreps at rev.state.ne.us Fri Apr 2 08:20:05 2004 From: jkreps at rev.state.ne.us (jkreps@rev.state.ne.us) Date: Fri Apr 2 08:23:17 2004 Subject: [python-win32] GUI Rad for Python win32 Message-ID: Boa_constructor ============ JLK "Somesh Bartakke" > cc: Sent by: Subject: [python-win32] GUI Rad for Python win32 python-win32-bounces @python.org 04/02/2004 04:41 AM Please respond to Somesh Bartakke can n e on esuggest best way to develope Rapid Applications with Python+win32all for windows platform ? Somesh Bartakke Q-Soft Pvt Ltd,Pune._______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From tony at tcapp.com Fri Apr 2 12:35:07 2004 From: tony at tcapp.com (Tony Cappellini) Date: Fri Apr 2 12:35:13 2004 Subject: [python-win32] Re: Python-win32 Digest, Vol 13, Issue 2 In-Reply-To: Message-ID: <20040402093117.Y4956-100000@yamato.yamato.com> > Date: Fri, 2 Apr 2004 16:11:38 +0530 > From: "Somesh Bartakke" > Subject: [python-win32] GUI Rad for Python win32 > To: > Message-ID: <003901c4189f$18932660$436a640a@qsoft25> > Content-Type: text/plain; charset="iso-8859-1" > > can n e on esuggest best way to develope Rapid Applications with Python+win32all > for windows platform ? Black Adder / pyQT Take a look at some of Doug Bell's applications, which use QT/pyQT http://bellz.org/progs.html Actually- Doug doesn't use Black Adder for his GUI dev- he does it manually. From koliphant at qwest.net Fri Apr 2 12:59:25 2004 From: koliphant at qwest.net (Kerry Oliphant) Date: Fri Apr 2 12:58:43 2004 Subject: [python-win32] GUI Rad for Python win32 In-Reply-To: <003901c4189f$18932660$436a640a@qsoft25> Message-ID: If you are interested in using the Windows API (i.e. win32all) and not some other API like wxWindows you can use Microsoft Visual Studio to design all of your dialog boxes, etc. and then create a dll with just the resources from Visual Studio in it. Then within your python code you call win32ui.LoadLibrary to load the resources and use them. This is not really a RAD solution but it works pretty well and it does the hardest part for you (the layout of the dialog boxes.) You still have to manually add code to actually use the dialog resources but this is straight forward and you can start with the examples in win32all to get going pretty quickly. If you are interested in going this route I can send you some example code of how I do it. Also look at Mark Hammond and Andy Robinson's "Python Programming on Win32" book, Chapter 20 in particular. Kerry -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Somesh Bartakke Sent: Friday, April 02, 2004 3:42 AM To: python-win32@python.org Subject: [python-win32] GUI Rad for Python win32 can n e on esuggest best way to develope Rapid Applications with Python+win32all for windows platform ? Somesh Bartakke Q-Soft Pvt Ltd,Pune. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040402/11558d62/attachment.html From kbond at free.fr Fri Apr 2 14:33:22 2004 From: kbond at free.fr (kbond) Date: Fri Apr 2 14:33:33 2004 Subject: [python-win32] Practical Question Message-ID: <406DC002.9030808@free.fr> Hello, Yesterday I sent to this list a message with a zip attach to it (59 Ko) with an application in it but for some reason I cannot see the message on the list. I guess It was moderate because of the attachment. I am trying again without the zip if people are interested by the source code please do not hesitate to request it. Thank you for your help. Here it is a copy of my previous mail: Hello, I am quite new to python and I have complete my first useful application. I am not really sure that I am sending to right list if this is a mistake I am sorry. This tiny application is using wxpython, win32com, py2exe and of course python. This is exactly my problem I am sure there is something wrong in design of this application but I cannot tell what. The objective of this application is to glue together several PowerPoint files and to add a Table of content which is really painful to build for a powerpoint containing several hundreds of slides It is really important to be able to either launch it from a cmd prompt or to use it through a GUI. You will find below the point I want to improve of course if there is more please do not hesitate: - How to call pptGlue.py from the user interface till now I am doing it using os.popen2 as below: os.popen2("pptGlue.exe " + " ".join(commandLine) +" -n" + mergedPptFile) There is several problems with this way of doing: The first one I need to write the exact name of the program, the extension is important. I mean the code can only work before I launch py2exe, if it is pptGlue.py, or after if it is pptGlue.exe. I would like to have some thing more generic. - Another problem with this call is that I didn't not find out a way to display the error message in a dialog box if there is some errors neither to send a dialog box if everything went fine. - The function that is building the TOC is not working if there is a "..." a title of a slide composing the TOC. It is because "..." seems to be propriatary char in MS powerpoint and I cannot print it using the python "print" command. This is also important for me because in some cases I am just building the TOC in a command prompt to send the result to a text file. Thank you for your help if this application can be useful to some of you I would be more than happy. From rasjidw at openminddev.net Fri Apr 2 18:01:17 2004 From: rasjidw at openminddev.net (Rasjid Wilcox) Date: Fri Apr 2 18:03:29 2004 Subject: [python-win32] GUI Rad for Python win32 In-Reply-To: <003901c4189f$18932660$436a640a@qsoft25> References: <003901c4189f$18932660$436a640a@qsoft25> Message-ID: <200404030901.17046.rasjidw@openminddev.net> On Friday 02 April 2004 20:41, Somesh Bartakke wrote: > can n e on esuggest best way to develope Rapid Applications with > Python+win32all for windows platform ? Google: 'python ide' Some possible IDE's include: Boa Constructor * Eric3 Wing IDE BlackAdder PythonCard * SPE (Stani's Python Editor) * * I have tried these - they are all wxPython based, and are mostly developed on Windows. Also see: http://www.python.org/cgi-bin/moinmoin/IntegratedDevelopmentEnvironments Cheers, Rasjid. -- Rasjid Wilcox Canberra, Australia (UTC +10 hrs) http://www.openminddev.net From mhammond at keypoint.com.au Fri Apr 2 21:30:34 2004 From: mhammond at keypoint.com.au (Mark Hammond) Date: Fri Apr 2 21:31:13 2004 Subject: [python-win32] GUI Rad for Python win32 In-Reply-To: <003901c4189f$18932660$436a640a@qsoft25> Message-ID: <100401c41923$a5524ac0$0200a8c0@eden> The SpamBayes project developed a cool ".rc" parser, which it uses for dialogs and bitmaps. I'm stealing this code for win32all, and it will be in the next version. The basic idea is that you use MSVC (or any other dialog editor that can creates Windows .rc files), and use the resources directly from this .rc file. There is no need to compile these resources to a .dll - just supply the MSVC generated .rc file. There is also an option to generate a .py file from the .rc file, useful in py2exe type applications. While SpamBayes doesn't provide a true RAD solution, it does have a fairly generic dialog system. All configuration variables have basic metadata (such as the data-type, help-text, etc), and the dialog system uses a map of control_id->option_id to deliver a system where new configuration variables or dialogs require almost no code. If anyone is interested in checking it out, let me know, and I will point out the specific SpamBayes source files worth looking at. Mark. -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Somesh Bartakke Sent: Friday, 2 April 2004 8:42 PM To: python-win32@python.org Subject: [python-win32] GUI Rad for Python win32 can n e on esuggest best way to develope Rapid Applications with Python+win32all for windows platform ? Somesh Bartakke Q-Soft Pvt Ltd,Pune. From somesh at qviqsoft.com Mon Apr 5 00:32:41 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Mon Apr 5 00:33:09 2004 Subject: [python-win32] GUI Rad for Python win32 References: Message-ID: <004b01c41ac7$59438db0$436a640a@qsoft25> thanx to all you replying me instantly, am looking for win32 specific RAD so Boa + wxGlade+ SpecTix are Not useful for me. This suggestion by 'kno' is seems to be good idea for me. if possible plz source code, demo make available for me, i tried small dialog with the method 'Rsource only dll' but "Unable to show Menu on dialog" plz let me know wot is problem with my dll ? am new to win32 platform !! >If you are interested in using the Windows API (i.e. win32all) and not some other API like >wxWindows you can use Microsoft Visual Studio to design all of your dialog boxes, etc. and >then create a dll with just the resources from Visual Studio in it. Then within your python code >you call win32ui.LoadLibrary to load the resources and use them. >i tried same... >This is not really a RAD solution but it works pretty well and it does the hardest part for you >>>(the layout of the dialog boxes.) You still have to manually add code to actually use the >dialog resources but this is straight forward and you can start with the examples in win32all to >get going pretty quickly. If you are interested in going this route I can send you some example >code of how I do it. Also look at Mark Hammond and Andy Robinson's "Python Programming >on Win32" book, Chapter 20 in particular. Mark has put some lines and raised curiosity of next release, he should have been in the marketing team of M$ :) (plz dont mind on comments ) but am really curious @ next release @ using .rc file, is it possible for me to use it from SpamBayes directly ? how ? its really gr8 interactive group ! somesh Q-Soft Pvt Ltd, Pune-India From somesh at qviqsoft.com Mon Apr 5 01:40:57 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Mon Apr 5 01:39:20 2004 Subject: [python-win32] Visual basic frm files 4 win32gui Message-ID: <000a01c41ad0$97df2580$436a640a@qsoft25> is it possible to use Visual basic frm files in my python win32 project for gui ? if , how its should be ? Somesh Bartakke Q-Soft Pvt Ltd,Pune. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040405/fde5b8e1/attachment.html From jkreps at rev.state.ne.us Mon Apr 5 08:51:26 2004 From: jkreps at rev.state.ne.us (jkreps@rev.state.ne.us) Date: Mon Apr 5 08:54:29 2004 Subject: [python-win32] GUI Rad for Python win32 Message-ID: Actually, Boa is better on the Windows platform than it is on the Linux platform. And, there is py2exe, which converts your app.py to app.exe, which doesn't require the python engine be installed on the client machine. ============ JLK "Somesh Bartakke" > cc: python-win32@python.org Sent by: Subject: Re: [python-win32] GUI Rad for Python win32 python-win32-bounces @python.org 04/04/2004 11:32 PM Please respond to Somesh Bartakke thanx to all you replying me instantly, am looking for win32 specific RAD so Boa + wxGlade+ SpecTix are Not useful for me. This suggestion by 'kno' is seems to be good idea for me. if possible plz source code, demo make available for me, i tried small dialog with the method 'Rsource only dll' but "Unable to show Menu on dialog" plz let me know wot is problem with my dll ? am new to win32 platform !! >If you are interested in using the Windows API (i.e. win32all) and not some other API like >wxWindows you can use Microsoft Visual Studio to design all of your dialog boxes, etc. and >then create a dll with just the resources from Visual Studio in it. Then within your python code >you call win32ui.LoadLibrary to load the resources and use them. >i tried same... >This is not really a RAD solution but it works pretty well and it does the hardest part for you >>>(the layout of the dialog boxes.) You still have to manually add code to actually use the >dialog resources but this is straight forward and you can start with the examples in win32all to >get going pretty quickly. If you are interested in going this route I can send you some example >code of how I do it. Also look at Mark Hammond and Andy Robinson's "Python Programming >on Win32" book, Chapter 20 in particular. Mark has put some lines and raised curiosity of next release, he should have been in the marketing team of M$ :) (plz dont mind on comments ) but am really curious @ next release @ using .rc file, is it possible for me to use it from SpamBayes directly ? how ? its really gr8 interactive group ! somesh Q-Soft Pvt Ltd, Pune-India _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From rasjidw at openminddev.net Mon Apr 5 09:28:36 2004 From: rasjidw at openminddev.net (Rasjid Wilcox) Date: Mon Apr 5 09:28:46 2004 Subject: [python-win32] GUI Rad for Python win32 In-Reply-To: <004b01c41ac7$59438db0$436a640a@qsoft25> References: <004b01c41ac7$59438db0$436a640a@qsoft25> Message-ID: <200404052328.36779.rasjidw@openminddev.net> On Monday 05 April 2004 14:32, Somesh Bartakke wrote: > thanx to all you replying me instantly, > am looking for win32 specific RAD so Boa + wxGlade+ SpecTix are Not useful > for me. I don't see why not. As far as I know both Boa and PythonCard are primarily developed (and used) on Windows. Stani's Python Editor (SPE) is developed on Windows only. Using these tools just means that you can write cross-platform code if you choose to do so. It does not mean you have to. You can still use the win32all libraries (or pywin32 as I believe that it is called now) with any of the above tools. Your code will no longer be portable, but you will get quite deep access to the windows api. And as JLK says, you can use py2exe to create standalone Python executables. If you are looking for something similar to Visual Basic but for Python, then either BoaConstructor or possibly PythonCard are what you are after. Cheers, Rasjid. -- Rasjid Wilcox Canberra, Australia (UTC +10 hrs) http://www.openminddev.net From koliphant at qwest.net Mon Apr 5 10:54:40 2004 From: koliphant at qwest.net (Kerry Oliphant) Date: Mon Apr 5 10:53:55 2004 Subject: [python-win32] GUI Rad for Python win32 In-Reply-To: <004b01c41ac7$59438db0$436a640a@qsoft25> Message-ID: Somesh, In order to create a menu you have to have a SDI or MDI application with a mainframe. You cannot have a generalized menu in a simple dialog box (at least not using the standard menu system) I use the technique I described for dialog based application that do not have menus. If you want menus and you still want to use only win32all you will have to do even more hand coding. Look at the python files that come with Pythonwin. That will show you what you have to do. Start with the file pywin\framework\app.py. I have not actually done it myself. If you are really new to win32 programming I would probably go the visual basic route to build your GUI. Then develop COM objects in python that the visual basic GUI can access. Again, Mark and Andy's book shows you how to do this. best of luck, Kerry -----Original Message----- From: Somesh Bartakke [mailto:somesh@qviqsoft.com] Sent: Sunday, April 04, 2004 10:33 PM To: kno@conceptsnrec.com Cc: python-win32@python.org Subject: Re: [python-win32] GUI Rad for Python win32 thanx to all you replying me instantly, am looking for win32 specific RAD so Boa + wxGlade+ SpecTix are Not useful for me. This suggestion by 'kno' is seems to be good idea for me. if possible plz source code, demo make available for me, i tried small dialog with the method 'Rsource only dll' but "Unable to show Menu on dialog" plz let me know wot is problem with my dll ? am new to win32 platform !! >If you are interested in using the Windows API (i.e. win32all) and not some other API like >wxWindows you can use Microsoft Visual Studio to design all of your dialog boxes, etc. and >then create a dll with just the resources from Visual Studio in it. Then within your python code >you call win32ui.LoadLibrary to load the resources and use them. >i tried same... >This is not really a RAD solution but it works pretty well and it does the hardest part for you >>>(the layout of the dialog boxes.) You still have to manually add code to actually use the >dialog resources but this is straight forward and you can start with the examples in win32all to >get going pretty quickly. If you are interested in going this route I can send you some example >code of how I do it. Also look at Mark Hammond and Andy Robinson's "Python Programming >on Win32" book, Chapter 20 in particular. Mark has put some lines and raised curiosity of next release, he should have been in the marketing team of M$ :) (plz dont mind on comments ) but am really curious @ next release @ using .rc file, is it possible for me to use it from SpamBayes directly ? how ? its really gr8 interactive group ! somesh Q-Soft Pvt Ltd, Pune-India From cedric.delfosse at linbox.com Mon Apr 5 12:12:13 2004 From: cedric.delfosse at linbox.com (Cedric Delfosse) Date: Mon Apr 5 12:12:11 2004 Subject: [python-win32] Getting PID of process launched by Dispatch Message-ID: <1081181533.32449.169.camel@ovro.freealter.fr> Hello, I use automation to convert Word documents to other formats. Sometimes, Word has problems with some corrupted documents, and loops until I kill it. I'd like to kill it automatically from my program, but I need to get the Word Process ID first. I launch Word the traditional way you all know: app = win32com.client.DispatchEx('Word.Application') Now is it possible to get winword.exe PID from the "app" variable ? Regards, -- C?dric Delfosse Linbox / Free&ALter Soft 152, rue de Grigy - Technopole Metz 57070 Metz - FRANCE t?l: +33 (0)3 87 50 87 90 http://linbox.com From tony at tcapp.com Mon Apr 5 17:24:06 2004 From: tony at tcapp.com (Tony Cappellini) Date: Mon Apr 5 17:24:08 2004 Subject: [python-win32] re: Visual Basic frm files for win32gui In-Reply-To: Message-ID: <20040405141545.E84918-100000@yamato.yamato.com> > > is it possible to use Visual basic frm files in my python win32 project for gui ? > if , how its should be ? > You could probably write your own Python code to parse thru a VB frm file, but tha would assume you know everything about the possible contents of a frm file, and I don't think even Microsoft knows that. But the FRM files often (but not always) depend on the FRX files. You may want to look into VB2Py, which attempts to convert VB projects nto Python code, but unfortunately this uses PythonCard, which relies on wxPython. VB2Py feautes an online version, so you can try to convert your VB project to Python using a web page. VB2Py is still in beta (or Alpha). However, it does give you some options to look at. I think the suggestion to do your gui in VB, and call Python via COM is a good idea, and eliminates the issues with Python GUIs, which will get you to an end result much sooner. Tony From somesh at qviqsoft.com Tue Apr 6 00:29:47 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Tue Apr 6 00:28:08 2004 Subject: [python-win32] GUI Rad for Python win32 References: Message-ID: <000d01c41b8f$d05485d0$436a640a@qsoft25> > In order to create a menu you have to have a SDI or MDI application with a > mainframe. You cannot have a generalized menu in a simple dialog box (at > least not using the standard menu system) I use the technique I described in VC++ dialog we can attach menu thru property dialog , is it ?i attached it to mydialogue box even when am using it with exe prog it worx fine > If you are really new to win32 programming I would probably go the visual > basic route to build your GUI. Then develop COM objects in python that the > visual basic GUI can access. Again, Mark and Andy's book shows you how to > do this. at present i dont have copy of this book, may get within 15 days, can you send me sample app with VB proj etc with a single form ? plz .. somesh Q-Soft Pvt Ltd, Pune-India From schnijders at home.nl Tue Apr 6 06:31:17 2004 From: schnijders at home.nl (Schneider) Date: Tue Apr 6 06:22:42 2004 Subject: [python-win32] Re: Yet another python-com bridge (wincom.pyd) In-Reply-To: Message-ID: Hi Lijun, I started using your com interface today and had both success and problems. First of all, the wincom module did not want to load since the MSVCR71.DLL and MSVCP71.DLL were missing on my machine. After installing these, some probelms I had with win32com (VARIANT* Value parameters) seem to be solved. However, now I run into problems with the system complaining about missing parameters. In the win32com situation the code for k in range(sofon.project.Count): print k pos = sofon.project.Item(k) worked fine. Now I get the error: Traceback (most recent call last): File "L:\InvoiceSofon\invoiceSofonMainFrame.py", line 459, in OnFilemenuitems2Menu printRec(odbc, sofon, self.invoiceOverviewListCtrl, Index) File "L:\InvoiceSofon\invoiceSofonFunctopns.py", line 162, in printRec pos = sofon.project.Item[k] wincom.COMError: hr = 0x8002000f (Parameter niet optioneel. ) The error says 'Parameter not optional.' Do you have any suggestions?? Frans -----Oorspronkelijk bericht----- Van: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]Namens Lijun Qin Verzonden: dinsdag 30 maart 2004 3:24 Aan: python-win32@python.org Onderwerp: [python-win32] Re: Yet another python-com bridge (wincom.pyd) Sorry, the link is http://www.solidshare.com/python/wincom.zip "Lijun Qin" wrote in message news:008f01c4146c$db3873f0$0200a8c0@huhu... > Hi all, > > Here is my own python-com bridge (named wincom), which support Python at as > both server and client side, support C++ access python use vtable interface > when the interface is a dual interface (similar to universal_gateway featuer > of win32all). > One of the feature of wincom is that there is only a simple pyd file > (wincom.pyd, and runtime boost_python23.dll) to deply, unlike win32-all > package you'll need deploy a whole package. > Another feature of wincom is that it's use is quite simple, a typelib is in > the center, and all objects in the typelib can be easily imported, like > this: > > import wincom > msxml = wincom.typelib('{F5078F18-C551-11D3-89B9-0000F81FE221}', 4, 0) > > after these lines, all objects in the msxml4.0 typelib can be easily > accessed, like this: > > self.dom = msxml.DOMDocument40() #create a CoClass use it's name > if not self.dom.load(file_name): > raise RuntimeError, "load xml file failed" > > self.node = self.dom.documentElement #COM object property mapped to > python attribute > self.id = self.node.getAttribute('id') #COM object function > mapped to python method > > self.my_objs = [] > for my_obj_node in self.node.selectNodes("//my_obj"): #COM enumratable > mapped to python iter object > self.my_objs.append(my_obj_class(self, my_obj_node)) > > You can download the file from http://www.solidshare.com/python/wincom.pyd, > source file is not included, but if peoples like it, I'll consider setup a > project in sourceforge or somewhere else. > > Lijun Qin _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From koliphant at qwest.net Tue Apr 6 13:30:19 2004 From: koliphant at qwest.net (Kerry Oliphant) Date: Tue Apr 6 13:29:30 2004 Subject: [python-win32] GUI Rad for Python win32 In-Reply-To: <000d01c41b8f$d05485d0$436a640a@qsoft25> Message-ID: Somesh, I have never attached a menu to a dialog box. I know that there is place in Visual Studio to assign a menu resource to a dialog box. I have never done it though. I tried once to get a menu on my main dialog of a dialog App but I was not successfull. If anyone has ever done this I would be interested in hearing about it. Reading the Microsoft docs seems to imply that it cannot be done. At least not easily. Have you seen the sample chapters online for Mark and Andy's book. You should be able to use Chapter 12 to get you going on the COM link with VB. I do not have VB and so I have never actually created a GUI in VB and linked it with python in this way. Chapter 20 shows you how to do it the way that I described earlier. I recommend you still buy the book though. http://www.oreilly.com/catalog/pythonwin32/chapter/index.html Kerry -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Somesh Bartakke Sent: Monday, April 05, 2004 10:30 PM To: kno@conceptsnrec.com Cc: python-win32@python.org Subject: Re: [python-win32] GUI Rad for Python win32 > In order to create a menu you have to have a SDI or MDI application with a > mainframe. You cannot have a generalized menu in a simple dialog box (at > least not using the standard menu system) I use the technique I described in VC++ dialog we can attach menu thru property dialog , is it ?i attached it to mydialogue box even when am using it with exe prog it worx fine > If you are really new to win32 programming I would probably go the visual > basic route to build your GUI. Then develop COM objects in python that the > visual basic GUI can access. Again, Mark and Andy's book shows you how to > do this. at present i dont have copy of this book, may get within 15 days, can you send me sample app with VB proj etc with a single form ? plz .. somesh Q-Soft Pvt Ltd, Pune-India _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From qinlj at solidshare.com Tue Apr 6 21:56:45 2004 From: qinlj at solidshare.com (Lijun Qin) Date: Tue Apr 6 21:57:33 2004 Subject: [python-win32] Re: Re: Yet another python-com bridge (wincom.pyd) References: Message-ID: Hi, You can try to use: sofon.project[k] or sofon.project.Item(k) also, if you have typelib, import it first, like this: tlb = wincom.typelib('{XXXXXXXXXXXXXXXXXXXXX}', Major_type_lib_ver, Minor_type_lib_ver) and create the object through it, like this: obj = tlb.coclass_name() wincom will works better if it can get the typelib information, otw, it'll have to guess in some situation, and it can be wrong. current wincom.pyd does have some missing features, including: Optional parameters is not supported pure VTable interface is not supported yet, it must be dual module and struct object in typelib is not supported they are not there mainly because they are not needed in my current project, and in the next 3-6 monthes, I'll have no time to work on this, but normally you can live without them, I think. Lijun Qin "Schneider" wrote in message news:DOEOLMOIEEOCCNPCIBBPMEKECAAA.schnijders@home.nl... > Hi Lijun, > > I started using your com interface today and had both success and problems. > > First of all, the wincom module did not want to load since the MSVCR71.DLL > and MSVCP71.DLL were missing on my machine. After installing these, some > probelms I had with win32com (VARIANT* Value parameters) seem to be solved. > However, now I run into problems with the system complaining about missing > parameters. > In the win32com situation the code > > for k in range(sofon.project.Count): > print k > pos = sofon.project.Item(k) > > worked fine. Now I get the error: > > Traceback (most recent call last): > File "L:\InvoiceSofon\invoiceSofonMainFrame.py", line 459, in > OnFilemenuitems2Menu > printRec(odbc, sofon, self.invoiceOverviewListCtrl, Index) > File "L:\InvoiceSofon\invoiceSofonFunctopns.py", line 162, in printRec > pos = sofon.project.Item[k] > wincom.COMError: hr = 0x8002000f (Parameter niet optioneel. ) > > The error says 'Parameter not optional.' > > Do you have any suggestions?? > > Frans > > -----Oorspronkelijk bericht----- > Van: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]Namens Lijun Qin > Verzonden: dinsdag 30 maart 2004 3:24 > Aan: python-win32@python.org > Onderwerp: [python-win32] Re: Yet another python-com bridge (wincom.pyd) > > > Sorry, the link is http://www.solidshare.com/python/wincom.zip > > > "Lijun Qin" wrote in message > news:008f01c4146c$db3873f0$0200a8c0@huhu... > > Hi all, > > > > Here is my own python-com bridge (named wincom), which support Python at > as > > both server and client side, support C++ access python use vtable > interface > > when the interface is a dual interface (similar to universal_gateway > featuer > > of win32all). > > One of the feature of wincom is that there is only a simple pyd file > > (wincom.pyd, and runtime boost_python23.dll) to deply, unlike win32-all > > package you'll need deploy a whole package. > > Another feature of wincom is that it's use is quite simple, a typelib is > in > > the center, and all objects in the typelib can be easily imported, like > > this: > > > > import wincom > > msxml = wincom.typelib('{F5078F18-C551-11D3-89B9-0000F81FE221}', 4, 0) > > > > after these lines, all objects in the msxml4.0 typelib can be easily > > accessed, like this: > > > > self.dom = msxml.DOMDocument40() #create a CoClass use it's name > > if not self.dom.load(file_name): > > raise RuntimeError, "load xml file failed" > > > > self.node = self.dom.documentElement #COM object property mapped to > > python attribute > > self.id = self.node.getAttribute('id') #COM object function > > mapped to python method > > > > self.my_objs = [] > > for my_obj_node in self.node.selectNodes("//my_obj"): #COM enumratable > > mapped to python iter object > > self.my_objs.append(my_obj_class(self, my_obj_node)) > > > > You can download the file from > http://www.solidshare.com/python/wincom.pyd, > > source file is not included, but if peoples like it, I'll consider setup a > > project in sourceforge or somewhere else. > > > > Lijun Qin > > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From somesh at qviqsoft.com Wed Apr 7 01:30:39 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Wed Apr 7 01:29:03 2004 Subject: [python-win32] spy - communication with any windows app Message-ID: <000701c41c61$7b668be0$436a640a@qsoft25> i was trying with Spy ++ utility i got with my Visula studio 6 installation. it gets with Any application, and traps all msg etc. shall i write such utility ? or is there any method by which i will get control of any app window in my python program ? is it something called Hooking ? how to do it, plz, i think its an interesting stuff is it? to play with win32 applications and to hack them thru python . Somesh Bartakke From somesh at qviqsoft.com Wed Apr 7 03:36:01 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Wed Apr 7 03:34:22 2004 Subject: [python-win32] Deploying COM References: Message-ID: <001401c41c72$feeb75f0$436a640a@qsoft25> > Have you seen the sample chapters online for Mark and Andy's book. You > should be able to use Chapter 12 to get you going on the COM link with VB. > I do not have VB and so I have never actually created a GUI in VB and linked > it with python in this way. Chapter 20 shows you how to do it the way that > I described earlier. I recommend you still buy the book though. > http://www.oreilly.com/catalog/pythonwin32/chapter/index.html Thanx kelly, i gone thru sample lesson on COM, i never think that "COM should be as eazy as Mark made it thru Python" 1- ce again thanX to Mark and Python, i wanna know how to deploye my script with py2exe ? how it will self register when frozen with py2exe ? for example i write script "mycom.py" which also contains self reg code. i write setup.py with the help of Thomas Hellers py2exe pkg as following : #setup.py started from distutils.core import setup import py2exe setup(com_server=["mycom"]) i got ditro package in directory 'dist', my que is weather i wrote Right script ? and how my COM will get register with system ? for that i have to provide extra code ? plz guide me . From schnijders at home.nl Wed Apr 7 05:40:48 2004 From: schnijders at home.nl (Schneider) Date: Wed Apr 7 05:32:13 2004 Subject: [python-win32] Re: Re: Yet another python-com bridge (wincom.pyd) In-Reply-To: Message-ID: Hi, Actually, I did load the type library already and tried the sofon.project.Item[k] method as well. Still the same error. Could it be that the parameter k is passed to the COM interface as a optional parameter? Sofon wants a integer parameter for the Item index. Frans -----Oorspronkelijk bericht----- Van: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]Namens Lijun Qin Verzonden: woensdag 7 april 2004 3:57 Aan: python-win32@python.org Onderwerp: [python-win32] Re: Re: Yet another python-com bridge (wincom.pyd) Hi, You can try to use: sofon.project[k] or sofon.project.Item(k) also, if you have typelib, import it first, like this: tlb = wincom.typelib('{XXXXXXXXXXXXXXXXXXXXX}', Major_type_lib_ver, Minor_type_lib_ver) and create the object through it, like this: obj = tlb.coclass_name() wincom will works better if it can get the typelib information, otw, it'll have to guess in some situation, and it can be wrong. current wincom.pyd does have some missing features, including: Optional parameters is not supported pure VTable interface is not supported yet, it must be dual module and struct object in typelib is not supported they are not there mainly because they are not needed in my current project, and in the next 3-6 monthes, I'll have no time to work on this, but normally you can live without them, I think. Lijun Qin "Schneider" wrote in message news:DOEOLMOIEEOCCNPCIBBPMEKECAAA.schnijders@home.nl... > Hi Lijun, > > I started using your com interface today and had both success and problems. > > First of all, the wincom module did not want to load since the MSVCR71.DLL > and MSVCP71.DLL were missing on my machine. After installing these, some > probelms I had with win32com (VARIANT* Value parameters) seem to be solved. > However, now I run into problems with the system complaining about missing > parameters. > In the win32com situation the code > > for k in range(sofon.project.Count): > print k > pos = sofon.project.Item(k) > > worked fine. Now I get the error: > > Traceback (most recent call last): > File "L:\InvoiceSofon\invoiceSofonMainFrame.py", line 459, in > OnFilemenuitems2Menu > printRec(odbc, sofon, self.invoiceOverviewListCtrl, Index) > File "L:\InvoiceSofon\invoiceSofonFunctopns.py", line 162, in printRec > pos = sofon.project.Item[k] > wincom.COMError: hr = 0x8002000f (Parameter niet optioneel. ) > > The error says 'Parameter not optional.' > > Do you have any suggestions?? > > Frans > > -----Oorspronkelijk bericht----- > Van: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]Namens Lijun Qin > Verzonden: dinsdag 30 maart 2004 3:24 > Aan: python-win32@python.org > Onderwerp: [python-win32] Re: Yet another python-com bridge (wincom.pyd) > > > Sorry, the link is http://www.solidshare.com/python/wincom.zip > > > "Lijun Qin" wrote in message > news:008f01c4146c$db3873f0$0200a8c0@huhu... > > Hi all, > > > > Here is my own python-com bridge (named wincom), which support Python at > as > > both server and client side, support C++ access python use vtable > interface > > when the interface is a dual interface (similar to universal_gateway > featuer > > of win32all). > > One of the feature of wincom is that there is only a simple pyd file > > (wincom.pyd, and runtime boost_python23.dll) to deply, unlike win32-all > > package you'll need deploy a whole package. > > Another feature of wincom is that it's use is quite simple, a typelib is > in > > the center, and all objects in the typelib can be easily imported, like > > this: > > > > import wincom > > msxml = wincom.typelib('{F5078F18-C551-11D3-89B9-0000F81FE221}', 4, 0) > > > > after these lines, all objects in the msxml4.0 typelib can be easily > > accessed, like this: > > > > self.dom = msxml.DOMDocument40() #create a CoClass use it's name > > if not self.dom.load(file_name): > > raise RuntimeError, "load xml file failed" > > > > self.node = self.dom.documentElement #COM object property mapped to > > python attribute > > self.id = self.node.getAttribute('id') #COM object function > > mapped to python method > > > > self.my_objs = [] > > for my_obj_node in self.node.selectNodes("//my_obj"): #COM enumratable > > mapped to python iter object > > self.my_objs.append(my_obj_class(self, my_obj_node)) > > > > You can download the file from > http://www.solidshare.com/python/wincom.pyd, > > source file is not included, but if peoples like it, I'll consider setup a > > project in sourceforge or somewhere else. > > > > Lijun Qin > > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From koliphant at qwest.net Wed Apr 7 10:23:26 2004 From: koliphant at qwest.net (Kerry Oliphant) Date: Wed Apr 7 10:22:37 2004 Subject: [python-win32] Deploying COM In-Reply-To: <001401c41c72$feeb75f0$436a640a@qsoft25> Message-ID: Somesh, The py2exe installation has a samples directory. Use the 'advanced' sample for help in creating a distribution for a COM server. To register the server you need to run a script that registers the server as explained in Chapter 12. You can also look at the COM server example in 'advanced'. Using 'distutils' you can create an installation package that will let you run the registration script on installation. You could also create an exe out of the registration script in the same py2exe setup that packages up the COM server. Kerry -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Somesh Bartakke Sent: Wednesday, April 07, 2004 1:36 AM To: kno@conceptsnrec.com Cc: python-win32@python.org Subject: [python-win32] Deploying COM > Have you seen the sample chapters online for Mark and Andy's book. You > should be able to use Chapter 12 to get you going on the COM link with VB. > I do not have VB and so I have never actually created a GUI in VB and linked > it with python in this way. Chapter 20 shows you how to do it the way that > I described earlier. I recommend you still buy the book though. > http://www.oreilly.com/catalog/pythonwin32/chapter/index.html Thanx kelly, i gone thru sample lesson on COM, i never think that "COM should be as eazy as Mark made it thru Python" 1- ce again thanX to Mark and Python, i wanna know how to deploye my script with py2exe ? how it will self register when frozen with py2exe ? for example i write script "mycom.py" which also contains self reg code. i write setup.py with the help of Thomas Hellers py2exe pkg as following : #setup.py started from distutils.core import setup import py2exe setup(com_server=["mycom"]) i got ditro package in directory 'dist', my que is weather i wrote Right script ? and how my COM will get register with system ? for that i have to provide extra code ? plz guide me . _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From janez.jere at void.si Thu Apr 8 18:54:56 2004 From: janez.jere at void.si (Janez Jere) Date: Thu Apr 8 18:52:35 2004 Subject: [python-win32] com server running in taskbar Message-ID: Hello com masters, I want to know if it is possible to implement a com server, which will not just start automatically via pythonw, but will be part of larger application. For example: there should be a gui application macro.py (like win32\demos\win32gui_taskbar.py), which among other things serves com objects (SanMacro). I implemented simple com server, which is working fine except: - it is terminated when last reference of SanMacro is released - it is not working as taskbar app is it possible to make a server a taskbar app, which will not terminate after last instance of SanMacto will be deleted? Thanks in advance Janez ################### # this is com server: macro.py import pythoncom cnt = 0 # common resource class SanMacro: _public_methods_ = [ 'execScript' ] _reg_clsctx_= pythoncom.CLSCTX_LOCAL_SERVER _reg_clsid_ = "{65329968-260C-458A-9B0C-AF543EB782EE}" _reg_progid_ = "jj.san.macro" def execScript(self, script): global cnt cnt +=1 m = "cnt: %s" % cnt print m, script return m if __name__ == '__main__': import win32com.server.register win32com.server.register.UseCommandLine(SanMacro) # and now run it in taskbar (this is notworking, but i would like to) import win32.Demos.win32gui_taskbar # notepad __init__.py in win32 & Demos folder, to make it package win32.Demos.win32gui_taskbar.main() ################## # client script: from win32com.client import Dispatch print Dispatch("jj.san.macro").execScript('test') From tony at tcapp.com Mon Apr 12 00:09:20 2004 From: tony at tcapp.com (Tony Cappellini) Date: Mon Apr 12 00:09:34 2004 Subject: [python-win32] Python app-> to systray In-Reply-To: References: Message-ID: <6.0.0.22.0.20040411210420.01c49068@tcapp.com> Is it possible to make a Python app minimize to the systray- as opposed to the taskbar ? From tony at tcapp.com Mon Apr 12 20:19:38 2004 From: tony at tcapp.com (Tony Cappellini) Date: Mon Apr 12 20:19:43 2004 Subject: [python-win32] RE: spy - communication with any windows - app In-Reply-To: Message-ID: <20040412171726.A70995-100000@yamato.yamato.com> http://sourceforge.net/project/showfiles.php?group_id=65529&package_id=92632 Somesh- take a look at Peter Parente's pyHook It doesn't work on W98- but it's A w98 issue, not Peter's code that's the problem. Somesh Bartakke wrote i was trying with Spy ++ utility i got with my Visula studio 6 installation. it gets with Any application, and traps all msg etc. shall i write such utility ? or is there any method by which i will get control of any app window in my python program ? is it something called Hooking ? how to do it, plz, i think its an interesting stuff is it? to play with win32 applications and to hack them thru python . Somesh Bartakke From tim.golden at viacom-outdoor.co.uk Tue Apr 13 04:26:56 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Tue Apr 13 04:28:23 2004 Subject: [python-win32] Python app-> to systray Message-ID: >Is it possible to make a Python app minimize to the systray- >as opposed to >the taskbar ? I think this is what you want (from Itamar Shtull-Trauring's pages): http://www.itamarst.org/software/ Search for "win32taskbar.py" TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From somesh at qviqsoft.com Tue Apr 13 06:39:02 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Tue Apr 13 06:39:04 2004 Subject: [python-win32] win32/mfc dll Message-ID: <001301c42143$c75490b0$436a640a@qsoft25> i have win32/mfc dlls which contains global functions i want to access these functions thru my python application, for that i called dll with following code from win32ui import * libc = LoadLibrary('mfc1.dll') but how to proceed next ? is it possible to work with pointers also in that dlls , shall i return mfc CPoint obj or its pointer from function in dll , plz uncurtains this ! ThanX in +vance Somesh Bartakke ----------------- Truth does not pay hamage to society, ancient or modern but society has to pay homage to truth or Die ! -Swami Vivekanand From jens.jorgensen at tallan.com Tue Apr 13 09:26:31 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Tue Apr 13 09:26:45 2004 Subject: [python-win32] win32/mfc dll In-Reply-To: <001301c42143$c75490b0$436a640a@qsoft25> References: <001301c42143$c75490b0$436a640a@qsoft25> Message-ID: <407BEA87.8020105@tallan.com> Check out the ctypes project. Somesh Bartakke wrote: >i have win32/mfc dlls which contains global functions >i want to access these functions thru my python application, for that i >called dll with following code > >from win32ui import * >libc = LoadLibrary('mfc1.dll') > >but how to proceed next ? >is it possible to work with pointers also in that dlls , shall i return mfc >CPoint obj or its pointer from function in dll , plz uncurtains this ! > >ThanX in +vance > > >Somesh Bartakke >----------------- >Truth does not pay hamage to society, ancient or modern but society has to >pay homage to truth or Die ! -Swami Vivekanand > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3108 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040413/aefed86d/smime.bin From lbates at syscononline.com Tue Apr 13 12:22:04 2004 From: lbates at syscononline.com (Larry Bates) Date: Tue Apr 13 12:22:16 2004 Subject: [python-win32] win32/mfc dll In-Reply-To: Message-ID: <035901c42173$75fa2560$5d00a8c0@LABWXP> Another alternative is one that I wrote that utilizes Sam Rushing's calldll code. I just wrote a wrapper class that I believe makes it easy to get started. I've used it to call MANY different .DLLs. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146847 You must have calldll (or dynwin) installed. It is available at: http://www.nightmare.com/~rushing/dynwin/ Regards, Larry Bates Syscon, Inc. ------------------------------ Message: 3 Date: Tue, 13 Apr 2004 16:09:02 +0530 From: "Somesh Bartakke" Subject: [python-win32] win32/mfc dll To: Message-ID: <001301c42143$c75490b0$436a640a@qsoft25> Content-Type: text/plain; charset="iso-8859-1" i have win32/mfc dlls which contains global functions i want to access these functions thru my python application, for that i called dll with following code from win32ui import * libc = LoadLibrary('mfc1.dll') but how to proceed next ? is it possible to work with pointers also in that dlls , shall i return mfc CPoint obj or its pointer from function in dll , plz uncurtains this ! ThanX in +vance Somesh Bartakke ----------------- Truth does not pay hamage to society, ancient or modern but society has to pay homage to truth or Die ! -Swami Vivekanand From tony at tcapp.com Wed Apr 14 00:43:10 2004 From: tony at tcapp.com (Tony Cappellini) Date: Wed Apr 14 00:43:14 2004 Subject: [python-win32] Registry confusion In-Reply-To: Message-ID: <20040413212757.L5483-100000@yamato.yamato.com> I've been able to read stuff from the registry via Python- but I dont understand the difference between the Key and SubKey When should I use QueryValue() vs EnumValue() ? I'm confused by the python help file for SetValue() Does SetValue() actually save the newly written value to disk- or do I have to re-write the entire registry with SaveFile() ? No matter what I try, I can't get a new value written to the registry- on Win98 The ActiveState recipes didn't help this time From tim.golden at viacom-outdoor.co.uk Wed Apr 14 04:38:38 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Apr 14 04:40:03 2004 Subject: [python-win32] Registry confusion Message-ID: >I've been able to read stuff from the registry via Python- but > >I dont understand the difference between the Key and SubKey > >When should I use QueryValue() vs EnumValue() ? > >I'm confused by the python help file for SetValue() >Does SetValue() actually save the newly written value to disk- or do I >have >to re-write the entire registry with SaveFile() ? > > >No matter what I try, I can't get a new value written to the >registry- on >Win98 Initial response -- worked example from the effbot: http://effbot.org/zone/python-register.htm TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From guido_adriaensen at hotmail.com Wed Apr 14 06:09:01 2004 From: guido_adriaensen at hotmail.com (Guido Adriaensen) Date: Wed Apr 14 06:09:10 2004 Subject: [python-win32] excel termination Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040414/4b156d0f/attachment.html From spastor at center.com Wed Apr 14 09:06:19 2004 From: spastor at center.com (sebastien Pastor) Date: Wed Apr 14 07:23:38 2004 Subject: [python-win32] excel termination In-Reply-To: References: Message-ID: <407D374B.5010708@center.com> I am using the Quit() method and it seems to work fairly well. Hope it will help Guido Adriaensen wrote: > Hello, > > > > I have a problem, I have written a programme which opens > excel,extracts some data from it and then again closes it. The problem > is when I look in taskmanager I can still see the process (excel.exe). > So it hasn't been closed, it is still running. I don't see it on my > screen but it is still there. Does anybody know how to end this > process in a proper manner. > > > > thx > > Guido Adriaensen > > > ------------------------------------------------------------------------ > Play online games with your friends with MSN Messenger > > >------------------------------------------------------------------------ > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > From tim.golden at viacom-outdoor.co.uk Wed Apr 14 06:48:51 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Apr 14 07:24:47 2004 Subject: [python-win32] excel termination Message-ID: GA> I have written a programme which opens excel, GA> extracts some data from it and then again closes it. GA> The problem is when I look in taskmanager I can still GA> see the process (excel.exe). Well it's difficult to tell without seeing exact code, but the code snippet below shows that the Excel process does close if (a) you delete the reference to the COM object (in my code, the xl variable) and (b) wait a little bit for things to catch up with themselves. I get the following output: C:\temp>excel.py 0 Excel processes running 1 Excel processes running 1 Excel processes running 0 Excel processes running TJG import win32com.client import wmi import time c = wmi.WMI () print len (c.Win32_Process (Name="excel.exe")), "Excel processes running" xl = win32com.client.Dispatch ("Excel.Application") print len (c.Win32_Process (Name="excel.exe")), "Excel processes running" # Do stuff with xl xl.Quit () time.sleep (0.5) print len (c.Win32_Process (Name="excel.exe")), "Excel processes running" del xl time.sleep (0.5) print len (c.Win32_Process (Name="excel.exe")), "Excel processes running" ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From j_h_m_smits at xs4all.nl Wed Apr 14 06:36:39 2004 From: j_h_m_smits at xs4all.nl (S. Smits) Date: Wed Apr 14 10:16:13 2004 Subject: [python-win32] excel termination In-Reply-To: References: Message-ID: <200404141236.40022.j_h_m_smits@xs4all.nl> You have to close it in your script, something like this: import win32com.client class Excel: def __init__(self, filename=None): self.xlApp = win32com.client.Dispatch('Excel.Application') if filename: self.filename = filename self.xlBook = self.xlApp.Workbooks.Open(filename) else: self.xlBook = self.xlApp.Workbooks.Add() self.filename = '' def close(self): self.xlBook.Close(SaveChanges=1) del self.xlApp Regards, Sander Smits. Op Wednesday 14 April 2004 12:09, schreef Guido Adriaensen: > I have a problem, I have written a programme which opens excel,extracts > some data from it and then again closes it. The problem is when I look in > taskmanager I can still see the process (excel.exe). So it hasn't been > closed, it is still running. I don't see it on my screen but it is still > there. Does anybody know how to end this process in a proper manner. From mmontagne at WalkerMacy.com Wed Apr 14 12:37:15 2004 From: mmontagne at WalkerMacy.com (Michael Montagne) Date: Wed Apr 14 12:37:21 2004 Subject: [python-win32] Python disappearing Message-ID: This is odd. But it has now happened 3 times. Once on WinXP and twice on win2000. I have installed python on everyones computers here at work and use it to run a login script from win2000 server. On these three occasions the scipt did not run and the reason was that Python was not installed on the computer anymore. It is not even in Add/Remove Programs anymore. I know these people did not remove the program themselves. The last time it happened right after a MS Security update. That may have been involved in the others but I don't know. -mjm -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040414/bf71831b/attachment.html From brian at ablelinktech.com Wed Apr 14 14:08:59 2004 From: brian at ablelinktech.com (Brian Brown) Date: Wed Apr 14 14:45:42 2004 Subject: [python-win32] ASP installation strangeness Message-ID: Greetings all! I wrote a fairly involved ASP app in Python 2.2 about a year and a half ago. Yesterday I was installing on some new machines for a demonstration and tried my hand at updating to python 2.3 and pywin32-200. The target machines were Windows XP/IIS 5.1. After intalling the requisite python, trying to run any ASP pages the needed python resulted in an ASP error that 'the script language python cannot be found on the server'. So I reinstalled pywin32-200 to no avail, restarted the box, etc. Finally, I uninstalled IIS and reinstalled it from the XP cd, reinstalled Python/pywin32-200 and magically everything works fine. The second machine was XP with Service pack 1a... same routine, although this one is still broken because I haven't reinstalled IIS yet. Has anyone else experienced this? There were no installation errors and I ran the pywin32 tests related to axscript with no errors (except the VB tests, but since I don't have VB installed that is expected) thanks! Brian From tony at tcapp.com Wed Apr 14 15:22:59 2004 From: tony at tcapp.com (Tony Cappellini) Date: Wed Apr 14 15:23:11 2004 Subject: [python-win32] Registry confusion In-Reply-To: Message-ID: <20040414122049.A23170-100000@yamato.yamato.com> > > http://effbot.org/zone/python-register.htm > Interesting. I see some obvious differences. I am calling ConnectRegistry(), for the current computer, whereas Joakim does not call ConnectRegistry() at all. I am not creating any new keys, just merely changing one of the values from 0x00000000 to 0x00000001, or vice-versa. I will have to try his code to see how well it works. From guido_adriaensen at hotmail.com Thu Apr 15 03:14:43 2004 From: guido_adriaensen at hotmail.com (Guido Adriaensen) Date: Thu Apr 15 03:14:52 2004 Subject: [python-win32] excel termination Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040415/d98071fa/attachment.html From tim.golden at viacom-outdoor.co.uk Thu Apr 15 04:32:28 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Thu Apr 15 04:33:57 2004 Subject: [python-win32] excel termination Message-ID: GA> Thank you for your replies, GA> I have tried it but it doesn't work, any other suggestions? GA> excel=Dispatch("Excel.Application") GA> [snip code sample] GA> excel.Quit() GA> sleep(0.5) GA> del excel GA> sleep(0.5) GA> I have tried longer periods for sleep, GA> but this does not help. GA> This piece of code is nested in a for GA> loop, could that have anything do with it? As a matter of fact, you shouldn't need the sleep; if Excel's going to go away, it's going to go away and you're not bothered when. I used it because I needed to illustrate programatically when the Excel process was and wasn't running. The fact that the code's in a loop shouldn't matter, although -- depending on exactly what you're doing -- I would have thought that an approach such as this might have served the purpose slightly better: xl = Dispatch ("Excel.Application") for data in stream_of_data: wb = xl.Workbooks.OpenText (blah) # do stuff with wb and data xl.ActiveWorkbook.Close () xl.Quit () del xl Nonetheless, the Quit and so on should have the same effect however you do them. To ask an obvious question, is there any other Excel session open at the time? (ie are you running Excel as a user rather than through Python?) I can't see anything else which is likely to be causing the problem. Can you post a working code segment which displays the symptoms? TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From spastor at center.com Thu Apr 15 16:43:24 2004 From: spastor at center.com (sebastien Pastor) Date: Thu Apr 15 15:00:31 2004 Subject: [python-win32] ASP installation strangeness In-Reply-To: References: Message-ID: <407EF3EC.1090608@center.com> Hello ! Have u ran the Lib\site-packages\win32comext\axscript\client\pyscript.py afterwards to register the active X? Sorry if you actually did it but you may not :-) ? Brian Brown wrote: > Greetings all! > > I wrote a fairly involved ASP app in Python 2.2 about a year and a > half ago. Yesterday I was installing on some new machines for a > demonstration and tried my hand at updating to python 2.3 and > pywin32-200. > > The target machines were Windows XP/IIS 5.1. After intalling the > requisite python, trying to run any ASP pages the needed python > resulted in an ASP error that 'the script language python cannot be > found on the server'. > > So I reinstalled pywin32-200 to no avail, restarted the box, etc. > Finally, I uninstalled IIS and reinstalled it from the XP cd, > reinstalled Python/pywin32-200 and magically everything works fine. > > The second machine was XP with Service pack 1a... same routine, > although this one is still broken because I haven't reinstalled IIS yet. > > Has anyone else experienced this? There were no installation errors > and I ran the pywin32 tests related to axscript with no errors (except > the VB tests, but since I don't have VB installed that is expected) > > thanks! > > Brian > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From zapman at zappe.us Thu Apr 15 15:24:01 2004 From: zapman at zappe.us (Michael Zappe) Date: Thu Apr 15 15:27:18 2004 Subject: [python-win32] Connection reset by software under Win32 w/ BaseHTTPServer Message-ID: <407EE151.5040500@zappe.us> I have written a fairly simple HTTP server using the BaseHTTPServer w/ Python 2.3.2 under Win32, and am constantly seeing 'Connection reset by software' errors, or other RST packets going over the wire for apparently no reason. The time it happens most is when fetching a mp3 from a remote server, and then passing it to the client. I only fetch 1024 bytes at a time, so the socket *shouldn't* be timing out, but it still seems to be from the error. Has anyone seen this before? (Was it fixed in 2.3.3? I haven't had a chance to check yet) Any help would be greatly appreciated! Please be sure to cc me personally since I don't subscribe to this list! Thanks, Michael Zappe From Burkhard.Kayser at t-online.de Thu Apr 15 15:51:13 2004 From: Burkhard.Kayser at t-online.de (Burkhard Kayser) Date: Thu Apr 15 15:51:29 2004 Subject: [python-win32] Crash when calling Dispatch("Lotus.NotesSession") Message-ID: <200404152151.13825.burkhard.kayser@t-online.de> Python crashes when I try to excecute Dispatch("Lotus.NotesSession"). Please find below the results of my debugging session. Call Stack: Dispatch("Lotus.NotesSession") in __init__.py _GetGoodDispatchAndUserName() in dynamic.py _GetGoodDispatch() in dynamic.py In _GetGoodDispatch() an exception is raised when pythoncom.connect('Lotus.NotesSession') is called. --- snip --- >>> Unhandled exception while debugging... Traceback (most recent call last): File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 70, in _GetGoodDispatch IDispatch = pythoncom.connect(IDispatch) com_error: (-2147221021, 'Operation unavailable', None, None) --- snip --- This exception is then handled in the exeception clause by calling pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) with IDispatch = "Lotus.NotesSession" and clsctx = 21. Calling pythoncom.CoCreateInstance() calls __getattr__() of class Object in object.py. __getattr__ seems to end up in an endless loop which finally causes a stack overflow. As soon as I've stepped into object.py all keys of the keyboard are blocked ( only in the pythonwin ). Therefore I'm not able to do more investigations about the root cause. I'm running "PythonWin 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32." on Win2k. Lotus is of version 5.0.8 Can somebody give me a hint how to explore the root cause of the problem or did somebody experience a similar problem with either Lotus Notes or an other COM Server. Does this mean that Notes is not correct registered as a COM server ? Burkhard From amonroe at columbus.rr.com Thu Apr 15 18:14:32 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Thu Apr 15 18:07:15 2004 Subject: [python-win32] Crash when calling Dispatch("Lotus.NotesSession") In-Reply-To: <200404152151.13825.burkhard.kayser@t-online.de> References: <200404152151.13825.burkhard.kayser@t-online.de> Message-ID: <352068970492.20040415181432@columbus.rr.com> > Python crashes when I try to excecute Dispatch("Lotus.NotesSession"). > Please find below the results of my debugging session. > Call Stack: > Dispatch("Lotus.NotesSession") in __init__.py > _GetGoodDispatchAndUserName() in dynamic.py > _GetGoodDispatch() in dynamic.py Not sure why that wouldn't work because I do it every day in a scheduled task on my server: (copied directly from the working program) sess = win32com.client.Dispatch("Lotus.NotesSession") sess.Initialize("password") Not sure what to recommend. Alan From fjm11 at gmx.de Fri Apr 16 07:22:28 2004 From: fjm11 at gmx.de (fjm11@gmx.de) Date: Fri Apr 16 07:22:33 2004 Subject: [python-win32] win32 installation problems Message-ID: <20585.1082114548@www35.gmx.net> Hi everyone, I have Py2.3.3 installed on (shared) drive N: and now have problems installing with pywin32-200.win32-py2.3.exe: It installs OK up to 'Please wait while running postinstall script', then pops up 'Error: freopen stderr', followed (after OK) by 'Error: freopen stdout'. A subsequent OK causes an access violation. After some experiments I got Pythonwin.exe to run by adding: N:\....\Python23\Lib\site-packages\pywin32_system32 to my PATH, and a win32.pth file to site-packages with following content: win32/lib win32 But there's probably more broken, and I prefer a clean installation ;) Any ideas? For Info: I previously had ActivePython2.3.2 on my sys, but believe to have removed it successfully and completely. Thanks, Fritz -- NEU : GMX Internet.FreeDSL Ab sofort DSL-Tarif ohne Grundgeb?hr: http://www.gmx.net/info From rmkrauter at yahoo.com Fri Apr 16 08:15:57 2004 From: rmkrauter at yahoo.com (Rich Krauter) Date: Fri Apr 16 08:23:14 2004 Subject: [python-win32] win32 installation problems In-Reply-To: <20585.1082114548@www35.gmx.net> References: <20585.1082114548@www35.gmx.net> Message-ID: <1082117757.8508.47.camel@vaio> On Fri, 2004-04-16 at 07:22, fjm11@gmx.de wrote: > Hi everyone, > > I have Py2.3.3 installed on (shared) drive N: and now have problems > installing with pywin32-200.win32-py2.3.exe: > It installs OK up to 'Please wait while running postinstall script', then > pops up 'Error: freopen stderr', followed (after OK) by 'Error: freopen > stdout'. A subsequent OK causes an access violation. > Were you trying to install from a cd? This may not apply in your case, but I saw the same error message yesterday - I was trying to install pywin32 from a copy of the installer I had burned to a cd, without copying the installer to the hard drive first. When I copied the installer file to the hard drive and reran the installation, I didn't get the error messages. Looks like the installer needs write access to the location from which the installer is launched. Rich From fjm11 at gmx.de Fri Apr 16 08:30:14 2004 From: fjm11 at gmx.de (fjm11@gmx.de) Date: Fri Apr 16 08:30:18 2004 Subject: [python-win32] win32 installation problems Message-ID: <2062.1082118614@www17.gmx.net> > > I have Py2.3.3 installed on (shared) drive N: and now have problems > > installing with pywin32-200.win32-py2.3.exe: > > It installs OK up to 'Please wait while running postinstall script', > then > > pops up 'Error: freopen stderr', followed (after OK) by 'Error: freopen > > stdout'. A subsequent OK causes an access violation. > > > > Were you trying to install from a cd? This may not apply in your case, ... No - I installed from another directory on drive N to which i have just downloaded pywin32-200.win32-py2.3.exe Fritz -- NEU : GMX Internet.FreeDSL Ab sofort DSL-Tarif ohne Grundgeb?hr: http://www.gmx.net/info From s4fu-oirs at spamex.com Fri Apr 16 19:17:34 2004 From: s4fu-oirs at spamex.com (s4fu-oirs@spamex.com) Date: Fri Apr 16 19:21:16 2004 Subject: [python-win32] Using win32com to access uPNP Message-ID: Hi -- I'm trying to use the interface in win32com to access the windows uPNP service, the code is as follows: import win32com.client theNatter = win32com.client.Dispatch("HNetCfg.NATUPnP") mappingPorts = theNatter.StaticPortMappingCollection At this point mappingPorts seems to contain the null object, so it would appear that theNatter doesn't have an attribute StaticPortMappingCollection though the msdn docs claim otherwise. Also, i notice there are a number of interfaces common to HNetCfg.dll and NATUPnP - how does the above code differntiate between them ? -- From m_cannon at pacbell.net Sat Apr 17 13:03:31 2004 From: m_cannon at pacbell.net (Mike Cannon) Date: Sat Apr 17 13:03:01 2004 Subject: [python-win32] Resource limits in wxPython/wxWidgets ? Message-ID: <16513.25443.290613.982338@gargle.gargle.HOWL> Hi, I'm building a wxPython application that is a wxNotebook with (so far) 40 tabs. Each tab has about 200 controls, mostly wxCheckBox, wxTextCtrl, and wxStaticText. At this size, the app fails with the stack trace below. Mostly it fails in a call to wxCheckBox() (there are more of them) but it will also fail like this in wxTextCtrl() (example below) or wxStaticText(). If I remove/add controls earlier in the sequence it just fails later/ earlier at the end. Any help, please ? Thanks, Mike ================ Windows XP, Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32, wxVERSION_STRING = '2.4.2.4' ================ Traceback (most recent call last): File "FWSEngine.py", line 190, in ? main() File "FWSEngine.py", line 172, in main exec (expr) File "", line 1, in ? File "FWSEngine.py", line 50, in putCategoriesLex self.putCategory ( cat ) File "FWSEngine.py", line 81, in putCategory self.putCategoryFromColumns (cols) File "FWSEngine.py", line 95, in putCategoryFromColumns self.putLabeledCoreChoice (label, ccid) File "FWSEngine.py", line 106, in putLabeledCoreChoice self.TF.putLabeledChoiceByType ( label, items, ctype, notess) File "r:\Mello-et-al\FWSTopFrame.py", line 455, in putLabeledChoiceByType items, ctype, notess) File "r:\Mello-et-al\FWSPanel.py", line 280, in putLabeledChoiceByType if ctype == "C": self.putConditionChoiceItems (items, label, notess) File "r:\Mello-et-al\FWSPanel.py", line 297, in putConditionChoiceItems w = self._ccBoxLabelAndItems (label, items, otherItems, notess) File "r:\Mello-et-al\FWSPanel.py", line 345, in _ccBoxLabelAndItems y4 = self._ccGridPointsOthers (pnl, ccP["X00"], max (y2, y3), otherItems) File "r:\Mello-et-al\FWSPanel.py", line 421, in _ccGridPointsOthers self._ccwx4CheckBoxes (pnl, wxPoint(x0, y+2), oItem, tbPos, tbSize) File "r:\Mello-et-al\FWSPanel.py", line 474, in _ccwx4CheckBoxes tb = wxTextCtrl ( pnl, cID, label, tbPos, tbSize ) File "C:\Python23\lib\site-packages\wxPython\controls.py", line 777, in __init__ self.this = controlsc.new_wxTextCtrl(*_args,**_kwargs) wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in e:\Projects\wx2.4\src\msw\control.cpp(134): something is very wrong 09:24:22: Debug: e:\Projects\wx2.4\src\msw\app.cpp(439): 'UnregisterClass(canvas)' failed with error 0x00000584 (class still has open windows.). 09:24:22: Debug: e:\Projects\wx2.4\src\msw\app.cpp(446): 'UnregisterClass(no redraw canvas)' failed with error 0x00000584 (class still has open windows.). ================ The code snippet in \Projects\wx2.4\src\msw\control.cpp is below. It doesn't show much except that CreateWindowEx failed for some reason. ... m_hWnd = (WXHWND)::CreateWindowEx ( exstyle, // extended style classname, // the kind of control to create label, // the window name style, // the window style x, y, w, h, // the window position and size GetHwndOf(GetParent()), // parent (HMENU)GetId(), // child id wxGetInstance(), // app instance NULL // creation parameters ); if ( !m_hWnd ) { wxLogDebug(wxT("Failed to create a control of class '%s'"), classname); ==> wxFAIL_MSG(_T("something is very wrong")); return FALSE; } ... From Paul.Weimer at harlandfs.com Mon Apr 19 10:37:04 2004 From: Paul.Weimer at harlandfs.com (Paul Weimer) Date: Mon Apr 19 10:37:36 2004 Subject: [python-win32] Resource limits in wxPython/wxWidgets ? Message-ID: <342DB6B3FE8BD5119D0F0090273C23649C56CF@ex_portland1.harlandfs.com> It sounds like you're exceeding the number of window handles the os has available. We ran into a similiar issue with MFC apps as well. -----Original Message----- From: Mike Cannon [mailto:m_cannon@pacbell.net] Sent: Saturday, April 17, 2004 10:04 AM To: python-win32@python.org Subject: [python-win32] Resource limits in wxPython/wxWidgets ? Hi, I'm building a wxPython application that is a wxNotebook with (so far) 40 tabs. Each tab has about 200 controls, mostly wxCheckBox, wxTextCtrl, and wxStaticText. At this size, the app fails with the stack trace below. Mostly it fails in a call to wxCheckBox() (there are more of them) but it will also fail like this in wxTextCtrl() (example below) or wxStaticText(). If I remove/add controls earlier in the sequence it just fails later/ earlier at the end. Any help, please ? Thanks, Mike ================ Windows XP, Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32, wxVERSION_STRING = '2.4.2.4' ================ Traceback (most recent call last): File "FWSEngine.py", line 190, in ? main() File "FWSEngine.py", line 172, in main exec (expr) File "", line 1, in ? File "FWSEngine.py", line 50, in putCategoriesLex self.putCategory ( cat ) File "FWSEngine.py", line 81, in putCategory self.putCategoryFromColumns (cols) File "FWSEngine.py", line 95, in putCategoryFromColumns self.putLabeledCoreChoice (label, ccid) File "FWSEngine.py", line 106, in putLabeledCoreChoice self.TF.putLabeledChoiceByType ( label, items, ctype, notess) File "r:\Mello-et-al\FWSTopFrame.py", line 455, in putLabeledChoiceByType items, ctype, notess) File "r:\Mello-et-al\FWSPanel.py", line 280, in putLabeledChoiceByType if ctype == "C": self.putConditionChoiceItems (items, label, notess) File "r:\Mello-et-al\FWSPanel.py", line 297, in putConditionChoiceItems w = self._ccBoxLabelAndItems (label, items, otherItems, notess) File "r:\Mello-et-al\FWSPanel.py", line 345, in _ccBoxLabelAndItems y4 = self._ccGridPointsOthers (pnl, ccP["X00"], max (y2, y3), otherItems) File "r:\Mello-et-al\FWSPanel.py", line 421, in _ccGridPointsOthers self._ccwx4CheckBoxes (pnl, wxPoint(x0, y+2), oItem, tbPos, tbSize) File "r:\Mello-et-al\FWSPanel.py", line 474, in _ccwx4CheckBoxes tb = wxTextCtrl ( pnl, cID, label, tbPos, tbSize ) File "C:\Python23\lib\site-packages\wxPython\controls.py", line 777, in __init__ self.this = controlsc.new_wxTextCtrl(*_args,**_kwargs) wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in e:\Projects\wx2.4\src\msw\control.cpp(134): something is very wrong 09:24:22: Debug: e:\Projects\wx2.4\src\msw\app.cpp(439): 'UnregisterClass(canvas)' failed with error 0x00000584 (class still has open windows.). 09:24:22: Debug: e:\Projects\wx2.4\src\msw\app.cpp(446): 'UnregisterClass(no redraw canvas)' failed with error 0x00000584 (class still has open windows.). ================ The code snippet in \Projects\wx2.4\src\msw\control.cpp is below. It doesn't show much except that CreateWindowEx failed for some reason. ... m_hWnd = (WXHWND)::CreateWindowEx ( exstyle, // extended style classname, // the kind of control to create label, // the window name style, // the window style x, y, w, h, // the window position and size GetHwndOf(GetParent()), // parent (HMENU)GetId(), // child id wxGetInstance(), // app instance NULL // creation parameters ); if ( !m_hWnd ) { wxLogDebug(wxT("Failed to create a control of class '%s'"), classname); ==> wxFAIL_MSG(_T("something is very wrong")); return FALSE; } ... _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From bgailer at alum.rpi.edu Mon Apr 19 12:21:37 2004 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Mon Apr 19 12:18:40 2004 Subject: [python-win32] Desire information about Invoke and InvokeTypes Message-ID: <6.0.0.22.0.20040419090017.03c400f8@mail.mric.net> I am debugging the com interface to Excel. This is a non-trivial post. If you can relate to this material and offer help, please do so. Python program fragment: sc = chart.SeriesCollection() sc.Add(series_range, seriesAddDirection) The last line causes an error. Here's the method code generated for Add by the dispatch module: def Add(self, Source=pythoncom.Missing, Rowcol=2, SeriesLabels=pythoncom.Missing, CategoryLabels=pythoncom.Missing, Replace=pythoncom.Missing): ret = self._oleobj_.InvokeTypes(181, LCID, 1, (9, 0), ((12, 1), (3, 49), (12, 17), (12, 17), (12, 17)),Source, Rowcol, SeriesLabels, CategoryLabels, Replace) if ret is not None: ret = Dispatch(ret, 'Add', '{0002086B-0000-0000-C000-000000000046}', UnicodeToString=0) return ret The call to InvokeTypes returns integer 1 rather than a PyIDispatch object. InvokeTypes is explained (tersely) at: http://aspn.activestate.com/ASPN/docs/ActivePython/2.3/PyWin32/PyIDispatch__InvokeTypes_meth.html but this is not enough information for me to understand why an integer is being returned. I assume that InvokeTypes is part of the COM interface, and that Excel is responsible for handling it. Is this true? If so does this mean that there is a bug in Excel? Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From bgailer at alum.rpi.edu Mon Apr 19 13:55:25 2004 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Mon Apr 19 13:52:23 2004 Subject: [python-win32] Desire information about Invoke and InvokeTypes In-Reply-To: <6.0.0.22.0.20040419090017.03c400f8@mail.mric.net> References: <6.0.0.22.0.20040419090017.03c400f8@mail.mric.net> Message-ID: <6.0.0.22.0.20040419115408.03c3f4e8@mail.mric.net> At 10:21 AM 4/19/2004, Bob Gailer wrote: >I am debugging the com interface to Excel. This is a non-trivial post. If >you can relate to this material and offer help, please do so. > >Python program fragment: > >sc = chart.SeriesCollection() >sc.Add(series_range, seriesAddDirection) > >The last line causes an error. Here's the method code generated for Add by >the dispatch module: > >def Add(self, Source=pythoncom.Missing, Rowcol=2, >SeriesLabels=pythoncom.Missing, CategoryLabels=pythoncom.Missing, >Replace=pythoncom.Missing): > ret = self._oleobj_.InvokeTypes(181, LCID, 1, (9, 0), ((12, 1), > (3, 49), (12, 17), (12, 17), (12, 17)),Source, Rowcol, SeriesLabels, > CategoryLabels, Replace) > if ret is not None: > ret = Dispatch(ret, 'Add', > '{0002086B-0000-0000-C000-000000000046}', UnicodeToString=0) > return ret > >The call to InvokeTypes returns integer 1 rather than a PyIDispatch object. > >InvokeTypes is explained (tersely) at: > >http://aspn.activestate.com/ASPN/docs/ActivePython/2.3/PyWin32/PyIDispatch__InvokeTypes_meth.html > >but this is not enough information for me to understand why an integer is >being returned. > >I assume that InvokeTypes is part of the COM interface, and that Excel is >responsible for handling it. Is this true? If so does this mean that there >is a bug in Excel? Or is there a bug in the tuple of return types? Or some other problem in the parameters? Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From bgailer at alum.rpi.edu Mon Apr 19 14:14:55 2004 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Mon Apr 19 14:11:57 2004 Subject: [python-win32] Desire information about Invoke and InvokeTypes In-Reply-To: <6.0.0.22.0.20040419115408.03c3f4e8@mail.mric.net> References: <6.0.0.22.0.20040419090017.03c400f8@mail.mric.net> <6.0.0.22.0.20040419115408.03c3f4e8@mail.mric.net> Message-ID: <6.0.0.22.0.20040419120703.03c3e8d8@mail.mric.net> >At 10:21 AM 4/19/2004, Bob Gailer wrote: >>I am debugging the com interface to Excel. [snip] Look at the InvokeTypes syntax (from the ActiveState link): object = InvokeTypes(dispid, lcid , wFlags , typeDesc , resultTypeDesc , args ) Invokes a DISPID, using the passed arguments and type descriptions. Parameters dispid : int - The dispid to use. Please see PyIDispatch::Invoke. lcid : int - The locale ID. Please see PyIDispatch::Invoke. wFlags : int - Flags for the call. Please see PyIDispatch::Invoke. typeDesc : (tuple, ...) - A sequence of tuples describing the types of the parameters for the function. resultTypeDesc : tuple - A tuple describing the type of the result. args : object, ... - The args to the function. Compare to the generated call: ret = self._oleobj_.InvokeTypes(181, LCID, 1, (9, 0), ((12, 1), (3, 49), (12, 17), (12, 17), (12, 17)),Source, Rowcol, SeriesLabels, CategoryLabels, Replace) Notice that typeDesc is a tuple, and resultTypeDesc is a sequence of tuples. This seems backwards! Could that be the problem? However the method code for SeriesCollection has a similar parameter structure and it succeeds: ret = self._oleobj_.InvokeTypes(68, LCID, 1, (9, 0), ((12, 17),),Index) Could the ActiveState description be wrong? Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From mhammond at skippinet.com.au Tue Apr 20 01:49:20 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Apr 20 01:49:50 2004 Subject: [python-win32] Desire information about Invoke and InvokeTypes In-Reply-To: <6.0.0.22.0.20040419090017.03c400f8@mail.mric.net> Message-ID: <0d3301c4269b$3a6e4cb0$0200a8c0@eden> > Python program fragment: > > sc = chart.SeriesCollection() > sc.Add(series_range, seriesAddDirection) > > The last line causes an error. What error exactly? > Here's the method code > generated for Add by > the dispatch module: > > def Add(self, Source=pythoncom.Missing, Rowcol=2, > SeriesLabels=pythoncom.Missing, CategoryLabels=pythoncom.Missing, > Replace=pythoncom.Missing): > ret = self._oleobj_.InvokeTypes(181, LCID, 1, (9, > 0), ((12, 1), > (3, 49), (12, 17), (12, 17), (12, 17)),Source, Rowcol, SeriesLabels, > CategoryLabels, Replace) > if ret is not None: > ret = Dispatch(ret, 'Add', > '{0002086B-0000-0000-C000-000000000046}', UnicodeToString=0) > return ret > > The call to InvokeTypes returns integer 1 rather than a > PyIDispatch object. The relevant information is: (9, 0), ((12, 1), (3, 49), (12, 17), (12, 17), (12, 17)) The (9,0) is the return type. This translates to VT_DISPATCH. Is it possible you are tripping over us calling the 'default' method or property in some cases? eg:, I could imagine: sc = chart.SeriesCollection() n = sc.Add(series_range, seriesAddDirection) print n would print '1' in certain cases. However: print repr(n) Would make it more obvious. It is possible the object has a 'default' property that is called whenever str() or int() is called on the object. Mark From theller at python.net Tue Apr 20 07:48:26 2004 From: theller at python.net (Thomas Heller) Date: Tue Apr 20 07:48:32 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes References: <6.0.0.22.0.20040419090017.03c400f8@mail.mric.net> <0d3301c4269b$3a6e4cb0$0200a8c0@eden> Message-ID: <1xmikgz9.fsf@python.net> >> Here's the method code generated for Add by the dispatch module: >> >> def Add(self, Source=pythoncom.Missing, Rowcol=2, >> SeriesLabels=pythoncom.Missing, CategoryLabels=pythoncom.Missing, >> Replace=pythoncom.Missing): >> ret = self._oleobj_.InvokeTypes(181, LCID, 1, (9, >> 0), ((12, 1), >> (3, 49), (12, 17), (12, 17), (12, 17)),Source, Rowcol, SeriesLabels, >> CategoryLabels, Replace) >> if ret is not None: >> ret = Dispatch(ret, 'Add', >> '{0002086B-0000-0000-C000-000000000046}', UnicodeToString=0) >> return ret >> >> The call to InvokeTypes returns integer 1 rather than a >> PyIDispatch object. > > The relevant information is: > > (9, 0), ((12, 1), (3, 49), (12, 17), (12, 17), (12, 17)) > > The (9,0) is the return type. This translates to VT_DISPATCH. So the docs also have swapped the typeDesc and the resultTypeDesc arguments. It should read InvokeTypes(dispid, lcid, wFlags, resultTypeDesc, typeDesc, args) instead. > Is it possible you are tripping over us calling the 'default' method or > property in some cases? eg:, I could imagine: > > sc = chart.SeriesCollection() > n = sc.Add(series_range, seriesAddDirection) > print n > > would print '1' in certain cases. However: > print repr(n) > > Would make it more obvious. It is possible the object has a 'default' > property that is called whenever str() or int() is called on the object. I also was bugged by this behaviour some time ago. Confusing, imo. Thomas From benn at cenix-bioscience.com Tue Apr 20 12:50:28 2004 From: benn at cenix-bioscience.com (Neil Benn) Date: Tue Apr 20 12:50:34 2004 Subject: [python-win32] win32file and win32pipe Message-ID: <408554D4.7060602@cenix-bioscience.com> Hello, I'm doing some work on windows pipe to communicate with a commercial app (i.e. one which I have no source for), I'm using the commands as follows : hndPipe = win32file.CreateFile(r"\\.\pipe\gemini", win32file.GENERIC_READ | \ win32file.GENERIC_WRITE, 0, #no sharing None, #no security win32file.OPEN_EXISTING, win32file.FILE_ATTRIBUTE_NORMAL, None) This connects fine, then I write to the pipe using something like : win32file.WriteFile(self.__hndPipe, 'GET_VERSION', None) Again this works fine and the response is what I'd expect, however when I then send something like : win32file.WriteFile(self.__hndPipe, 'INIT_RSP', None) The external software thinks it has recevied : INIT_RSPION In other words it seems like the string variable used in win32file is not being cleaned out after the first call. When I use something like CallNamedPipe in win32pipe it works fine, only problem with this is that it opens and closes the pipe all the time, which if the software is meant to be running 24/7 will make a mess of the logfiles and isn't the most elegent solution. I guess the question is, has anyone tried to do this, as it points towards an internal bug in the win32file C code. Obviously I have tested the application with other pipe writing programs and it works without a problem. Thanks, in advance for your help. Cheers, Neil -- Neil Benn Senior Automation Engineer Cenix BioScience PfotenhauerStrasse 108 D-01307 Dresden Germany Tel : +49 (351) 210 1300 e-mail : benn@cenix-bioscience.com Cenix Website : http://www.cenix-bioscience.com From kojo at hal-pc.org Tue Apr 20 13:50:43 2004 From: kojo at hal-pc.org (Kojo Idrissa) Date: Tue Apr 20 13:50:51 2004 Subject: [python-win32] Com+ Book? In-Reply-To: <408554D4.7060602@cenix-bioscience.com> Message-ID: Sorry if this has already been answered, but a quick scan through the archives didn't tell me anything... In addition to the Python Programming on Win32 book, is "COM+ Programming with Visual Basic" from O'Reilly a good source of info for figuring out how the different objects work, with regard to trying to work with them in Python? I've always seen it, but I as never really sure if it was a good purchase. Thanks, **************************** Kojo Idrissa kojo@hal-pc.org http://www.hal-pc.org/~kojo **************************** From jens.jorgensen at tallan.com Tue Apr 20 15:44:33 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Tue Apr 20 15:44:46 2004 Subject: [python-win32] win32file and win32pipe In-Reply-To: <408554D4.7060602@cenix-bioscience.com> References: <408554D4.7060602@cenix-bioscience.com> Message-ID: <40857DA1.1000705@tallan.com> I dunno about this Neil but I've used a named pipe with the win32 extensions before and it worked fine for me. Are you sure you aren't supposed to send through some kind of command terminator? Neil Benn wrote: > Hello, > > I'm doing some work on windows pipe to communicate with a > commercial app (i.e. one which I have no source for), I'm using the > commands as follows : > > hndPipe = win32file.CreateFile(r"\\.\pipe\gemini", > > win32file.GENERIC_READ | \ > win32file.GENERIC_WRITE, > 0, #no sharing > None, #no security > win32file.OPEN_EXISTING, > > win32file.FILE_ATTRIBUTE_NORMAL, > None) > > This connects fine, then I write to the pipe using something like : > > win32file.WriteFile(self.__hndPipe, 'GET_VERSION', None) > > Again this works fine and the response is what I'd expect, however > when I then send something like : > > win32file.WriteFile(self.__hndPipe, 'INIT_RSP', None) > > The external software thinks it has recevied : > > INIT_RSPION > > In other words it seems like the string variable used in win32file > is not being cleaned out after the first call. When I use something > like CallNamedPipe in win32pipe it works fine, only problem with this > is that it opens and closes the pipe all the time, which if the > software is meant to be running 24/7 will make a mess of the logfiles > and isn't the most elegent solution. > > I guess the question is, has anyone tried to do this, as it points > towards an internal bug in the win32file C code. Obviously I have > tested the application with other pipe writing programs and it works > without a problem. > > Thanks, in advance for your help. > > Cheers, > > Neil > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3108 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040420/c6bf6d1d/smime.bin From rwupole at msn.com Tue Apr 20 21:16:52 2004 From: rwupole at msn.com (Roger Upole) Date: Tue Apr 20 18:00:42 2004 Subject: [python-win32] Re: win32file and win32pipe Message-ID: <000601c4273e$562f1bc0$0a9d5dcf@rupole> I took a look at the code for win32file.WriteFile, and it's not even using its own buffer for strings. It passes the internal buffer from the Python object. However, it's doesn't include the trailing null byte in the data length. Do you know if the receiving app is expecting it ? If so, you could try appending a \0 to the strings you're passing. hth Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040420/de46437c/attachment.html From mhammond at skippinet.com.au Tue Apr 20 18:56:16 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Apr 20 18:56:37 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes In-Reply-To: <1xmikgz9.fsf@python.net> Message-ID: <13b501c4272a$b06b53b0$0200a8c0@eden> > So the docs also have swapped the typeDesc and the resultTypeDesc > arguments. It should read > InvokeTypes(dispid, lcid, wFlags, resultTypeDesc, typeDesc, args) > instead. Thanks! I just fixed that. > > Is it possible you are tripping over us calling the > 'default' method or > > property in some cases? eg:, I could imagine: > > > > sc = chart.SeriesCollection() > > n = sc.Add(series_range, seriesAddDirection) > > print n > > > > would print '1' in certain cases. However: > > print repr(n) > > > > Would make it more obvious. It is possible the object has > a 'default' > > property that is called whenever str() or int() is called > on the object. > > I also was bugged by this behaviour some time ago. Confusing, imo. Yes, I tend to agree, but am stuck between a rock and a hard place. Many samples, especially VB based ones often show code like: f = whatever.GetField() MsgBox "The field " & field & " has value " & field.Value Or even passing the object to a function that expects a string. They make no reference at all to what the "implied" attribute name they are using is, or when passing as a param, make no reference to the behaviour. I believe Excel Cells and many other objects work this way, and COM goes to lengths to define the semantics. Just like COM's INVOKE_PROPERTYPUTREF, it is one of those things that I would prefer didn't exist, but feel I can't ignore them given they do. Mark. From mhammond at skippinet.com.au Tue Apr 20 19:09:00 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue Apr 20 19:09:30 2004 Subject: [python-win32] Com+ Book? In-Reply-To: Message-ID: <13b801c4272c$7bd27190$0200a8c0@eden> > In addition to the Python Programming on Win32 book, is "COM+ > Programming with Visual Basic" from O'Reilly a good source of > info for > figuring out how the different objects work, with regard to trying to > work with them in Python? I've never seen the other book, but I would be surprised if it also made a good "COM object reference". A common critisim people send me about our book is that I didn't cover the "COM object " deeply enough. Unfortunately, the specific "something" could be any of the objects I touch in the book - Word, Excel, IE, etcm or even ones I didn't :) Many COM object suites are *very* complicated - eg, Microsoft Office contains a number of apps, each with a huge object model. For this kind of app, you are probably best off finding a book that focuses on the single application (in any language), rather than a book which is focussed on the language (including mine!) and will therefore cover individual objects more superficially. Mark. From tony at tcapp.com Tue Apr 20 23:29:11 2004 From: tony at tcapp.com (Tony Cappellini) Date: Tue Apr 20 23:29:13 2004 Subject: [python-win32] Problem writing ini file with ConfigParser In-Reply-To: Message-ID: <20040420192554.H11698-100000@yamato.yamato.com> On Windows 2000, using Python 2.3.3 After sifting through the docs for ConfigPArser, and manually banging in a script in PythonWin, the ConfigParser is getting an exception during the write, I don't understand what the problem is I've gone in with edit, and changed the file, and saved it, so admin rights and read only don't sem to be a problem, from the editor. cfg=ConfigParser.ConfigParser() fp=open(r"c:\winnt\system32\gpib.ini") cfg.readfp(fp) cfg.read(r"c:\winnt\system32\gpib.ini") cfg.set('GPIB0', 'sc','no') cfg.get('GPIB0', 'sc') 'no' cfg.write(fp) Traceback (most recent call last): File "", line 1, in ? File "C:\Python23\lib\ConfigParser.py", line 363, in write fp.write("[%s]\n" % section) IOError: (0, 'Error') Any ideas what is causing the error ? I don't have the file open in any other programs- Tony From t-meyer at ihug.co.nz Tue Apr 20 23:40:56 2004 From: t-meyer at ihug.co.nz (Tony Meyer) Date: Tue Apr 20 23:41:35 2004 Subject: [python-win32] Problem writing ini file with ConfigParser In-Reply-To: <1ED4ECF91CDED24C8D012BCF2B034F1305FF622B@its-xchg4.massey.ac.nz> Message-ID: <1ED4ECF91CDED24C8D012BCF2B034F1304677C9B@its-xchg4.massey.ac.nz> > After sifting through the docs for ConfigPArser, and manually > banging in a script in PythonWin, the ConfigParser is getting > an exception during the write, I don't understand what the problem is > > I've gone in with edit, and changed the file, and saved it, > so admin rights and read only don't sem to be a problem, from > the editor. > > cfg=ConfigParser.ConfigParser() > fp=open(r"c:\winnt\system32\gpib.ini") > cfg.readfp(fp) > cfg.read(r"c:\winnt\system32\gpib.ini") [...] > cfg.write(fp) You're passing a file opened only for reading to .write(). You'll need to either open for both reading and writing, or (better) close the file after reading, and then open it again for writing. =Tony Meyer From tony at tcapp.com Wed Apr 21 02:17:41 2004 From: tony at tcapp.com (Tony Cappellini) Date: Wed Apr 21 02:17:53 2004 Subject: [python-win32] Problem writing ini file with ConfigParser In-Reply-To: <1ED4ECF91CDED24C8D012BCF2B034F1304677C9B@its-xchg4.massey. ac.nz> References: <1ED4ECF91CDED24C8D012BCF2B034F1305FF622B@its-xchg4.massey.ac.nz> <1ED4ECF91CDED24C8D012BCF2B034F1304677C9B@its-xchg4.massey.ac.nz> Message-ID: <6.0.0.22.0.20040420231614.03c614d8@tcapp.com> At 08:40 PM 4/20/2004, Tony Meyer wrote: > > After sifting through the docs for ConfigPArser, and manually > > banging in a script in PythonWin, the ConfigParser is getting > > an exception during the write, I don't understand what the problem is > > > > I've gone in with edit, and changed the file, and saved it, > > so admin rights and read only don't sem to be a problem, from > > the editor > > > > cfg=ConfigParser.ConfigParser() > > fp=open(r"c:\winnt\system32\gpib.ini") > > cfg.readfp(fp) > > cfg.read(r"c:\winnt\system32\gpib.ini") >[...] > > cfg.write(fp) > >You're passing a file opened only for reading to .write(). You'll need to >either open for both reading and writing, or (better) close the file after >reading, and then open it again for writing. > >=Tony Meyer I knew that. I just wanted to see if anyone else was paying attention :-) (obviously you are. Well done !!) believe it or not, I have written to files before this :-)) From theller at python.net Wed Apr 21 02:40:40 2004 From: theller at python.net (Thomas Heller) Date: Wed Apr 21 02:40:46 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes In-Reply-To: <13b501c4272a$b06b53b0$0200a8c0@eden> (Mark Hammond's message of "Wed, 21 Apr 2004 08:56:16 +1000") References: <13b501c4272a$b06b53b0$0200a8c0@eden> Message-ID: >> > Is it possible you are tripping over us calling the 'default' >> > method or property in some cases? eg:, I could imagine: >> > >> > sc = chart.SeriesCollection() >> > n = sc.Add(series_range, seriesAddDirection) >> > print n >> > >> > would print '1' in certain cases. However: >> > print repr(n) >> > >> > Would make it more obvious. It is possible the object has a >> > 'default' property that is called whenever str() or int() is called >> > on the object. >> >> I also was bugged by this behaviour some time ago. Confusing, imo. > > Yes, I tend to agree, but am stuck between a rock and a hard place. > Many samples, especially VB based ones often show code like: > > f = whatever.GetField() > MsgBox "The field " & field & " has value " & field.Value > > Or even passing the object to a function that expects a string. They > make no reference at all to what the "implied" attribute name they are > using is, or when passing as a param, make no reference to the > behaviour. > I believe Excel Cells and many other objects work this way, and COM > goes to lengths to define the semantics. Just like COM's > INVOKE_PROPERTYPUTREF, it is one of those things that I would prefer > didn't exist, but feel I can't ignore them given they do. I didn't want to criticize you, the design decisions you made ;-). It seems a lot of this stuff (or even the COM semantics) is influenced by the way it works in VB. I am just thinking that it *could* make more sense (in ctypes.com) to be more explicit. So the above VB code would translate to ctypes.com: f = whatever.GetField() MessageBox("The field %s has value %d" (field.Item, field.Value)) Or something like that. Thomas From master at hilug.org Wed Apr 21 02:53:06 2004 From: master at hilug.org (Y.H. Rhiu) Date: Wed Apr 21 02:53:02 2004 Subject: [python-win32] How can I get total size of hard disk? Message-ID: <007701c4276d$4d414c20$dc3fe7cb@greatstream> How can I get total size of hard disk? I searched and got this way below, but I think it is not graceful way. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66455 Any ideas? Thanks. __ Y.H. Rhiu From benn at cenix-bioscience.com Wed Apr 21 03:43:47 2004 From: benn at cenix-bioscience.com (Neil Benn) Date: Wed Apr 21 03:43:54 2004 Subject: [python-win32] Re: win32file and win32pipe In-Reply-To: <000601c4273e$562f1bc0$0a9d5dcf@rupole> References: <000601c4273e$562f1bc0$0a9d5dcf@rupole> Message-ID: <40862633.1010603@cenix-bioscience.com> Hello, Thank you for the response, I came to the same conclusion after digging through the C source and thought of the trailing null on the tram on the way home!! Oh well stayed in work until 21:00 because I couldn't see the wood for the trees. Hopefully someone might have a similar problem in the future and my wasted evening not be in vain. Cheers, Neil Roger Upole wrote: > I took a look at the code for win32file.WriteFile, and it's not even using > its own buffer for strings. It passes the internal buffer from the Python > object. However, it's doesn't include the trailing null byte in the data > length. Do you know if the receiving app is expecting it ? If so, you > could try appending a \0 to the strings you're passing. > hth > Roger > > >------------------------------------------------------------------------ > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Neil Benn Senior Automation Engineer Cenix BioScience PfotenhauerStrasse 108 D-01307 Dresden Germany Tel : +49 (351) 210 1300 e-mail : benn@cenix-bioscience.com Cenix Website : http://www.cenix-bioscience.com From tim.golden at viacom-outdoor.co.uk Wed Apr 21 03:49:11 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Apr 21 03:50:46 2004 Subject: [python-win32] How can I get total size of hard disk? Message-ID: >How can I get total size of hard disk? [Seems like ages since I answered a question with: try WMI] Try WMI: http://tgolden.sc.sabren.com/python/wmi_cookbook.html#percentage_free Depending on exactly whay you're looking for, you might want to look at: Win32_DiskDrive Win32_LogicalDisk Win32_DiskPartition TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From therve at neocles.com Wed Apr 21 04:16:28 2004 From: therve at neocles.com (=?ISO-8859-1?Q?Thomas_Herv=E9?=) Date: Wed Apr 21 04:14:43 2004 Subject: [python-win32] How can I get total size of hard disk? In-Reply-To: <007701c4276d$4d414c20$dc3fe7cb@greatstream> References: <007701c4276d$4d414c20$dc3fe7cb@greatstream> Message-ID: <40862DDC.1010304@neocles.com> Hi, Y.H. Rhiu wrote: >How can I get total size of hard disk? > [...] >Any ideas? > > WMI is a solution, but you can do without too : drives = string.splitfields(win32api.GetLogicalDriveStrings(), '\\\x00')[0:-1] for d in drives : d_type = win32file.GetDriveType(d) # We only want local drives if d_type == win32file.DRIVE_FIXED : d_size = win32file.GetDiskFreeSpaceEx(d) print "Disk %s : %d free on %d" % (d, d_size[2], d_size[1]) >Thanks. > > Hope this helps. >__ >Y.H. Rhiu > > -- Thomas Herve From mhammond at skippinet.com.au Wed Apr 21 06:38:43 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Apr 21 06:39:03 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes In-Reply-To: Message-ID: <182a01c4278c$d206c420$0200a8c0@eden> > I didn't want to criticize you, the design decisions you made ;-). I didn't take it as critisism :) > I am just thinking that it *could* make more sense (in > ctypes.com) to be > more explicit. So the above VB code would translate to ctypes.com: > > f = whatever.GetField() > MessageBox("The field %s has value %d" (field.Item, field.Value)) This will work now, and would be the only way to make it work if you ignored the default method/property. In general, the "default" method/property is an alias for an explicit one. But in many respects, the problem is with Python, and the fact it calls str() before doing a print. If you ignore the 'print' issue, it makes perfect sense for a Python object wrapping a COM object to provide __str__ and __int__ overloads when the COM object asserts it provides these semantics. I recall Guido also lamenting the same issue, but his time machine failed in that regard. Mark. From theller at python.net Wed Apr 21 07:53:57 2004 From: theller at python.net (Thomas Heller) Date: Wed Apr 21 07:54:05 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes References: <182a01c4278c$d206c420$0200a8c0@eden> Message-ID: >> I am just thinking that it *could* make more sense (in ctypes.com) to >> be more explicit. So the above VB code would translate to >> ctypes.com: >> >> f = whatever.GetField() >> MessageBox("The field %s has value %d" (field.Item, field.Value)) > > This will work now, and would be the only way to make it work if you ignored > the default method/property. In general, the "default" method/property is > an alias for an explicit one. explicit is better than..., but I may not be the VB way. > But in many respects, the problem is with Python, and the fact it calls > str() before doing a print. If you ignore the 'print' issue, it makes > perfect sense for a Python object wrapping a COM object to provide __str__ > and __int__ overloads when the COM object asserts it provides these > semantics. I recall Guido also lamenting the same issue, but his time > machine failed in that regard. It seems CDispatch exposes the default method/property via the __call__ mechanism, which is fine. I'm only wondering why __str__ and __int__ try to use it also. Anyway, the whole Dispatch stuff seems to do a lot of guesswork internally. Probably a lot of (my?) confusion has to do with the fact that VB doesn't separate properties and methods. Thomas From rwupole at msn.com Wed Apr 21 11:26:17 2004 From: rwupole at msn.com (Roger Upole) Date: Wed Apr 21 08:09:51 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes Message-ID: <000601c427b4$ff1eed70$6111780a@rupole> I ran this in the debugger, and the return value is actually a VT_BOOL (true), which equates to 1. Since the return type at the C++ level is different from what the typelib specifies, I'd guess this is either bad type info in the typelib or a bug in the Excel api itself. Oddly enough, it succeeded after I ran makepy for the excel typelib However, only because it wraps the returned bool in the Series generated class. The returned object is unusable, but at least it doesn't blow up. It looks like there's a potential bug in the dynamic dispatch code, though. InvokeTypes can return a tuple if there are any out parameters to be returned, but there's a slight difference between the way the python code checks for out parameters (in build.py) and the way the C++ code determines it (PythonOleArgHelper::ParseTypeInformation). If the two come up with different interpretations of the number of out params, you could end up doing a Dispatch of a tuple. hth Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040421/b3b543da/attachment.html From mhammond at skippinet.com.au Wed Apr 21 08:30:46 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Apr 21 08:31:20 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes In-Reply-To: Message-ID: <18f201c4279c$797f8c00$0200a8c0@eden> > explicit is better than..., but I may not be the VB way. too true :) > It seems CDispatch exposes the default method/property via > the __call__ > mechanism, which is fine. I'm only wondering why __str__ and __int__ > try to use it also. > Anyway, the whole Dispatch stuff seems to do a lot of guesswork > internally. > > Probably a lot of (my?) confusion has to do with the fact that VB > doesn't separate properties and methods. Exactly. Sometimes, the default "thingy" is a method, sometimes a property. Sometimes it wants args (eg, collections), sometimes it doesn't. As you mention, VB's legacy, including abominations as "properties with args", leaves us with something that is very difficult to understand, and impossible to judge as "right" or "wrong" - everything just seems "could be better" ;) Mark. From mhammond at skippinet.com.au Wed Apr 21 08:42:35 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Apr 21 08:43:02 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes In-Reply-To: <000601c427b4$ff1eed70$6111780a@rupole> Message-ID: <191101c4279e$1fb8fe70$0200a8c0@eden> Thanks for checking into it Roger! I asked the OP for a completely stand-alone test case to run, as I really don't have the time to struggle with Excel's charts :) I suspected (hoped!) I would find exactly what you did though. I'm relucatant to generalize the genpy process to assume that the type-info may not be 100% accurate though - following that to its logical conclusion means we are back to fully dynamic objects. I think that in this case, we simply recommend a work-around: ob = win32com.client.dispatch.DumbDispatch(ob) should allow op.Add() to work correctly, using dumb dispatch. Re the param parsing bug - I am sure you are correct :( It might not be too hard to provoke via the C++ test object, which would be a good start :) push(new_bug) # ly yr's Mark. -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Roger Upole Sent: Thursday, 22 April 2004 1:26 AM To: python-win32@python.org Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes I ran this in the debugger, and the return value is actually a VT_BOOL (true), which equates to 1. Since the return type at the C++ level is different from what the typelib specifies, I'd guess this is either bad type info in the typelib or a bug in the Excel api itself. Oddly enough, it succeeded after I ran makepy for the excel typelib However, only because it wraps the returned bool in the Series generated class. The returned object is unusable, but at least it doesn't blow up. It looks like there's a potential bug in the dynamic dispatch code, though. InvokeTypes can return a tuple if there are any out parameters to be returned, but there's a slight difference between the way the python code checks for out parameters (in build.py) and the way the C++ code determines it (PythonOleArgHelper::ParseTypeInformation). If the two come up with different interpretations of the number of out params, you could end up doing a Dispatch of a tuple. hth Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040421/460e65a6/attachment-0001.html From mhammond at skippinet.com.au Wed Apr 21 08:48:27 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Apr 21 08:48:49 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes In-Reply-To: <191101c4279e$1fb8fe70$0200a8c0@eden> Message-ID: <192601c4279e$f326aa50$0200a8c0@eden> I wrote: > ob = win32com.client.dispatch.DumbDispatch(ob) But meant: ob = win32com.client.dynamic.DumbDispatch(ob) (obviously with the relevant imports!) Mark. From theller at python.net Wed Apr 21 09:16:41 2004 From: theller at python.net (Thomas Heller) Date: Wed Apr 21 09:16:47 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes References: <18f201c4279c$797f8c00$0200a8c0@eden> Message-ID: "Mark Hammond" writes: >> explicit is better than..., but I may not be the VB way. > > too true :) > >> It seems CDispatch exposes the default method/property via >> the __call__ >> mechanism, which is fine. I'm only wondering why __str__ and __int__ >> try to use it also. >> Anyway, the whole Dispatch stuff seems to do a lot of guesswork >> internally. >> >> Probably a lot of (my?) confusion has to do with the fact that VB >> doesn't separate properties and methods. > > Exactly. Sometimes, the default "thingy" is a method, sometimes a property. > Sometimes it wants args (eg, collections), sometimes it doesn't. As you > mention, VB's legacy, including abominations as "properties with args", > leaves us with something that is very difficult to understand, and > impossible to judge as "right" or "wrong" - everything just seems "could be > better" ;) Ok. Please allow one final (hopefully!) question: What's the way JScript takes? Thomas From Mike.Tallhamer at USONCOLOGY.COM Wed Apr 21 14:34:12 2004 From: Mike.Tallhamer at USONCOLOGY.COM (Mike.Tallhamer@USONCOLOGY.COM) Date: Wed Apr 21 16:20:39 2004 Subject: [python-win32] Launching an application from python Message-ID: <1D09B341F14C6E429F374C2FC17E7CBFD008FA@utx001sx011.usoncology.com> I am a physicist turned programmer for a current project I'm working on and am rather new to python GUI programming. I would like to know if it is possible to launch an application like adobe from my application simply by programming the commands into a button. I have a few protocols that are in pdf format and I would like to pull up the protocol in adobe as an on the fly help while calibrating a linear accelerator using my GUI interface. Is this possible on windows and how would I go about doing it. I know on a Mac I can make os.system calls but am unfamiliar with how to do this on windows. Please respond to the following email because I can't seem to get on the list using my current email account. Mike.Tallhamer@USONCOLOGY.com Any help would be greatly appreciated Michael Tallhamer Medical Physicist Department of Radiation Oncology Rocky Mountain Cancer Centers Denver, CO ----------------------------------------- The contents of this electronic mail message and any attachments are confidential, possibly privileged and intended for the addressee(s) only. Only the addressee(s) may read, disseminate, retain or otherwise use this message. If received in error, please immediately inform the sender and then delete this message without disclosing its contents to anyone. From mhammond at skippinet.com.au Wed Apr 21 19:10:25 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Apr 21 19:11:50 2004 Subject: [python-win32] Re: Desire information about Invoke and InvokeTypes In-Reply-To: Message-ID: <1db401c427f5$d4a23ed0$0200a8c0@eden> > Ok. Please allow one final (hopefully!) question: > What's the way JScript takes? I believe it insists on function call syntax. Mark. From tim.golden at viacom-outdoor.co.uk Thu Apr 22 03:41:22 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Thu Apr 22 03:42:52 2004 Subject: [python-win32] Launching an application from python Message-ID: >I am a physicist turned programmer for a current project I'm >working on and >am rather new to python GUI programming. I would like to know if it is >possible to launch an application like adobe from my >application simply by >programming the commands into a button. I have a few protocols >that are in >pdf format and I would like to pull up the protocol in adobe >as an on the >fly help while calibrating a linear accelerator using my GUI >interface. Is >this possible on windows and how would I go about doing it. I >know on a Mac >I can make os.system calls but am unfamiliar with how to do >this on windows. Assuming that you have Acrobat Reader installed (or some equivalent thing) and associated with .pdf files, the simplest thing is: import os os.startfile (r"c:\temp\blah.pdf") os.system will work, but you'll need the full path to the Acrobat Reader import os ACRORD = r"c:\Program Files\Adobe\Acrobat 5.0\Reader\acrord32.exe" os.system ('"%s" %s' % (ACRORD, r"c:\temp\blah.pdf")) You could -- and I mention this merely for completeness -- use os.startfile to launch the reader without a file. The slight subtlety is that os.startfile (which uses the ShellExecute api under the covers) honours AppPath shortcuts which applications can use to link a name (such as "acrord32") to a longer executable path: import os os.startfile ("acrord32") TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From simon at arrowtheory.com Fri Apr 23 09:02:10 2004 From: simon at arrowtheory.com (Simon Burton) Date: Fri Apr 23 00:05:31 2004 Subject: [python-win32] cygwin etc. Message-ID: <20040423140210.7f13babf.simon@arrowtheory.com> Hi all, I am looking to build and distribute python extensions for win32 using cygwin/mingw. So far I have tried these installations: 1) the standard python exe installer 2) cygwin python 3) python built from source (with cygwin) My requirements are: pygame, pyopengl, numarray, etc. etc. I have tried many permutations so far and am seriously lost. Option 1 seemed to be the most promising, but led to a lot of missing symbols with "__imp__" prefixes. (i thought i did the pexport/dlltool dance correctly, but maybe not). Just retrying option 1 now... (version 2.2.2). Why doesn't python run in my rxvt ?? Anyway, distutils is telling me my platform is "nt" and it doesn't know about "mingw" on that platform. Can anyone help out? Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 02 6249 6940 http://arrowtheory.com From simon at arrowtheory.com Fri Apr 23 11:34:29 2004 From: simon at arrowtheory.com (Simon Burton) Date: Fri Apr 23 02:37:54 2004 Subject: [python-win32] cygwin/mingw issues Message-ID: <20040423163429.5151a528.simon@arrowtheory.com> I'm trying to build an extension for python2.2.2 and distutils on cygwin. -cmingw has error: cant compile on platform "nt" with "mingw" compiler -ccygwin has the LONG_BIT error.. I can't even find where LONG_BIT is defined :( This is on win98, not NT.. Any ideas? I seem to be making some progress building this extension manually. Looks like the -mno-cygwin option to gcc is the way to go. Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 02 6249 6940 http://arrowtheory.com From simon at arrowtheory.com Fri Apr 23 13:32:20 2004 From: simon at arrowtheory.com (Simon Burton) Date: Fri Apr 23 04:35:46 2004 Subject: [python-win32] Re: cygwin/mingw issues In-Reply-To: References: <20040423163429.5151a528.simon@arrowtheory.com> Message-ID: <20040423183220.04ab4922.simon@arrowtheory.com> On Fri, 23 Apr 2004 09:13:52 +0200 Thomas Heller wrote: > I made a quick test (I normally use MSVC): > It seems to work with -cmingw32. From cmd, have not tried from cygwin. > > Although I get linker errors, probably because I don't have libpython.a > or how this is named. > > Thomas thanks thomas. I'd been sitting in front of google for three days and needed someone to talk to. It works now! woo hoo! Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 02 6249 6940 http://arrowtheory.com From arlis at endevouraerospace.com Fri Apr 23 11:49:46 2004 From: arlis at endevouraerospace.com (Arlis Rose) Date: Fri Apr 23 14:18:19 2004 Subject: [python-win32] Embedding Python in C++ headaches Message-ID: <007c01c4294a$a102a3c0$b100a8c0@DAEMONS> Okay, this has really got me stuck so I hope someone can help me out :) Basically I just want to call a Python module from within my MFC code, it works fine on my main machine where Python has been installed, however I would like to be able to execute the code on a machine without having to install python first (so get the python interpreter to run via the .Dll file). Thus far, whenever I run my MFC executable on a machine without python installed, it crashes in module python23.Dll. Of course I have NO idea what is causing it to crash (is it perhaps looking for another file? is it not possible to run python from C++ using just the module itself and the dll?). I am using python23, visual studio .Net, and winXp (if any or all of that is needed). Here is an example of my C++ code calling the python module: Py_Initialize(); pModule=PyImport_ImportModule("IPADDRESS"); pDict=PyModule_GetDict(pModule); pFunc=PyDict_GetItemString(pDict, "IPADDRESS"); pValue=PyObject_CallFunction(pFunc, ""); char gh[16]; strcpy(gh, PyString_AsString(pValue)); Py_INCREF(pModule); Py_INCREF(pDict); Py_INCREF(pFunc); Py_INCREF(pValue); Py_Finalize(); When I call this in the C++ code, I simply add "#include " and everything works fine. Now I need to know what I need to include with my Release executable in order to get the python interpreter to run correctly (It's so odd because it runs fine on the 3 machines that have python23 pre-installed, but we would prefer not to force an installation of python if possible). Is it possible that python23.dll requires addition files beyond the module itself in order to execute? And if this is possible, how can I determine what those files may be? The approach I have had to use thus far is to use py2exe to create an executable of the python code, then I can call the executable from my C++ code using a system call. However, this forces the user to deal with the command-prompt window popping up while the python script is running (and of course the user is very much aware that all process's in the program have stopped while that script is running). I've looked at LOTS of tutorials and advice on how to embed but can't seem to get anything to work if python isn't previously installed (is it necessary for it to be Installed???). Anyways, any help would be much appreciated, either on how to embed in visual Studio .NET c++ code properly, or even a way to call a python executable from a C++ program without having a pop-up window (quasi-dos) flash up on the screen (so I guess would need to use something other than system to make that call). From Mike.Tallhamer at USONCOLOGY.COM Fri Apr 23 17:07:31 2004 From: Mike.Tallhamer at USONCOLOGY.COM (Mike.Tallhamer@USONCOLOGY.COM) Date: Fri Apr 23 17:15:46 2004 Subject: [python-win32] Python interacting with Adobe Message-ID: <1D09B341F14C6E429F374C2FC17E7CBFD00908@utx001sx011.usoncology.com> I have a protocol which is in Adobe Acrobat format containing data entry field which I would like to fill in automatically with the values calculated from my program. Does anyone know if you can enter the values into an Adobe file straight from a python program? And if you can: How would you determine the field to enter the value into (can you get their order some how)? If any one knows of some sort of documentation on this that would be great! Thank you for any help you can provide concerning this matter Michael Tallhamer Medical Physicist Department of Radiation Oncology Rocky Mountain Cancer Centers ----------------------------------------- The contents of this electronic mail message and any attachments are confidential, possibly privileged and intended for the addressee(s) only. Only the addressee(s) may read, disseminate, retain or otherwise use this message. If received in error, please immediately inform the sender and then delete this message without disclosing its contents to anyone. From somesh at qviqsoft.com Sat Apr 24 07:39:53 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Sat Apr 24 07:41:47 2004 Subject: [python-win32] ActiveSkins in win32all Message-ID: <001801c429f0$e14609d0$436a640a@qsoft25> I got small utility named Activeskin which skins my application. its ocx, i have to drag into my vb/vc app and call the function. then my app works with specified skin. may i know how to do it with win32 python ui ? Somesh Bartakke Q-Soft Pvt Ltd,Pune. ----------------- Many things in life will catch your eye but few will catch your heart... Pursue those. From mhammond at skippinet.com.au Sun Apr 25 22:19:08 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun Apr 25 22:19:35 2004 Subject: [python-win32] ANNOUNCE: Build 201 of the Python for Windows extensions uploaded. Message-ID: <00b201c42b34$dbea0fa0$0200a8c0@eden> Hi all, I've released build 200 of the pywin32 (previously known as win32all) extensions. The change summary is included below, and is available now at sourceforge! Please let me know if you notice any problems. * Few service problems in the last build were fixed. * More security fixes and enhancements from Roger Upole * FindFilesW now handles unicode correctly and without translation. * win32net functions will no longer crash with invalid usage of the resume handle. * Shell extensions get a major upgrade, and almost all interfaces needed for full blown extensions are supported. See the samples in shell\demos. * Drag and Drop and OLE Clipboard interfaces supported. * Occasional deadlock in win32gui fixed. * makepy fixes: names starting with "__" should work, sys.stdout is no longer redirected during generation, and various other bugs fixed. Some typelibs did not have all interfaces generated, and therefore always used dynamic objects - notably, "Indesign.Application" * The COM browser would refuse to allow some typelibs to be selected (ones with REG_EXPAND_SZ strings in the registry). This has been fixed. * Fix some memory leaks when using win32com.universal * New win32rcparser module (from the SpamBayes project) for parsing Windows .rc files, and returning structures suitable for win32gui (eg, dialog tuples, etc) * New win32com.taskscheduler package, by Roger Upole, for working with Windows 2000 "scheduled tasks". Very cool! * win32gui gets better support for menus, accelerators, and raw message dispatching. * Improvements to distutils build process, and the source distribution. * win32pdh.GetCounterInfo() would fail on XP * COM now supports arbitrarily sized arrays (thanks to Stefan Schukat) * time.Format() now supports dates pre 1970 (thanks to David Fraser) * Source distribution is now fairly complete, and can be used to build and install the extensions. Regards, Mark From mhammond at skippinet.com.au Sun Apr 25 22:24:04 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun Apr 25 22:24:25 2004 Subject: [python-win32] RE: ANNOUNCE: Build 201 of the Python for Windows extensions uploaded. Message-ID: <00c801c42b35$8bef3fb0$0200a8c0@eden> I wrote: > I've released build 200 of the pywin32 (previously known as Oops - the subject is correct - the new build is 201. Mark. From somesh at qviqsoft.com Mon Apr 26 00:07:43 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Mon Apr 26 00:06:13 2004 Subject: [python-win32] .rc files with win32 python Message-ID: <000b01c42b44$0be27ee0$436a640a@qsoft25> thanx Mark, is there any small tute how to use rc parser thru python ? Somesh Bartakke Q-Soft Pvt Ltd,Pune. ----------------- "I've missed more than 9000 shots in my career. I've lost almost 300 games. 26 times, I've been trusted to take the game winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed." - Michael Jordan - From somesh at qviqsoft.com Mon Apr 26 00:35:36 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Mon Apr 26 00:34:06 2004 Subject: [python-win32] .rc files with win32 python References: <000b01c42b44$0be27ee0$436a640a@qsoft25> Message-ID: <000a01c42b47$f1239590$436a640a@qsoft25> > is there any small tute how to use rc parser thru python ? I got demo here in distro but my need is any Ref mtrl ..is there ? > Somesh Bartakke > Q-Soft Pvt Ltd,Pune. > ----------------- > "I've missed more than 9000 shots in my career. I've lost almost 300 games. > 26 times, I've been trusted to take the game winning shot and missed. I've > failed over and over and over again in my life. And that is why I succeed." > - Michael Jordan - > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From mhammond at skippinet.com.au Mon Apr 26 00:53:43 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Apr 26 00:54:17 2004 Subject: [python-win32] .rc files with win32 python In-Reply-To: <000a01c42b47$f1239590$436a640a@qsoft25> Message-ID: <003301c42b4a$74aa0410$0200a8c0@eden> > > is there any small tute how to use rc parser thru python ? > > I got demo here in distro but my need is any Ref mtrl ..is there ? I'm afraid not. I'd happily include any documentation or examples anyone contributed (just sending me HTML would be fine). Unfortunately, it really isn't a huge improvement over the existing "dynamic dialogs" scheme - all it does it allow you to maintain those ugly dialog tuples in the .rc file (and continue to edit it using MSVC independent of your .py source). Unfortunately, the dynamic dialogs don't have any real docs either, but suffice it to say, there is no "high-level" dialog framework in place for this - you still deal with the windows messages etc directly. Depending on your perspective, this is both a good and a bad thing :) So I'm not sure that docs on the parser is all you are after - possibly you are after ref material more related to using dialogs via win32gui? Either way, I'm afraid the answer is still the same :( Mark. From mhammond at skippinet.com.au Mon Apr 26 01:06:13 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Apr 26 01:06:55 2004 Subject: [python-win32] RE: ANNOUNCE: Build 201 of the Python for Windowsextensions uploaded. In-Reply-To: <00c801c42b35$8bef3fb0$0200a8c0@eden> Message-ID: <003501c42b4c$3d544be0$0200a8c0@eden> Roger Upole has noticed a minor bug in build 201 - Pythonwin will generate a traceback if you attempt to print unicode characters. I have re-packaged the build, and the new version is now on sourceforge. The "File Release" text mentions the screw-up, and re-brands it as build "201.1". The filenames for download are still the same. If you already downloaded build 201 before the new release, you may find it simpler to change the single .py file affected by the change. The change is in pythonwin\pywin\framework\winout.py. Both lines 441 and 446 read: if not isinstance(type, UnicodeType): They both should change to: if not isinstance(item, UnicodeType): Note the indentation is different for both lines, and should remain unchanged. My apologies for the inconvenience, Mark. From niki at vintech.bg Mon Apr 26 05:26:41 2004 From: niki at vintech.bg (Niki Spahiev) Date: Mon Apr 26 05:28:03 2004 Subject: [python-win32] Python interacting with Adobe In-Reply-To: <1D09B341F14C6E429F374C2FC17E7CBFD00908@utx001sx011.usoncology.com> References: <1D09B341F14C6E429F374C2FC17E7CBFD00908@utx001sx011.usoncology.com> Message-ID: <408CD5D1.6000305@vintech.bg> Mike.Tallhamer@USONCOLOGY.COM wrote: > I have a protocol which is in Adobe Acrobat format containing data entry > field which I would like to fill in automatically with the values calculated > from my program. > > Does anyone know if you can enter the values into an Adobe file straight > from a python program? > And if you can: How would you determine the field to enter the value into > (can you get their order some how)? > > If any one knows of some sort of documentation on this that would be great! > > Thank you for any help you can provide concerning this matter Check if reportlab can do that. http://reportlab.org HTH Niki Spahiev From tim.golden at viacom-outdoor.co.uk Mon Apr 26 05:33:49 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Mon Apr 26 05:35:39 2004 Subject: [python-win32] Python interacting with Adobe Message-ID: >> I have a protocol which is in Adobe Acrobat format >containing data entry >> field which I would like to fill in automatically with the >values calculated >> from my program. >> >> Does anyone know if you can enter the values into an Adobe >file straight >> from a python program? >> And if you can: How would you determine the field to enter >the value into >> (can you get their order some how)? >> >> If any one knows of some sort of documentation on this that >would be great! >> >> Thank you for any help you can provide concerning this matter > >Check if reportlab can do that. http://reportlab.org This is one of these things that comes up from time to time, and unfortunately there doesn't seem to be any *free* toolkit which will read / manipulate Acrobat files. (I'm quite happy to be contradicted here). There are several toolkits which will *generate* Acrobat files, most notably Reportlab. Reportlab do offer tools to read and manipulate, but they're pay-for licenses, and quite expensive as far as I can remember. Of course, if your application allows for the re-generation of the entire document with the values filled in in the appropriate places, then Reportlab is probably for you: the example-of-the-month on the top right of their homepage (reportlab.org) usually showcases this kind of thing. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From Paul.Moore at atosorigin.com Mon Apr 26 11:01:44 2004 From: Paul.Moore at atosorigin.com (Moore, Paul) Date: Mon Apr 26 11:01:43 2004 Subject: [python-win32] ANNOUNCE: Build 201 of the Python for Windowsextensions uploaded. Message-ID: <16E1010E4581B049ABC51D4975CEDB88052CB08E@UKDCX001.uk.int.atosorigin.com> From: Mark Hammond > * New win32com.taskscheduler package, by Roger Upole, for working > with Windows 2000 "scheduled tasks". Very cool! Any sample code anywhere? I couldn't see any. The docstring isn't very informative... Just an example of how to create a new task would be nice. And how to deal with tasks with username/password details (something you can't do with WMI :-() Thanks, Paul. __________________________________________________________________________ This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. __________________________________________________________________________ From mkn6 at bellsouth.net Mon Apr 26 11:04:40 2004 From: mkn6 at bellsouth.net (Matt Keranen) Date: Mon Apr 26 11:04:45 2004 Subject: [python-win32] Error calling client.Dispatch with SQLDMO Message-ID: <20040426150440.MEXN1774.imf21aec.mail.bellsouth.net@mail.bellsouth.net> When attempting to set an object as follows: import win32com.client from win32com.client import DispatchBaseClass s = win32com.client.Dispatch('SQLDMO.SQLServer') I get the error below, but only on the first call. A subsequent call to the exact same Dispatch correctly creates the object. Note that other objects creat without any errors (for example ADODB.Connection). Any idea how to resolve?: Traceback (most recent call last): File "sqldmo.py", line 3, in ? s = win32com.client.Dispatch('SQLDMO.SQLServer') File "C:\Python\Lib\site-packages\win32com\client\__init__.py", line 96, in Di spatch return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, UnicodeToSt ring, clsctx) File "C:\Python\Lib\site-packages\win32com\client\__init__.py", line 38, in __ WrapDispatch klass = gencache.GetClassForCLSID(resultCLSID) File "C:\Python\Lib\site-packages\win32com\client\gencache.py", line 179, in G etClassForCLSID mod = GetModuleForCLSID(clsid) File "C:\Python\Lib\site-packages\win32com\client\gencache.py", line 232, in G etModuleForCLSID __import__(sub_mod_name) File "C:\Python\lib\site-packages\win32com\gen_py\10010001-E260-11CF-AE68-00AA 004A34D5x0x8x0\_SQLServer2.py", line 27, in ? class _SQLServer2(DispatchBaseClass): NameError: name 'DispatchBaseClass' is not defined From rwupole at msn.com Mon Apr 26 11:27:41 2004 From: rwupole at msn.com (Roger Upole) Date: Mon Apr 26 11:29:32 2004 Subject: [python-win32] Re: ANNOUNCE: Build 201 of the Python for Windowsextensions uploaded. Message-ID: <000801c42ba3$04893120$6811780a@sbynt1> Demos are here: http://cvs.sourceforge.net/viewcvs.py/pywin32/pywin32/com/win32comext/taskscheduler/test/ Looks like they didn't make it into the distribution. Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040426/239841c9/attachment-0001.html From eamonn_sullivan at blueyonder.co.uk Mon Apr 26 11:34:03 2004 From: eamonn_sullivan at blueyonder.co.uk (eamonn_sullivan@blueyonder.co.uk) Date: Mon Apr 26 11:34:09 2004 Subject: [python-win32] Faster loading? Message-ID: <1F234ED1D1BD824C9CDE9931DBFEF16A0350DE3F@ECOWV03M.Telewest.Internal> Apologies if this is an old question, but I wasn't able to find an answer by googling or searching the archives. I have two simple applications using wxWidgets (2.5.1.5u) and python (2.3) that does some calculations on stock prices (find the last time a stock moved this much or was at today's value). I'm distributing it using py2exe (0.5.0). The main windows in both cases are dialog-like with less than two dozen controls each. The app executables are just 24KB each. But of course those load many tens of megabytes of python and wx code before running. The problem I'm having is that they take a long time to start up. On some our slower PCs, it can take a minute or more. That's prompting some users to click on the icon two or three times because they think it didn't work. Then three copies launch (behind another window, so they can't see it -- the usual novice-support blues). I'm trying to quickly throw something on the screen so that the user is aware that the app is coming, eventually. I tried a splashscreen, like so: class MyApp(wxApp): def OnInit(self): bmp = wx.Image("lib/splash.bmp").ConvertToBitmap() splash = wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 6000, None, -1) wx.BeginBusyCursor() splash.Show() wxInitAllImageHandlers() self.main = wxMoveSince.create(None) self.main.CentreOnScreen() self.main.Show() self.SetTopWindow(self.main) wx.EndBusyCursor() return True def main(): application = MyApp(0) application.MainLoop() But all that does is load the splashscreen immediately (as in a split second) before the main window, so it appears to be the large libraries and not the code itself. Any ideas? What's the fastest way to show some activity on Windows? Should I do a quicker loader in C, just to show the splashscreen and then load the python programs? Is there an alternative executable maker that may be faster? From ta-meyer at ihug.co.nz Mon Apr 26 02:48:17 2004 From: ta-meyer at ihug.co.nz (Tony Meyer) Date: Mon Apr 26 11:37:41 2004 Subject: [python-win32] COM Crash with 201.1 Message-ID: <1ED4ECF91CDED24C8D012BCF2B034F1304677CDF@its-xchg4.massey.ac.nz> I have a reasonably simple script that basically pastes some data into Excel (2002) then does various changes to pretty the data up. With build 201.1 this code crashes Python (not with a traceback, but with the WinXP "do you want to report this problem" dialog. If I comment out the data pasting, then the pretty-it-up code works. If I comment out the pretty-it-up code, then the data pasting works. Commenting out some pieces works, others don't, but I can't discern a pattern anywhere. Oddly, this all works happily with build 200 (which I have moved back to). Anyone else experience something like this? Any suggestions about how to progress with debugging this? Thanks, Tony Meyer (If anyone wants the actual script, I can give it to them - if I could figure out an extract that triggers the problem, I'd simply open a bug report, but I can't, annoyingly). From mkn6 at bellsouth.net Mon Apr 26 12:06:55 2004 From: mkn6 at bellsouth.net (Matt) Date: Mon Apr 26 12:07:09 2004 Subject: [python-win32] Error calling client.Dispatch with SQLDMO Message-ID: <20040426160655.OAAK1774.imf21aec.mail.bellsouth.net@mail.bellsouth.net> > Subject: [python-win32] Error calling client.Dispatch with SQLDMO > NameError: name 'DispatchBaseClass' is not defined Problem solved by deleting the related code in Lib\site-packages\win32com\gen_py From rwupole at msn.com Mon Apr 26 22:06:34 2004 From: rwupole at msn.com (Roger Upole) Date: Mon Apr 26 18:50:09 2004 Subject: [python-win32] Re: COM Crash with 201.1 Message-ID: <000601c42bfc$45e8e3a0$e72af243@rupole> I've got some spare cycles and a fresh debug build. Shoot me a copy of the script that crashes, and I'll take a look. Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040426/91604698/attachment.html From t-meyer at ihug.co.nz Mon Apr 26 20:06:26 2004 From: t-meyer at ihug.co.nz (Tony Meyer) Date: Mon Apr 26 20:06:54 2004 Subject: [python-win32] Re: COM Crash with 201.1 In-Reply-To: <1ED4ECF91CDED24C8D012BCF2B034F13060E4637@its-xchg4.massey.ac.nz> Message-ID: <1ED4ECF91CDED24C8D012BCF2B034F13026F2BC9@its-xchg4.massey.ac.nz> > I've got some spare cycles and a fresh debug build. > Shoot me a copy of the script that crashes, and I'll > take a look. Thanks heaps; I really appreciate the offer. However, the problem seems to have gone away: When I moved back to build 200, I got lots of errors about the gen_py files (both from this script and from SpamBayes), so I removed the gen_py cache directory, which fixed those. Then, this morning, I installed build 201.1 again to test out the script I was about to send you, removed the gen_py cache directory again, and all seems ok. I don't know why this would be, but then, as long as it works, I don't really care :) So if anyone else does run into something like this, try just deleting the gen_py directory and trying again. Thanks again for the offer Roger (and if it does reoccur, I might take you up on it). Cheers, Tony Meyer From mhammond at skippinet.com.au Mon Apr 26 20:51:47 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Apr 26 20:52:11 2004 Subject: [python-win32] Re: ANNOUNCE: Build 201 of the Python forWindowsextensions uploaded. In-Reply-To: <000801c42ba3$04893120$6811780a@sbynt1> Message-ID: <09b301c42bf1$d23e2fa0$0200a8c0@eden> Damn - and neither did the shell demos. It looks like the shell demos didn't make build 200 either, but I never noticed and noone ever brought it to my attention :) I've fixed the install script. Mark. -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of Roger Upole Sent: Tuesday, 27 April 2004 1:28 AM To: python-win32@python.org Subject: [python-win32] Re: ANNOUNCE: Build 201 of the Python forWindowsextensions uploaded. Demos are here: http://cvs.sourceforge.net/viewcvs.py/pywin32/pywin32/com/win32comext/tasksc heduler/test/ Looks like they didn't make it into the distribution. Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040427/8b0aae56/attachment.html From anand at easi.soft.net Tue Apr 27 11:25:56 2004 From: anand at easi.soft.net (Anand K Rayudu) Date: Tue Apr 27 11:20:29 2004 Subject: [python-win32] pythonwin32 UI Message-ID: <408E7B84.4000201@easi.soft.net> Hi all, I just joined this group & relatively new to pythonwin. I am sorry if this topic has been discussed already. I have embedded & extended python in to my application. Now i want to take advantage of win32ui layer for my rapid application development environment. Could some one please share their experience, I understood that I can create dialog boxes through vc++ [ .rc files] and load those dialog boxes from python. And I can have some thing similar to message map to have call backs. I create new dialog boxes and i could invoke them from pythonwin32. but if i try to do the same from my embedded application my application is hanging. Could some one suggest me if any special way i can get this? Also i want to develop a layer which can read .frm file[ the one generated by VB for dialog boxes, i guess similar to .rc file in vc++] and create dialog boxes, and provide message loop for call backs. is this achievable?? Any help or some sample code on this topic can be of great help to me. Thanks & Best Regards, Anand From tim.golden at viacom-outdoor.co.uk Wed Apr 28 05:16:41 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Apr 28 05:18:31 2004 Subject: [python-win32] pythonwin32 UI Message-ID: >I just joined this group & relatively new to pythonwin. >I am sorry if this topic has been discussed already. Well you're touching on things which have been touched on before, but I don't recall anything in-depth, possibly because no-one's tried to do it. I would point out that you're actually asking quite a lot of things and in a fairly general-purpose way. You might get more mileage from the collective knowledge of the list if you broke things down a bit and were more specific. However... >I understood that I can create dialog boxes through vc++ [ .rc files] >and load those dialog boxes from python. Yes, but this is very new functionality (imported recently from the SpamBayes project) so I doubt anyone's too familiar with it except for the people on that project. >And I can have some thing similar to message map to have call backs. Have a look at some of the scripts in the "demos" folder under wherever you've installed pywin32. In particular, anything starting with win32gui_... (in my case, c:\python22\lib\site-packages\win32\demos) >I create new dialog boxes and i could invoke them from pythonwin32. >but if i try to do the same from my embedded application my >application >is hanging. >Could some one suggest me if any special way i can get this? Can't help on this one, but frankly it could be absolutely anything; you need to supply some code or at least some more information. >Also i want to develop a layer which can read .frm file[ the one >generated by VB for dialog boxes, i guess similar to .rc file in vc++] >and create dialog boxes, and provide message loop for call backs. >is this achievable?? Of course it's achievable: the .frm structure looks eminently parseable, and setting up a callback loop should be possible (it may already have been done somewhere within the win32ui code; I've never tried) but it would be a fair bit of work. Is there no other solution that might meet the case? Using something like wxGlade to define the layouts? >Any help or some sample code on this topic can be of great help to me. I'm sorry that this hasn't been all that informative a reponse, but I thought I'd make some response, just to show that the list is alive. If you haven't already, you might also try posting to comp.lang.python (aka the python mailing list: http://www.python.org/mailman/listinfo/python-list). There are more people reading that list than this (I suppose). TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From rasjidw at openminddev.net Wed Apr 28 06:46:57 2004 From: rasjidw at openminddev.net (Rasjid Wilcox) Date: Wed Apr 28 06:47:10 2004 Subject: [python-win32] pythonwin32 UI In-Reply-To: <408E7B84.4000201@easi.soft.net> References: <408E7B84.4000201@easi.soft.net> Message-ID: <200404282046.57389.rasjidw@openminddev.net> On Wednesday 28 April 2004 01:25, Anand K Rayudu wrote: > Also i want to develop a layer which can read .frm file[ the one > generated by VB for dialog boxes, i guess similar to .rc file in vc++] > and create dialog boxes, and provide message loop for call backs. You could have a look at vb2py. (http://vb2py.sourceforge.net/) Acording to its webpage, one of the things it does is translate VB forms into PythonCard forms. Cheers, Rasjid. From somesh at qviqsoft.com Wed Apr 28 07:31:06 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Wed Apr 28 07:29:45 2004 Subject: [python-win32] pythonwin32 UI References: <408E7B84.4000201@easi.soft.net> Message-ID: <004801c42d14$52230880$436a640a@qsoft25> do u know that you can generate Resource Only Dll with VC then use that dll and contents of that dll by importing that dll in your app. Somesh Bartakke Q-Soft Pvt Ltd,Pune. ----------------- "I've missed more than 9000 shots in my career. I've lost almost 300 games. 26 times, I've been trusted to take the game winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed." From mhammond at skippinet.com.au Wed Apr 28 08:28:30 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Apr 28 08:28:57 2004 Subject: [python-win32] pythonwin32 UI In-Reply-To: <408E7B84.4000201@easi.soft.net> Message-ID: <175f01c42d1c$50cb6e20$0200a8c0@eden> > I have embedded & extended python in to my application. Now i want to > take advantage of > win32ui layer for my rapid application development environment. Note that due to histe^Horical reasons, win32ui is a wrapper around MFC (a more object-oriented framework), whereas win32gui is a very raw wrapper around the GUI related API functions. > I understood that I can create dialog boxes through vc++ [ .rc files] > and load those dialog boxes from python. > And I can have some thing similar to message map to have call backs. > > I create new dialog boxes and i could invoke them from pythonwin32. > but if i try to do the same from my embedded application my > application > is hanging. > Could some one suggest me if any special way i can get this? It "should work" :) By using win32ui, you are including all the MFC framework, which can get in the way. win32gui generally has less side-effects, but may still impact when embedded with other GUI frameworks that make their own assumptions. If you are using win32gui rather than win32ui, then ensure you have build 201 installed - an obscure win32gui hang was fixed in that build. But otherwise, unfortunately, and as usual, the best answer is to reduce the problem down to the smallest possible sample code that demonstrates the problem. > Also i want to develop a layer which can read .frm file[ the one > generated by VB for dialog boxes, i guess similar to .rc file > in vc++] > and create dialog boxes, and provide message loop for call backs. That should be quite simple, and a reference to vb2py has already been made. Note however that "message loop for callbacks" is still fairly low-level - you are dealing with the various Windows messages, which really can't be considered a friendly callback framework. I *still* can't believe how hard GUIs are, even with a decent framework; a conceptual leap is waiting to happen here, IMO. Mark. From jcanto at hispasec.com Wed Apr 28 09:15:38 2004 From: jcanto at hispasec.com (Julio Canto) Date: Wed Apr 28 09:13:39 2004 Subject: [python-win32] Graphics In-Reply-To: <175f01c42d1c$50cb6e20$0200a8c0@eden> References: <175f01c42d1c$50cb6e20$0200a8c0@eden> Message-ID: <408FAE7A.4070404@hispasec.com> Hi there, I wanted to generate some statistical graphics with Python in a Win32 environment. I've been successfully using the COM interface with a commertial product (SwiftChart) but I wanted to know if there's a more 'lightweight' approach for such kind of stuff. I've been searching for some information that could explain the possibility to use MS Graph for this subject (as I've used that component in VB in other developings) but I haven't find anything. I used makepy for extracting an interface for that component and I've tried a couple of tests, but curiously, it tells me this: pywintypes.com_error: (-2147221164, 'Class not registered', None, None) Probably the problem is that I skipped a step or something, but I don't know what. Thank you in advance, JC From tim.golden at viacom-outdoor.co.uk Wed Apr 28 09:31:40 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Apr 28 09:33:27 2004 Subject: [python-win32] Graphics Message-ID: >Hi there, >I wanted to generate some statistical graphics with Python in a Win32 >environment. I've been successfully using the COM interface with a >commertial product (SwiftChart) but I wanted to know if there's a more >'lightweight' approach for such kind of stuff. Aside from your MS Graph suggestion, the following might be worth investigating: + Matplotlib: http://matplotlib.sourceforge.net/ + ReportLab: http://reportlab.org/ (see the examples: http://reportlab.org/contribs.html and especially http://reportlab.org/meteo.html) + Gnuplot: http://gnuplot-py.sourceforge.net/ Also, just Google over comp.lang.python for "graphs" (and then exclude all that mathematical stuff about cyclic trees and edges). TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From anand at easi.soft.net Thu Apr 29 00:47:27 2004 From: anand at easi.soft.net (Anand K Rayudu) Date: Thu Apr 29 00:42:09 2004 Subject: [python-win32] pythonwin32 UI References: <175f01c42d1c$50cb6e20$0200a8c0@eden> Message-ID: <409088DF.9070604@easi.soft.net> Hi Everybody, Thanks a lot for all the suggestions. Now it looks more clear to me & want to proceed further. Also i will try to solve the embedded problem, by minimizing to smallest sample code. I feel that there could be another module to build GUIs quickly using win32 frame work. [ As it is default with python win32. My application is based on MFC architecture, so I prefer to use MFC controls so that GUI provided by customization also will have same look & feel & behavior] As I see all necessary architecture & base work has been done. So may be a GUI builder can wrap this frame work and provide a higher level of interface to python users. Currently to use this module looks like we need to know little more of MFC & internals of python. This is not to criticize just my feel of possible development in future. I will be glad to contribute my piece of work in this area. Thanks again Best Regards, Anand Mark Hammond wrote: >>I have embedded & extended python in to my application. Now i want to >>take advantage of >>win32ui layer for my rapid application development environment. >> >> > >Note that due to histe^Horical reasons, win32ui is a wrapper around MFC (a >more object-oriented framework), whereas win32gui is a very raw wrapper >around the GUI related API functions. > > > >>I understood that I can create dialog boxes through vc++ [ .rc files] >>and load those dialog boxes from python. >>And I can have some thing similar to message map to have call backs. >> >>I create new dialog boxes and i could invoke them from pythonwin32. >>but if i try to do the same from my embedded application my >>application >>is hanging. >>Could some one suggest me if any special way i can get this? >> >> > >It "should work" :) By using win32ui, you are including all the MFC >framework, which can get in the way. win32gui generally has less >side-effects, but may still impact when embedded with other GUI frameworks >that make their own assumptions. > >If you are using win32gui rather than win32ui, then ensure you have build >201 installed - an obscure win32gui hang was fixed in that build. > >But otherwise, unfortunately, and as usual, the best answer is to reduce the >problem down to the smallest possible sample code that demonstrates the >problem. > > > >>Also i want to develop a layer which can read .frm file[ the one >>generated by VB for dialog boxes, i guess similar to .rc file >>in vc++] >>and create dialog boxes, and provide message loop for call backs. >> >> > >That should be quite simple, and a reference to vb2py has already been made. >Note however that "message loop for callbacks" is still fairly low-level - >you are dealing with the various Windows messages, which really can't be >considered a friendly callback framework. I *still* can't believe how hard >GUIs are, even with a decent framework; a conceptual leap is waiting to >happen here, IMO. > >Mark. > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040429/eeb20105/attachment.html From somesh at qviqsoft.com Thu Apr 29 06:55:39 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Thu Apr 29 06:54:21 2004 Subject: [python-win32] coding standards ?? Message-ID: <004701c42dd8$8d688680$436a640a@qsoft25> while programming with win32 SDK or MFC ( with C / C++) on windows we are using hungerian style for variable declaration etc. is there any std like that is available for python ? Somesh Bartakke Q-Soft Pvt Ltd,Pune. ----------------- "I've missed more than 9000 shots in my career. I've lost almost 300 games. 26 times, I've been trusted to take the game winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed." - Michael Jordan - From sdahlbac at abo.fi Thu Apr 29 07:20:44 2004 From: sdahlbac at abo.fi (sdahlbac@abo.fi) Date: Thu Apr 29 07:20:52 2004 Subject: [python-win32] coding standards ?? In-Reply-To: <004701c42dd8$8d688680$436a640a@qsoft25> References: <004701c42dd8$8d688680$436a640a@qsoft25> Message-ID: <1083237644.4090e50c641a7@webmail.abo.fi> Quoting Somesh Bartakke : > while programming with win32 SDK or MFC ( with C / C++) on windows we > are > using > hungerian style for variable declaration etc. > is there any std like that is available for python ? http://www.python.org/peps/pep-0008.html (...and pep 7 for python code in C) From therve at neocles.com Thu Apr 29 07:25:04 2004 From: therve at neocles.com (=?ISO-8859-1?Q?Thomas_Herv=E9?=) Date: Thu Apr 29 07:23:09 2004 Subject: [python-win32] coding standards ?? In-Reply-To: <004701c42dd8$8d688680$436a640a@qsoft25> References: <004701c42dd8$8d688680$436a640a@qsoft25> Message-ID: <4090E610.9020202@neocles.com> Hello, Somesh Bartakke wrote: >while programming with win32 SDK or MFC ( with C / C++) on windows we are >using >hungerian style for variable declaration etc. >is there any std like that is available for python ? > > I think everybody should read pep08 : http://www.python.org/peps/pep-0008.html It gives good advice on general coding style, and also naming conventions. >Somesh Bartakke >Q-Soft Pvt Ltd,Pune. > > -- Thomas Herv? From andywil at nortelnetworks.com Thu Apr 29 08:47:10 2004 From: andywil at nortelnetworks.com (Andy Wilson) Date: Thu Apr 29 08:47:15 2004 Subject: [python-win32] Help with data structure Message-ID: <588B15E2E2B1D41180B800508BF934F20CC97773@bmdhd6.europe.nortel.com> Hi Folks, I hope this is the right place to ask this but I would like some advice on appropriate data structures for a data mining application I have. If not the right place, please direct me elsewhere, thanks. type data_type is array (key) of array1 array2 ... array21 end type where:- - key is a combination of four server names, - array1 to array21 are lists of floating type values representing timing information. I use ky = (a, b, c, d) data[ky] = ?? already, what I don't get is how to add the array elements. Regards, Andy Wilson CCPS Technical Prime ________________________________________________________ Nortel Networks, Belfast Lab, Doagh Rd, Newtownabbey, Co Antrim, BT36 6XA, United Kingdom Phone... +44 (1628) 617065 ESN 861-7065 Mobile... +44 (7710) 875958 ESN 748-5958 Yahoo ID : glawsterok _________________________ andywil@nortelnetworks.com ___ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040429/0af5c15b/attachment.html From therve at neocles.com Thu Apr 29 09:14:16 2004 From: therve at neocles.com (=?ISO-8859-1?Q?Thomas_Herv=E9?=) Date: Thu Apr 29 09:12:29 2004 Subject: [python-win32] Help with data structure In-Reply-To: <588B15E2E2B1D41180B800508BF934F20CC97773@bmdhd6.europe.nortel.com> References: <588B15E2E2B1D41180B800508BF934F20CC97773@bmdhd6.europe.nortel.com> Message-ID: <4090FFA7.1010604@neocles.com> Andy Wilson wrote: > Hi Folks, Hi, > I hope this is the right place to ask this but I would like some > advice on appropriate data structures for a data mining application I > have. If not the right place, please direct me elsewhere, thanks. > Well, I don't think it's really the good place :). comp.lang.python should be better. > type data_type is array (key) of > array1 > array2 > ... > array21 > end type > > where:- > - key is a combination of four server names, > - array1 to array21 are lists of floating type values representing > timing information. Not a very "pythonic" way to think. I might do this way : class MyData: def __init__(self; key1, key2, key3, key4) : self.key1 = key1 ... self.key4 = key4 self.array1 = [] self.array2 = [] ... self.array21 = [] # END __init # END MyData ky = (a, b, c, d) data1 = MyData(ky) data1.array12.append(foo) > /Regards, > Andy Wilson/ > > /*CCPS Technical Prime*/ > > / > / > -- Thomas Herv? From tim.golden at viacom-outdoor.co.uk Thu Apr 29 09:14:04 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Thu Apr 29 09:16:09 2004 Subject: [python-win32] Help with data structure Message-ID: AW> I would like some advice on appropriate data structures AW> for a data mining application I have. If not the right AW> place, please direct me elsewhere, thanks. Since what you're asking appears to be a general-purpose Python question, you might get more mileage at comp.lang.python (or its mirrors, python-list@python.org and http://groups.google.com/groups?group=comp.lang.python). Nevertheless... AW> type data_type is array (key) of array1 array2 ... array21 end type where:- - key is a combination of four server names, - array1 to array21 are lists of floating type values representing timing information. I use ky = (a, b, c, d) data[ky] = ?? already, what I don't get is how to add the array elements. Settings -> Screen area In-Reply-To: <192601c4279e$f326aa50$0200a8c0@eden> References: <191101c4279e$1fb8fe70$0200a8c0@eden> <192601c4279e$f326aa50$0200a8c0@eden> Message-ID: <6.0.0.22.0.20040429131155.0391feb8@mail.mric.net> How can I programmatically change Display Properties -> Settings -> Screen area (using the win api?)? Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From tim.golden at viacom-outdoor.co.uk Fri Apr 30 03:31:55 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri Apr 30 03:33:37 2004 Subject: [python-win32] HOW TO change Display Properties -> Settings - > Screen area Message-ID: >How can I programmatically change Display Properties -> >Settings -> Screen >area (using the win api?)? > >Bob Gailer I've never tried it myself, so... I recommend a quick look at this: http://www.swissdelphicenter.ch/torry/showcode.php?id=158 (Useful site this, by the way, in terms of sheer volume of how-do-i questions answered, albeit for Delphi) followed by this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons _7gz7.asp followed by this: http://starship.python.net/crew/theller/ctypes/ followed by letting us know if that was any use at all. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From Martin.Gfeller at comit.ch Fri Apr 30 09:44:06 2004 From: Martin.Gfeller at comit.ch (Gfeller Martin) Date: Fri Apr 30 09:44:20 2004 Subject: [python-win32] Python and Windows XP/2003 low-fragmentation heap Message-ID: Hi, did anyone attempt or succeed running Python using the low-fragmentation heap introduced by Windows XP and 2003 Server? (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/low_fragmentation_heap.asp) The low-fragmentation heap seems to specificially geared towards interpreted languages that perform frequent small mallocs. In our application, I suspect some heap fragmentation bottlenecks (typical scenario: The second run of the a large program in the same process runs slower than the first), even on Python 2.3.3, with its improved object allocator (which I think is only invokved for very small structures; rather than for larger mappings and sequences). I'm interested in (i) performance comparisons, (ii) on how to make standard Python run with it (as Python is compiled using MSVC++, which seems to create its own heap, I don't know how to get at the heap handle). Thank you and best regards, Martin Gfeller _______________________ COMIT Gruppe Risk Management Systems Pflanzschulstrasse 7 CH-8004 Z?rich Telefon +41 (44) 1 298 92 84 http://www.comit.ch http://www.quantax.com - Quantax Trading and Risk System From tony at tcapp.com Fri Apr 30 15:43:46 2004 From: tony at tcapp.com (Tony Cappellini) Date: Fri Apr 30 15:43:48 2004 Subject: [python-win32] Re: Python-win32 Digest, Vol 13, Issue 28 In-Reply-To: Message-ID: <20040430123536.U10843-100000@yamato.yamato.com> > Message: 1 > Date: Thu, 29 Apr 2004 13:14:32 -0600 > From: Bob Gailer > Subject: [python-win32] HOW TO change Display Properties -> Settings > -> Screen area > To: > Message-ID: <6.0.0.22.0.20040429131155.0391feb8@mail.mric.net> > Content-Type: text/plain; charset="us-ascii"; format=flowed > > How can I programmatically change Display Properties -> Settings -> Screen > area (using the win api?)? > > Bob Gailer > bgailer@alum.rpi.edu > 303 442 2625 home > 720 938 2625 cell > > Bob After having done something similar, just these past few weeks, I would suggest that you look to see if anything gets changed in the registry, when you change your display properties, AS WELL AS, looking in system32 for an INI file that gets written to when you change your display properties. (I would expect INI file changes instead of the registry, in your case, but you may want to look in both places) I wanted to be able to control a checkbox in a Control Panel Applet, and was expecting that I had to write some code to open up the Control Panel Applet, change tabs, then check/uncheck the checkbox. It turned out to be totally different. On Win98, the bit I needed to change (which was displayed as a Check Box in a control panel applet) was in the registry. On Win2K, the EXACT same bit, was in an INI file in System32. So I had to write a few classes to abstract the OS-level differences from the top-level application. Please let me know what you find out, because I want to fiddle with some Screensaver bits under the Diplay Properties, as soon as I finish this program From koliphant at qwest.net Fri Apr 30 18:45:24 2004 From: koliphant at qwest.net (Kerry Oliphant) Date: Fri Apr 30 18:44:10 2004 Subject: [python-win32] pythoncom.new behavior in build 200/201 Message-ID: Has anyone noticed that pythoncom.new does not behave the same as it used to. Previously one could pass it something like this: CLSID = IID('{D5193935-0382-4448-A309-60C38795FB60}') pythoncom.new( CLSID ) but in builds 200/201 the above call results in the following error. TypeError: Only strings and iids can be converted to a CLSID. pythoncom.new( str(CLSID) ) will work. It appears the pythoncom.new cannot handle a pyIID object. Any thoughts? Kerry From ricardo at lzt.com.br Fri Apr 30 20:01:26 2004 From: ricardo at lzt.com.br (Ricardo Caesar Lenzi) Date: Fri Apr 30 20:01:36 2004 Subject: [python-win32] Graphics References: Message-ID: <00a101c42f0f$75522870$0432afc8@ricardo> Hi Tim! The best graphics and chart tool that I found for python is gdchart. You can found at: http://www.nullcube.com/software/pygdchart.html It works in Windows and Linux, fits in just one file and is realy fast! ----- Original Message ----- From: "Tim Golden" To: "'Julio Canto'" ; "PythonWin32" Sent: Wednesday, April 28, 2004 10:31 AM Subject: RE: [python-win32] Graphics > >Hi there, > >I wanted to generate some statistical graphics with Python in a Win32 > >environment. I've been successfully using the COM interface with a > >commertial product (SwiftChart) but I wanted to know if there's a more > >'lightweight' approach for such kind of stuff. > > Aside from your MS Graph suggestion, the following might > be worth investigating: > > + Matplotlib: http://matplotlib.sourceforge.net/ > > + ReportLab: http://reportlab.org/ > (see the examples: http://reportlab.org/contribs.html and > especially http://reportlab.org/meteo.html) > > + Gnuplot: http://gnuplot-py.sourceforge.net/ > > Also, just Google over comp.lang.python for "graphs" (and then > exclude all that mathematical stuff about cyclic trees and edges). > > TJG > > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star Internet. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 >