From mhammond at skippinet.com.au Fri Oct 1 00:32:55 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Oct 1 00:33:01 2004 Subject: [python-win32] accessing application object from OnConnectionmethod in another Class In-Reply-To: Message-ID: <094001c4a73d$6efa7d50$040a0a0a@enfoldsystems.local> > If you look at the example demo "ExcelAddin" that come with win32all, FYI, http://cvs.sourceforge.net/viewcvs.py/spambayes/spambayes/Outlook2000/addin. py is a complete Office Addin, and has jumped through many hoops. > > def OnConnection(self, application, connectMode, addin, custom): > self.appHostApp = application > btnMyButton = self.toolbarButton = > DispatchWithEvents(btnMyButton, ButtonEvent) Just ignore the man behind the curtain :) Do it the way you would normally do it! btnMyButton._application = self should just store it in an instance variable. Obviously you will want to avoid conflict with Word's attribute names - we first try and set the attribute to word, and it that fails, store it in the instance. Another alterative is to just add your own method to the event class: class ButtonEvent: # as normal def _MyFunkyMethod(self, whatever): ... btnMyButton = DispatchWithEvents(btnMyButton, ButtonEvent) btnMyButton._MyFunkyMethod(self) Note that you need to be very careful with DispatchWithEvents and circular references. These DWI objects have a reference to the original object (eg, the Excel object the events are being sourced from), and the original object has a reference to the DWI object (as that is where it is delivering events). Eg, a = Dispatch("Word.App") e = DispatchWithEvents(a, myclass) 'e' has a reference to 'a', and 'a' has a reference to 'e' - this is a circular reference that must be manually broken. However: a = Dispatch("Word.App") e = WithEvents(a) Avoids that circle - 'a' still holds a reference to 'e', but 'e' holds no reference to a. Thus, as soon as a or e go out of scope, it all still destructs correctly. That is one hoop SpamBayes had to jump through to stop certain events leaking. > to name a few. I have also spent some time in the MSDN and Google and > still am confused. Have ordered Marks book "Python programming on > win32" but it will only be here in 10 days (i count the minutes). so Mark. From blipbeep at gmail.com Fri Oct 1 00:34:48 2004 From: blipbeep at gmail.com (Alias Alias) Date: Fri Oct 1 00:34:57 2004 Subject: [python-win32] How do I get a PyIMAPIProps ? In-Reply-To: <004301c4a52a$a51ae830$040a0a0a@enfoldsystems.local> References: <934895d004092723375e095bf0@mail.gmail.com> <004301c4a52a$a51ae830$040a0a0a@enfoldsystems.local> Message-ID: <934895d00409301534110df00a@mail.gmail.com> Hey Mark, that was the trick. I was not importing win32com.mapi.mapi I was including everything else but that. On Tue, 28 Sep 2004 17:13:23 +1000, Mark Hammond wrote: > > When I queryinterface for the IMAPIProps or IMessage > > interfaces, it returns > > with an error saying that there isn't an object registered to > > handle the > > object. > > What is the exact error and code? You must have imported win32com.mapi.mapi > before the QI will work (but presumably you have to get those IIDs). > > Check out > http://cvs.sourceforge.net/viewcvs.py/spambayes/spambayes/Outlook2000/sandbo > x/ for some fully functioning utilities which work with these interfaces. I > believe the mapi_send sample I pointed you at before also uses these > interfaces. > > Mark > > From blipbeep at gmail.com Fri Oct 1 00:39:52 2004 From: blipbeep at gmail.com (Alias Alias) Date: Fri Oct 1 00:39:59 2004 Subject: [python-win32] How do I get a PyIMAPIProps ? In-Reply-To: <934895d00409301534110df00a@mail.gmail.com> References: <934895d004092723375e095bf0@mail.gmail.com> <004301c4a52a$a51ae830$040a0a0a@enfoldsystems.local> <934895d00409301534110df00a@mail.gmail.com> Message-ID: <934895d00409301539bf2b19e@mail.gmail.com> I hit enter to soon. :-) > Hey Mark, that was the trick. > I was not importing win32com.mapi.mapi I was including everything > else but that. It was late at night and I did read the __init.py__ in the win32comex directory for mapi. I must have mistyped. This stuff works great and it sure beats having to remember *all* of the nuances around mapi. Excellent work Mark and team! dru From mhammond at skippinet.com.au Fri Oct 1 00:44:18 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Oct 1 00:44:24 2004 Subject: [python-win32] MSWord: Server Busy In-Reply-To: <20040930162406.61230.qmail@web11507.mail.yahoo.com> Message-ID: <094201c4a73f$05b717c0$040a0a0a@enfoldsystems.local> Sleeping and hard loops like this may turn out to be part of the problem. You should enter a loop calling PumpWaitingMessages - something like: end = time.time() + 5 # stop in 5 secs. while time.time() < end: pythoncom.PumpWaitingMessages() time.sleep(0.2) Mark > How about trapping the error with a try block: > > bWorked = false > > while bWorked == false > try > wordApp.ActiveDocument.PageSetup.TopMargin = 5 > bWorked = true > catch > > > it's not pretty but it will try and try until the > server is finished initializing. > > -Fabricio > > --- Bill Papadopoulos wrote: > > > > > >>Hi ! > > > > >>"server busy" c'est souvent du au temps de > > lancement de ms-word > > >> "server busy" it's often because ms-word is slow > > to begin to run. > > >>Ajoute/Add "time.sleep(5)" > > >>Michel Claveau > > > > > > Hello Michael and thank your for responding, > > > > This is what I do before I get the "Server Busy" > > message: > > > > #Setting TopMargin > > wordApp.ActiveDocument.PageSetup.TopMargin = 5 > > > > where wordApp is my Dispatch object. > > > > > > I 've already tried time.sleep() after setting the > > Margin which resulted > > to a "server busy" message and then the script > > "slept". > > > > Also, I tried time.sleep() before setting the Margin > > which resulted > > to make the script wait and then to get the "server > > busy" message. > > > > I need something like: > > > > while waiting for margin to be set: > > time.sleep() > > > > Any suggestions? > > Anyway, thanks again! > > > > > > Vax > > ____________________ > > b_papadopoulos@iris.gr > > vax@cls.gr > > > > > > > > > _______________________________________________ > > Python-win32 mailing list > > Python-win32@python.org > > http://mail.python.org/mailman/listinfo/python-win32 > > > > > > > > __________________________________ > Do you Yahoo!? > New and Improved Yahoo! Mail - 100MB free storage! > http://promotions.yahoo.com/new_mail > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From dolzenko at rsu.ru Tue Oct 5 14:24:23 2004 From: dolzenko at rsu.ru (Eugeni Doljenko) Date: Tue Oct 5 14:22:38 2004 Subject: [python-win32] Python as VBA replacement Message-ID: <022301c4aad6$4035fde0$b0fcd0c3@cooler> [i had send it to this list ofcourse, but already send to python-list, apologies] Yes, topic has been discussed a lot, i know. But i wonder if someone could come up with mature solution. So far i've read about writing COM servers in Python for calling them from VBA. IMO it's possible to write some kind of generic COM server (because of Python dynamic nature)suitable to executing arbitrary Python code. May be even more tighter integration is possible? TIA, Eugeni Doljenko P.S. i'm just so tired with hand coding standart "Url decode" function, and searching for reasonable alternative for iconv in this crappy language of procedures, directives and arbitrary (!) arrays base offset (i use 0, my friend uses 1, why somebody will not use 2 or 3). sorry for off topic PS. From jens.jorgensen at tallan.com Tue Oct 5 16:45:09 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Tue Oct 5 16:45:20 2004 Subject: [python-win32] Python as VBA replacement In-Reply-To: <022301c4aad6$4035fde0$b0fcd0c3@cooler> References: <022301c4aad6$4035fde0$b0fcd0c3@cooler> Message-ID: <4162B375.3070402@tallan.com> You may want to investigate Active Scripting. This allows various scripting engines to be used generically. In fact, Mark Hammond's extensions include the necessary glue to make Python work as an Active Scripting Engine and in fact, Python can be used to write ASP pages. The Active Scripting Engine provides what you're talking about. Of course, I'm not sure this does you any good if an existing application is using VBA. Eugeni Doljenko wrote: > [i had send it to this list ofcourse, but already send to python-list, > apologies] > > Yes, topic has been discussed a lot, i know. But i wonder if someone > could > come up with mature solution. > So far i've read about writing COM servers in Python for calling them > from > VBA. > IMO it's possible to write some kind of generic COM server (because of > Python dynamic nature)suitable to executing arbitrary Python code. > May be even more tighter integration is possible? > > TIA, > Eugeni Doljenko > > P.S. i'm just so tired with hand coding standart "Url decode" > function, and > searching for reasonable alternative for iconv in this crappy language of > procedures, directives and arbitrary (!) arrays base offset (i use 0, my > friend uses 1, why somebody will not use 2 or 3). sorry for off topic PS. > > > > _______________________________________________ > 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: 2861 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20041005/c1e7e9ee/smime.bin From dolzenko at rsu.ru Tue Oct 5 17:12:57 2004 From: dolzenko at rsu.ru (Eugeni Doljenko) Date: Tue Oct 5 17:11:11 2004 Subject: [python-win32] Python as VBA replacement References: <022301c4aad6$4035fde0$b0fcd0c3@cooler> <4162B375.3070402@tallan.com> Message-ID: <02d701c4aaed$cb91fd50$b0fcd0c3@cooler> > You may want to investigate Active Scripting. yes. i know about this stuff. > The Active Scripting Engine provides what you're talking about. I'm digging COM, ActiveX, ActiveX Scripting all that Microsoft manga. At first glance i tried to execute examples, but i haven't succeeded. pyscript_rexec.py says: "Registered: Python Registration of Python ActiveX Scripting Engine (with rexec support) complete." but ActiveX Scripting Demos wont work. maybe it's sp2 feature. it seems i have to play with it more. From luzheng at gmail.com Tue Oct 5 18:33:34 2004 From: luzheng at gmail.com (Lu Zheng) Date: Tue Oct 5 18:40:44 2004 Subject: [python-win32] Problem about formatting a cell in Excel Message-ID: Hi, all, I am trying to copy some strings from a txt file into Excel. And I found that, when I do this: 'xlWorksheet.Cells(a, b).Value = "%1"', excel will format the string "%1" to "1%" when display and the actual value becomes 0.01 How can I turn this autoformatting thing off so that "%1" will remain "%1"? Thanks for your help :p Regards, Lu Zheng From fguzman_slotown at yahoo.com Tue Oct 5 19:20:06 2004 From: fguzman_slotown at yahoo.com (Fabricio Guzman) Date: Tue Oct 5 19:20:11 2004 Subject: [python-win32] Problem about formatting a cell in Excel In-Reply-To: Message-ID: <20041005172006.62719.qmail@web11509.mail.yahoo.com> try this: xlWorksheet.Cells(a, b).Value = "'%1" the apostrophe prefix converts the value to a string constant and excel does not attempt any parsing. -Fabricio --- Lu Zheng wrote: > Hi, all, > > I am trying to copy some strings from a txt file > into Excel. And I found that, > when I do this: > 'xlWorksheet.Cells(a, b).Value = "%1"', > excel will format the string "%1" to "1%" when > display and the actual value > becomes 0.01 > > How can I turn this autoformatting thing off so that > "%1" will remain "%1"? > > Thanks for your help :p > > Regards, > Lu Zheng > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > _______________________________ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com From jeff at ccvcorp.com Tue Oct 5 20:03:18 2004 From: jeff at ccvcorp.com (Jeff Shannon) Date: Tue Oct 5 20:04:46 2004 Subject: [python-win32] Problem about formatting a cell in Excel In-Reply-To: References: Message-ID: <4162E1E6.5050905@ccvcorp.com> Lu Zheng wrote: >Hi, all, > >I am trying to copy some strings from a txt file into Excel. And I found that, >when I do this: > 'xlWorksheet.Cells(a, b).Value = "%1"', >excel will format the string "%1" to "1%" when display and the actual value >becomes 0.01 > >How can I turn this autoformatting thing off so that "%1" will remain "%1"? > > Another approach is to explicitly set the NumberFormat on a cell / range of cells. r = sh.Range(sh.Cells(row1, col1), sh.Cells(row2, col2) ) r.NumberFormat = '@' The '@' format specifier indicates text. I actually use a dict of my "standard" formats to make things a little easier for me: FormatDict = { 'currency' : '$#,##0.00;[Red]-$#,##0.00', 'date' : 'mm/dd/yy', 'percent' : '0.0%', 'text' : '@' } Jeff Shannon Technician/Programmer Credit International From luzheng at gmail.com Wed Oct 6 06:57:19 2004 From: luzheng at gmail.com (Lu Zheng) Date: Wed Oct 6 06:57:30 2004 Subject: [python-win32] Problem about formatting a cell in Excel References: <4162E1E6.5050905@ccvcorp.com> Message-ID: Great, this works. I wonder how I can use your FormatDict. How can I put it in? Thanks, Lu Zheng From dolzenko at rsu.ru Wed Oct 6 08:31:55 2004 From: dolzenko at rsu.ru (Eugeni Doljenko) Date: Wed Oct 6 08:30:16 2004 Subject: [python-win32] Python as VBA replacement References: <022301c4aad6$4035fde0$b0fcd0c3@cooler> Message-ID: <044101c4ab6e$2cab1ba0$b0fcd0c3@cooler> > IMO it's possible to write some kind of generic COM server (because of > Python dynamic nature)suitable to executing arbitrary Python code. > May be even more tighter integration is possible? Here it is: C:\Python23\Lib\site-packages\win32com\servers\interp.py (i had to slightly modify it so Exec function could return values) But because of unbelievably primitive strings we just can't embed python code in VBA functions. It could look so: "import string\n" _ "x = 'asd'\n" _ huh, it's still better than code in vba! From apocalypznow at yahoo.com Wed Oct 6 11:11:13 2004 From: apocalypznow at yahoo.com (apocalypznow) Date: Wed Oct 6 11:03:12 2004 Subject: [python-win32] Passing an IDispatch pointer Message-ID: If a Python call to a COM server passes an IDispatch class (ie: pointer), could the COM server then potentially just call a method on that class? The reason I ask is because there was a question about a COM server firing events such that the communication between the COM server and the Python client was asynchronous. If the COM server could hold an IDispatch pointer to the Python client, and can call methods on that passed in class, then we have a solution for asynchronous calling don't we? From mhammond at skippinet.com.au Wed Oct 6 11:34:33 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Oct 6 11:34:44 2004 Subject: [python-win32] Passing an IDispatch pointer In-Reply-To: Message-ID: <0c4701c4ab87$b0cfce80$050a0a0a@enfoldsystems.local> > If a Python call to a COM server passes an IDispatch class (ie: > pointer), could the COM server then potentially just call a method on > that class? Yep - you will probably need to call win32com.client.Dispatch() with the object to wrap it into a friendly object though. > The reason I ask is because there was a question about a > COM server firing events such that the communication between the COM > server and the Python client was asynchronous. If the COM > server could > hold an IDispatch pointer to the Python client, and can call > methods on > that passed in class, then we have a solution for > asynchronous calling > don't we? That depends on where you are calling from and on the COM threading apartment you are calling from, but yes, COM does allow asynchronous behaviour (via connection-point based events or otherwise) Mark From davidrushby at yahoo.com Wed Oct 6 19:22:39 2004 From: davidrushby at yahoo.com (David Rushby) Date: Wed Oct 6 19:22:46 2004 Subject: [python-win32] How to determine whether program running asservice? In-Reply-To: <20040910174257.62712.qmail@web11002.mail.yahoo.com> Message-ID: <20041006172239.50506.qmail@web11004.mail.yahoo.com> Mark, did you come to any conclusion as to if/how a Python program will be able to ask "am-I-running-as-a-service" in future versions of pywin32? As a reminder, here are some of the proposals discussed on this list in early September: -------------------------- A) sys.serviceexecutable - attribute containing the name of the executable; would only be present if program running as service -------------------------- B) servicemanager.is_service - boolean servicemanager.is_debugging - boolean -------------------------- C) servicemanager.RunningAsService() -> bool [To match the extant servicemanager.Debugging() -> bool] -------------------------- Toward the end of the discussion, you agreed that servicemanager, rather than sys, was the natural location for this functionality, so that eliminates A. Your next proposal was B (boolean attributes), which is fine, but I suggested C (boolean functions) for the sake of symmetry with the existing function servicemanager.Debugging(). Thanks for your time. Is there anything I can do to help ensure that this functionality (regardless of the specific API) makes it into the next release? __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail From jeff at ccvcorp.com Wed Oct 6 19:56:28 2004 From: jeff at ccvcorp.com (Jeff Shannon) Date: Wed Oct 6 19:55:53 2004 Subject: [python-win32] Problem about formatting a cell in Excel In-Reply-To: References: <4162E1E6.5050905@ccvcorp.com> Message-ID: <416431CC.5040202@ccvcorp.com> Lu Zheng wrote: >Great, this works. I wonder how I can use your FormatDict. How can I put it in? > > > > FormatDict = { 'currency' : '$#,##0.00;[Red]-$#,##0.00', 'date' : 'mm/dd/yy', 'percent' : '0.0%', 'text' : '@' } def formatrange(format, row1, col1, row2, col2): range = sheet.Range(sheet.Cells(row1, col1), sheet.Cells(row2, col2) ) range.NumberFormat = FormatDict['text'] # format first four columns / 20 rows as text formatrange('text', 1, 1, 20, 4) # format next column as currency formatrange('currency', 1, 5, 20, 5) Here, FormatDict is a global variable. When I need to format a range of cells, I simply get the a reference to the range using normal methods, and set the NumberFormat property of that range to one of the values held in the FormatDict. The dict just lets me use a human-readable description of the format instead of a potentially-obscure series of punctuation characters. Jeff Shannon Technician/Programmer Credit International From mhammond at skippinet.com.au Wed Oct 6 23:37:05 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Oct 6 23:37:17 2004 Subject: [python-win32] How to determine whether program running asservice? In-Reply-To: <20041006172239.50506.qmail@web11004.mail.yahoo.com> Message-ID: <0deb01c4abec$a047ad20$050a0a0a@enfoldsystems.local> > -------------------------- > C) servicemanager.RunningAsService() -> bool > [To match the extant servicemanager.Debugging() -> bool] > -------------------------- This has been checked into CVS, so will be in the next build (which should be soon!) Mark From mousemouse521 at gmail.com Thu Oct 7 04:22:57 2004 From: mousemouse521 at gmail.com (Leo Jay) Date: Thu Oct 7 04:23:02 2004 Subject: [python-win32] what's wrong with my GMail? Message-ID: <373dff05041006192236a1f83c@mail.gmail.com> what's wrong with my GMail? i can't reply mailing list. there is no response after i clicked the send button. what's wrong? anyone have any idea? Thanks -- Best Regards, Leo Jay From ashok.nagaraj at colorado.edu Thu Oct 7 17:29:19 2004 From: ashok.nagaraj at colorado.edu (ashok.nagaraj@colorado.edu) Date: Thu Oct 7 17:29:22 2004 Subject: [python-win32] using tim golden's wmi.py Message-ID: <1097162959.416560cf074b1@webmail.colorado.edu> Hello All, Has anyone used the wmi.py module to access device drivers info.I want to make sure that it works before i try use it. I am trying to use it to get MSNdis class info. Thanks, -Ashok From tim.golden at viacom-outdoor.co.uk Thu Oct 7 17:38:06 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Thu Oct 7 17:42:44 2004 Subject: [python-win32] using tim golden's wmi.py Message-ID: [ashok.nagaraj@colorado.edu] | Has anyone used the wmi.py module to access device drivers | info.I want to make sure that it works before i try use it. | I am trying to use it to get MSNdis class info. The simplest answer is: this is Python -- just try it. More specifically, since I have no knowledge at all of MSNdis classes, and a quick Google doesn't enlighten me tons, can you give an example of VBS-type code which does what you want? The WMI module simply wraps Win32 COM functionality, so anything should be possible. The sort of things which aren't so obvious / so well covered by my list of examples tend to be things which require slightly unusual use of namespaces, specific monikers etc. (Information from http://www.ndis.com/faq/QA01050301/default.htm) [... pause for experimentation ...] OK. Seems to work. Try this: import wmi c = wmi.WMI (namespace="WMI") print [i for i in c.classes if i.startswith ("MSNdis")] for i in c.MSNdis_LinkSpeed (): # whatever that is (!) print i TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From alex at moreati.org.uk Thu Oct 7 19:08:55 2004 From: alex at moreati.org.uk (Alex Willmer) Date: Thu Oct 7 19:08:57 2004 Subject: [python-win32] what's wrong with my GMail? In-Reply-To: <373dff05041006192236a1f83c@mail.gmail.com> References: <373dff05041006192236a1f83c@mail.gmail.com> Message-ID: <200410071808.56092.alex@moreati.org.uk> On Thursday 07 Oct 2004 03:22, Leo Jay wrote: > what's wrong with my GMail? > i can't reply mailing list. > > there is no response after i clicked the send button. what's wrong? > > anyone have any idea? > > Thanks It may be that your replys are being sent to the originator, rather than the list. When an email is 'reflected' by a mailing list there is a question regarding what the To and Reply-to field should be set. In the case of python-win32 they're both left as the originator's email address. Have a look to see whether GMail has a Reply to List function. Alex From amonroe at columbus.rr.com Thu Oct 7 19:11:40 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Thu Oct 7 19:11:50 2004 Subject: [python-win32] Any plans to implement .rowcount in the odbc module? Message-ID: <19265472043.20041007131140@columbus.rr.com> Any plans to implement .rowcount in the odbc module? I saw it described in the docs at: http://www.python.org/peps/pep-0249.html > Cursor Objects should respond to the following methods and > attributes: > .rowcount > This read-only attribute specifies the number of rows that > the last executeXXX() produced (for DQL statements like > 'select') or affected (for DML statements like 'update' or > 'insert'). I'm eyeballing the source at: http://cvs.sourceforge.net/viewcvs.py/pywin32/pywin32/win32/src/odbc.cpp?rev=1.13&view=markup and I MIGHT be able to hack together something with some hints on which functions I need to edit, but I've never tried building pywin32 from source, so I don't know which compiler is required, etc. Alan From bwinton at latte.ca Thu Oct 7 21:08:18 2004 From: bwinton at latte.ca (Blake Winton) Date: Thu Oct 7 21:08:25 2004 Subject: [python-win32] Re: [Py2exe-users] DllUnregister Question. In-Reply-To: References: <4164222B.3020603@latte.ca> Message-ID: <41659422.90203@latte.ca> Thomas Heller wrote: > Blake Winton writes: >>I've written a COM server in Python, and am in the process of >>packaging it up with an installer/uninstaller, but I'm running into >>some strange behaviour when I try to uninstall my COM server. >>Specifically, the uninstaller loads the dll, calls an exported >>function by the name of DllRegisterServer, then unloads it. But after >>it's done unloading it, the process (as shown by Process Explorer >>v8.52, from www.sysinternals.com) still has a bunch of python-related >>DLLs loaded. >> >>Does the py2exe-d version of a COM server load the dlls it needs when >>it's being unregistered? And should it unload them when it's being >>unloaded? > I'm not really sure but I guess that Python in-process com servers never > free all the python libraries, until the process terminates. Best would > be to ask Mark Hammond, or post a question to the python win32 mailing > list. So that's what I'm doing now. I hope you don't mind being cc-ed in on the discussion, Thomas. Let me know if you've subscribed to python-win32, and I'll remove your name from future replies. > For unregistering, you could try to do it by calling regsvr32.exe. That's a work-around, but it's recommended by the InnoSetup people that I don't do that, and instead use the built-in "regserver" flag, which will cause the setup program to load the dll, call its DllRegister method, and then unload it. (And the uninstall program to load the dll, call its DllUnregister method, and then unload it.) The reason I need to unload all the other dlls is that they're about to be deleted as part of the uninstall. Currently it fails, complaining that they're in use, which they are, by the uninstaller which has inadvertantly loaded them by loading and unloading my COM server. >>I've looked through the newsgroups (both -users and -checkins), and >>the code in CVS, but nothing obvious jumped out at me (which isn't >>completely surprising. If I was a COM master, I probably would have >>written my conduit in C++, not Python). Specifically, I couldn't find >>any calls to "FreeLibrary", which I would have expected to appear in >>py2exe/source/run_dll.c, possibly in the DLL_PROCESS_DETACH portion of >>DllMain. I suppose it could be mapped to the call to >>PyCom_CoUninitialize, but that seems to be commented out. > AFAIK, MS does not allow LoadLibrary or FreeLibrary calls in DllMain > (but again, I'm only guessing right now). I looked that up, and indeed, MS doesn't recommend you call LoadLibrary or FreeLibrary in DllMain. So my next suggestion is to call it in DllUnregisterServer. Specifically, DllUnregisterServer calls check_init, which calls load_pythoncom, which calls LoadLibraryEx. I suggest that we add a check_deinit() method, to be called just before we return, which calls unload_pythoncom, which calls FreeLibrary. Is there any reason not to do that? (Other than the arbitrary "unload_pythoncom" call, which I added for a sense of duality, that is.) Thanks, Blake. From mhammond at skippinet.com.au Fri Oct 8 00:57:40 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Oct 8 00:57:51 2004 Subject: [python-win32] Re: [Py2exe-users] DllUnregister Question. In-Reply-To: <41659422.90203@latte.ca> Message-ID: <110701c4acc1$0cb460f0$050a0a0a@enfoldsystems.local> > I looked that up, and indeed, MS doesn't recommend you call > LoadLibrary > or FreeLibrary in DllMain. So my next suggestion is to call it in > DllUnregisterServer. Specifically, DllUnregisterServer calls > check_init, which calls load_pythoncom, which calls LoadLibraryEx. I > suggest that we add a check_deinit() method, to be called > just before we > return, which calls unload_pythoncom, which calls FreeLibrary. *Every* DLL used by the program must be unloaded - that includes Pythonxx.dll and all the .pyd files used by Python. Python simply doesn't clean up after itself that well. Mark From mhammond at skippinet.com.au Fri Oct 8 01:13:01 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Oct 8 01:13:07 2004 Subject: [python-win32] Any plans to implement .rowcount in the odbc module? In-Reply-To: <19265472043.20041007131140@columbus.rr.com> Message-ID: <110e01c4acc3$31e94d70$050a0a0a@enfoldsystems.local> > Any plans to implement .rowcount in the odbc module? Not by me, but only due to the fact I don't personally use that module. > I'm eyeballing the source at: > http://cvs.sourceforge.net/viewcvs.py/pywin32/pywin32/win32/sr > c/odbc.cpp?rev=1.13&view=markup > and I MIGHT be able to hack together something with some hints on > which functions I need to edit, but I've never tried > building pywin32 from source, so I don't know which compiler is > required, etc. It should be easy to build from source these days, particularly if you are going from CVS or will wait for build 203. All you need is MSVC6 (for 2.3 and earlier) or 7.1 (for 2.4). Mark From jeff at ccvcorp.com Fri Oct 8 01:22:03 2004 From: jeff at ccvcorp.com (Jeff Shannon) Date: Fri Oct 8 01:20:25 2004 Subject: [python-win32] what's wrong with my GMail? In-Reply-To: <200410071808.56092.alex@moreati.org.uk> References: <373dff05041006192236a1f83c@mail.gmail.com> <200410071808.56092.alex@moreati.org.uk> Message-ID: <4165CF9B.5070200@ccvcorp.com> Alex Willmer wrote: >On Thursday 07 Oct 2004 03:22, Leo Jay wrote: > > >>what's wrong with my GMail? >>i can't reply mailing list. >> >>there is no response after i clicked the send button. what's wrong? >> >>anyone have any idea? >> >>Thanks >> >> > >It may be that your replys are being sent to the originator, rather than the >list. When an email is 'reflected' by a mailing list there is a question >regarding what the To and Reply-to field should be set. In the case of >python-win32 they're both left as the originator's email address. > >Have a look to see whether GMail has a Reply to List function. > > Failing a 'reply to list' function, it usually works for me to 'reply all' and then adjust the to: and cc: fields as desired. Jeff Shannon Technician/Programmer Credit International From bwinton at latte.ca Fri Oct 8 01:41:03 2004 From: bwinton at latte.ca (Blake Winton) Date: Fri Oct 8 01:41:57 2004 Subject: [python-win32] Re: [Py2exe-users] DllUnregister Question. In-Reply-To: <110701c4acc1$0cb460f0$050a0a0a@enfoldsystems.local> References: <110701c4acc1$0cb460f0$050a0a0a@enfoldsystems.local> Message-ID: <4165D40F.4030607@latte.ca> Mark Hammond wrote: >>Specifically, DllUnregisterServer calls check_init, which calls >>load_pythoncom, which calls LoadLibraryEx. I suggest that we >>add a check_deinit() method, to be called just before we >>return, which calls unload_pythoncom, which calls FreeLibrary. > *Every* DLL used by the program must be unloaded - that includes > Pythonxx.dll and all the .pyd files used by Python. Python simply > doesn't clean up after itself that well. Okay, and I'm guessing that that would be very hard to do? Could we store the list of open libraries before and after we load Pythonxx.dll, and then close them all in our check_deinit() method? I haven't done much Win32 programming, so I'm a little out of my depth here. If that's really hard to do, could we at least unload pythonxx.dll, so that I can complain to the base python people that they aren't cleaning up after themselves? ;) Thanks, Blake. From mhammond at skippinet.com.au Fri Oct 8 02:02:30 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Oct 8 02:02:35 2004 Subject: [python-win32] Re: [Py2exe-users] DllUnregister Question. In-Reply-To: <4165D40F.4030607@latte.ca> Message-ID: <111401c4acca$1b51e660$050a0a0a@enfoldsystems.local> > Okay, and I'm guessing that that would be very hard to do? Could we > store the list of open libraries before and after we load > Pythonxx.dll, > and then close them all in our check_deinit() method? I haven't done > much Win32 programming, so I'm a little out of my depth here. > > If that's really hard to do, could we at least unload > pythonxx.dll, so > that I can complain to the base python people that they > aren't cleaning > up after themselves? ;) It is hard to do, and unfortunately the python people most likely to hear that complaining will drag Thomas and/or I into it. The Python world is so inbred there isn't much of an "us and them" distinction :) I agree that is is a bit of a PITA, but why not just work around it? Spawn a new process to perform the unregistration - you can even create such a tool yourself (in python) and package it with your app - that is what most people facing this do. I doubt many people will find the significant time needed to work around a problem very rarely seen, and where a reasonable workaround exists. FWIW, when I first raised this with the Inno guy, he agreed that Inno itself should be able to deal with this problem, but also said he would have problems finding the time to fix it when reasonable workarounds exist. Mark. From davidf at sjsoft.com Fri Oct 8 10:00:39 2004 From: davidf at sjsoft.com (David Fraser) Date: Fri Oct 8 10:00:46 2004 Subject: [python-win32] compilers to build pywin32 In-Reply-To: <110e01c4acc3$31e94d70$050a0a0a@enfoldsystems.local> References: <110e01c4acc3$31e94d70$050a0a0a@enfoldsystems.local> Message-ID: <41664927.9070301@sjsoft.com> Mark Hammond wrote: >>Any plans to implement .rowcount in the odbc module? >> >> > >Not by me, but only due to the fact I don't personally use that module. > > > >>I'm eyeballing the source at: >>http://cvs.sourceforge.net/viewcvs.py/pywin32/pywin32/win32/sr >>c/odbc.cpp?rev=1.13&view=markup >>and I MIGHT be able to hack together something with some hints on >>which functions I need to edit, but I've never tried >>building pywin32 from source, so I don't know which compiler is >>required, etc. >> >> > >It should be easy to build from source these days, particularly if you are >going from CVS or will wait for build 203. All you need is MSVC6 (for 2.3 >and earlier) or 7.1 (for 2.4). > Is it not going to be possibile to use MSVC6 for 2.4 anymore? Rats. I really need to work on that MinGW compatibility .... David From mhammond at skippinet.com.au Fri Oct 8 14:40:49 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Oct 8 14:40:55 2004 Subject: [python-win32] RE: compilers to build pywin32 In-Reply-To: <41664927.9070301@sjsoft.com> Message-ID: <11fc01c4ad34$0ad01450$050a0a0a@enfoldsystems.local> > Is it not going to be possibile to use MSVC6 for 2.4 anymore? Rats. I > really need to work on that MinGW compatibility .... The official Python 2.4 release will be built using MSVC 7.1 - hence distutils defaults to using that compilter. AFAIK no one is particularly interested in maintaining MSVC6 compatibility for 2.4, but it should certainly be "possible" :) Mark From bryan_kamrath at yahoo.com Fri Oct 8 15:24:24 2004 From: bryan_kamrath at yahoo.com (Bryan Kamrath) Date: Fri Oct 8 15:24:26 2004 Subject: [python-win32] Internet Explorer COM issues with XP SP2? Message-ID: <20041008132424.40377.qmail@web51510.mail.yahoo.com> I am using the PAMIE (http://pamie.sourceforge.net) module for doing some automated web testing. This module works with the Internet Explorer COM object to drive Internet Explorer by automating navigates, button clicks, the filling out of forms, etc. However, since I upgraded to XP SP2 I have not gotten this module to work very well. It seems that every time I try and fire an event fown to the COM object (like an "onchange") event I get the 'Access Denied' COM error. Here is what I have tried to remedy the situation: - Set all Internet Explorer and Firewall security options to their lowest levels. - Investigated the DCOM settings for the Internet Explorer application using dcomcnfg.exe and tried a myriad of combinations (like setting permissions for IE so that it runs as an administrator user) but to to now avail. -Double checked the code in module to determine whether it was dispatching IE appropriately. It does so like this: DispatchEx('InternetExplorer.Application') Any other ideas? I am at my wits end as this was working perfectly uner XP SP1. Are there DCOM settings I haven't configured properly? Thanks, b. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From bwinton at latte.ca Fri Oct 8 15:26:33 2004 From: bwinton at latte.ca (Blake Winton) Date: Fri Oct 8 15:26:38 2004 Subject: [python-win32] Re: [Py2exe-users] DllUnregister Question. In-Reply-To: <111401c4acca$1b51e660$050a0a0a@enfoldsystems.local> References: <111401c4acca$1b51e660$050a0a0a@enfoldsystems.local> Message-ID: <41669589.3020307@latte.ca> Mark Hammond wrote: > It is hard to do, and unfortunately the python people most likely to hear > that complaining will drag Thomas and/or I into it. The Python world is so > inbred there isn't much of an "us and them" distinction :) I figured it was either that, or that Thomas and you were the base python people. If it's hard, and wouldn't really benefit anyone, then I retract my suggestion (at least until I've got the time to implement it myself). As an easier fix, could a note be put in some of the documentation somewhere, describing the problem, and suggesting a workaround? I'm guessing google will pick up our conversation from py2exe and python-win32, which is probably good enough, now that I think of it. > I agree that is is a bit of a PITA, but why not just work around it? Spawn > a new process to perform the unregistration - you can even create such a > tool yourself (in python) and package it with your app - that is what most > people facing this do. I doubt many people will find the significant time > needed to work around a problem very rarely seen, and where a reasonable > workaround exists. I've since found out that if I use the exe server (instead of the dll server), and run it with a /reg or /unreg option, it will spawn a new process, which will be terminated at the appropriate time, thus unloading the dlls. Of course, my setup script is now hanging sometime after that, and I'm not sure whether it's related or not. Of course, that's something I'll be asking the Inno newsgroup. > FWIW, when I first raised this with the Inno guy, he agreed that Inno itself > should be able to deal with this problem, but also said he would have > problems finding the time to fix it when reasonable workarounds exist. Speaking as a newbie to both PythonCOM, py2exe, and InnoSetup, it would have been nice if Inno had dealt with it. :) Thanks for your help. I think I've got a better handle on why things are the way they are, and what's going on under the scenes. And I'ld like to congratulate you on making it so easy to get working that even I, with little-to-no experience in the three things listed above, could get an installer written for a binary version of my COM conduit. I've loved working in Python for a while now, and it's the efforts of people like you and Thomas which make it such a joy to use. And now back to my daily job of fighting against J2ME. Heh. Thanks, Blake. From theller at python.net Fri Oct 8 16:28:02 2004 From: theller at python.net (Thomas Heller) Date: Fri Oct 8 16:27:54 2004 Subject: [python-win32] Re: compilers to build pywin32 References: <41664927.9070301@sjsoft.com> <11fc01c4ad34$0ad01450$050a0a0a@enfoldsystems.local> Message-ID: "Mark Hammond" writes: >> Is it not going to be possibile to use MSVC6 for 2.4 anymore? Rats. I >> really need to work on that MinGW compatibility .... > > The official Python 2.4 release will be built using MSVC 7.1 - hence > distutils defaults to using that compilter. AFAIK no one is particularly > interested in maintaining MSVC6 compatibility for 2.4, but it should > certainly be "possible" :) AFAIK, there's still an MSVC6 project file in CVS, and it still works. But, an MSVC6 built Python needs all extension modules built with the same compiler. Dito for 7.1. Thomas From theller at python.net Fri Oct 8 18:05:22 2004 From: theller at python.net (Thomas Heller) Date: Fri Oct 8 18:05:13 2004 Subject: [python-win32] Re: [Py2exe-users] DllUnregister Question. References: <111401c4acca$1b51e660$050a0a0a@enfoldsystems.local> <41669589.3020307@latte.ca> Message-ID: <7jq119h9.fsf@python.net> Blake Winton writes: >>> Okay, and I'm guessing that that would be very hard to do? Could we >>> store the list of open libraries before and after we load >>> Pythonxx.dll, and then close them all in our check_deinit() method? >>> I haven't done much Win32 programming, so I'm a little out of my >>> depth here. >>> >>> If that's really hard to do, could we at least unload pythonxx.dll, >>> so that I can complain to the base python people that they aren't >>> cleaning up after themselves? ;) > Mark Hammond wrote: >> It is hard to do, and unfortunately the python people most likely to hear >> that complaining will drag Thomas and/or I into it. The Python world is so >> inbred there isn't much of an "us and them" distinction :) > > I figured it was either that, or that Thomas and you were the base > python people. If it's hard, and wouldn't really benefit anyone, then > I retract my suggestion (at least until I've got the time to implement > it myself). As an easier fix, could a note be put in some of the > documentation somewhere, describing the problem, and suggesting a > workaround? I'm guessing google will pick up our conversation from > py2exe and python-win32, which is probably good enough, now that I > think of it. At least there's a pointer in the pywin32 sources, file com\win32com\src\dllmain.cpp, which is part of pythoncomxx.dll: /*** NOTE: We no longer finalize Python EVER in the COM world see pycom-dev mailing list archives from April 2000 for why ***/ Thomas From blipbeep at gmail.com Sun Oct 10 06:45:44 2004 From: blipbeep at gmail.com (Alias Alias) Date: Sun Oct 10 06:47:18 2004 Subject: [python-win32] Internet Explorer COM issues with XP SP2? In-Reply-To: <20041008132424.40377.qmail@web51510.mail.yahoo.com> References: <20041008132424.40377.qmail@web51510.mail.yahoo.com> Message-ID: <934895d0041009214576c30c51@mail.gmail.com> Haven't tried SP2 yet or PAMIE. Have you tried just using the straight Win32com stuff ? Also, take a look at the ctypes example/demo APP. They have an IE demo there that shows all the events it gets. > well. It seems that every time I try and fire an > event fown to the COM object (like an "onchange") > event I get the 'Access Denied' COM error. Are you trying to source your own events? I don't understand exactly. From blipbeep at gmail.com Sun Oct 10 06:45:44 2004 From: blipbeep at gmail.com (Alias Alias) Date: Sun Oct 10 06:48:03 2004 Subject: [python-win32] Internet Explorer COM issues with XP SP2? In-Reply-To: <20041008132424.40377.qmail@web51510.mail.yahoo.com> References: <20041008132424.40377.qmail@web51510.mail.yahoo.com> Message-ID: <934895d0041009214576c30c51@mail.gmail.com> Haven't tried SP2 yet or PAMIE. Have you tried just using the straight Win32com stuff ? Also, take a look at the ctypes example/demo APP. They have an IE demo there that shows all the events it gets. > well. It seems that every time I try and fire an > event fown to the COM object (like an "onchange") > event I get the 'Access Denied' COM error. Are you trying to source your own events? I don't understand exactly. From blipbeep at gmail.com Sun Oct 10 06:45:44 2004 From: blipbeep at gmail.com (Alias Alias) Date: Sun Oct 10 06:48:06 2004 Subject: [python-win32] Internet Explorer COM issues with XP SP2? In-Reply-To: <20041008132424.40377.qmail@web51510.mail.yahoo.com> References: <20041008132424.40377.qmail@web51510.mail.yahoo.com> Message-ID: <934895d0041009214576c30c51@mail.gmail.com> Haven't tried SP2 yet or PAMIE. Have you tried just using the straight Win32com stuff ? Also, take a look at the ctypes example/demo APP. They have an IE demo there that shows all the events it gets. > well. It seems that every time I try and fire an > event fown to the COM object (like an "onchange") > event I get the 'Access Denied' COM error. Are you trying to source your own events? I don't understand exactly. From blipbeep at gmail.com Sun Oct 10 06:45:44 2004 From: blipbeep at gmail.com (Alias Alias) Date: Sun Oct 10 06:48:06 2004 Subject: [python-win32] Internet Explorer COM issues with XP SP2? In-Reply-To: <20041008132424.40377.qmail@web51510.mail.yahoo.com> References: <20041008132424.40377.qmail@web51510.mail.yahoo.com> Message-ID: <934895d0041009214576c30c51@mail.gmail.com> Haven't tried SP2 yet or PAMIE. Have you tried just using the straight Win32com stuff ? Also, take a look at the ctypes example/demo APP. They have an IE demo there that shows all the events it gets. > well. It seems that every time I try and fire an > event fown to the COM object (like an "onchange") > event I get the 'Access Denied' COM error. Are you trying to source your own events? I don't understand exactly. From droux at tuks.co.za Sun Oct 10 19:10:37 2004 From: droux at tuks.co.za (Danie Roux) Date: Sun Oct 10 19:10:49 2004 Subject: [python-win32] How to get my Python control to show up in Office VBA Message-ID: <20041010171037.GA3070@link.up.ac.za> Hi all, I wrote most of my control, and I wrapped a complex type with the wrap. This works beautifully between a Python server and Python client. Now, in VBA I do this: Set obj = CreateObject("MyControl") This works, but calling a method on this object that returns a complex type (e.g. Person) fails. Now, I think my control is not registered correctly, because I can not see it in Tools->References. I believe once it is registered there, its typelibs (?) will be available to Excel. What must/can I do to get my ActiveX control to register itself in the correct manner? Help much appreciated! -- Danie Roux *shuffle* Adore Unix From mhammond at skippinet.com.au Mon Oct 11 09:06:52 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Oct 11 09:07:02 2004 Subject: [python-win32] Announce: pywin32 build 203 available Message-ID: <04ea01c4af60$e3359f80$0300a8c0@enfoldsystems.local> I've just uploaded build 203 of the pywin32/win32all extensions to source-forge. The release page is at: https://sourceforge.net/project/showfiles.php?group_id=78018&package_id=7906 3&release_id=274344 The change-log for the release is included below. Please let me know if you have any problems, and thanks to all the contributors for this release! Mark. * Phil Frantz contributed the start of an ISAPI framework - you can now implement ISAPI filters and extensions in Python! (only for Python 2.3 and later builds). See the installed Help file, or see the site-packages\isapi\samples directory. * Roger Upole fixed a number of security bugs, and allowed the security modules to again be used on NT. * David Bolen restored service functionality for Windows NT. * The win32gui, win32security, and win32service modules all again work on Windows NT. * Roger Upole continued to enhance win32print. * The command-line args for our service module now allow 'start' and 'stop' to specify a '--wait' option - this will prevent the program terminating until the service completely starts/stops. * Support for CreateTypeLib2 contributed by Phil Rittenhouse. * COM servers which specify a typelib to load now also provide this type-info to the caller via GetTypeInfo. * win32api.GetLongPathName() support unicode filenames longer than MAXPATH * win32gui gets lots of new functions. * New 'winxpgui' module - almost identical to win32gui, but has a Windows XP manifest included, and a couple of extra functions not supported by Windows NT (AnimateWindow, FlashWindowEx, etc) * win32gui and win32com allow a 'logger' object to be set, so unhandled exceptions are reported to it instead of to stderr. * win32trace module and permon data modules now works in a terminal services environment. * Thanks to Enzhou Wang, the pythoncom/pywintypes .h and .lib files are now installed. * Add win32api.GetComputerNameEx() and win32api.GetComputerObjectName() * ActiveDirectory interfaces get an upgrade and new samples. * Fix a couple of potential buffer overflows for huge input strings. * Fix a crash in the dbi/odbc modules. * Pythonwin debugger should be less inclined to fill the registry with garbage. * source distribution should now be complete. * setup_win32all.py now should build correctly for most people. * Fix more installation errors. And lots of other bug fixes and enhancements too numerous to list here! From cedric.delfosse at linbox.com Mon Oct 11 10:27:44 2004 From: cedric.delfosse at linbox.com (Cedric Delfosse) Date: Mon Oct 11 10:27:45 2004 Subject: [python-win32] inb() and outb() with Python Win32 ? Message-ID: <1097483263.9067.24.camel@replic.metz> Hello, do you know if it is possible to do low level port I/O with the win32 API ? (same as inb/outb function in C) I found some Python modules around, but I'd prefer to use the Python Win32 bindings. 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 fz.3 at arcor.de Mon Oct 11 18:34:01 2004 From: fz.3 at arcor.de (fz.3@arcor.de) Date: Mon Oct 11 18:34:02 2004 Subject: [python-win32] mixing debug and release .pyd imports Message-ID: <31767508.1097512441904.JavaMail.ngmail@webmail04.arcor-online.net> Hi* In VC++ debug builds for Python import debug versions of extension modules (as XX_d.pyd or XX_d.dll). Is there ANY way to import release versions of extension modules (XX.pyd) in a debug environment? I have naively extended _PyImport_DynLoadFiletab in dynload_win.c to search for release pyd's if debug versions aren't available, but get Fatal Python error: Interpreter not initialized (version mismatch?) when I try to import such a module. Thanks Fritz Bosch Arcor-DSL: jetzt ohne Einrichtungspreis einsteigen oder wechseln Sie sparen 99,95 Euro. Arcor-DSL ist in vielen Anschlussgebieten verf?gbar. http://www.arcor.de/home/redir.php/emf-dsl-1 From timr at probo.com Mon Oct 11 18:39:42 2004 From: timr at probo.com (Tim Roberts) Date: Mon Oct 11 18:39:46 2004 Subject: [python-win32] inb() and outb() with Python Win32 ? In-Reply-To: <20041011100048.BEF881E400A@bag.python.org> References: <20041011100048.BEF881E400A@bag.python.org> Message-ID: <416AB74E.7030502@probo.com> On Mon, 11 Oct 2004 10:27:44 +0200, Cedric Delfosse wrote: >do you know if it is possible to do low level port I/O with the win32 >API ? (same as inb/outb function in C) >I found some Python modules around, but I'd prefer to use the Python >Win32 bindings. > > There are no Win32 APIs for doing port I/O. When you call inb() and outb() from C, if you have optimizations turned on, they are in-lined directly to IN and OUT instructions. If you do not have optimizations turned on, they call an assembler routine in the C run-time library. A module in C is the best you can do. Are you aware that port I/O in NT/2K/XP requires the help of a kernel driver? You can do it directly from a Win32 app in Win 98, but not on the NT-derived systems. -- - Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc. From theller at python.net Mon Oct 11 21:35:01 2004 From: theller at python.net (Thomas Heller) Date: Mon Oct 11 21:34:47 2004 Subject: [python-win32] Re: inb() and outb() with Python Win32 ? References: <20041011100048.BEF881E400A@bag.python.org> <416AB74E.7030502@probo.com> Message-ID: Tim Roberts writes: > On Mon, 11 Oct 2004 10:27:44 +0200, Cedric Delfosse > wrote: > >>do you know if it is possible to do low level port I/O with the win32 >>API ? (same as inb/outb function in C) >>I found some Python modules around, but I'd prefer to use the Python >>Win32 bindings. >> > > > There are no Win32 APIs for doing port I/O. When you call inb() and > outb() from C, if you have optimizations turned on, they are in-lined > directly to IN and OUT instructions. If you do not have optimizations > turned on, they call an assembler routine in the C run-time library. > A module in C is the best you can do. Or ctypes: cdll.msvcrt._inp(...) cdll.msvcrt._outp > Are you aware that port I/O in NT/2K/XP requires the help of a kernel > driver? You can do it directly from a Win32 app in Win 98, but not on > the NT-derived systems. True, of course. Thomas From mhammond at skippinet.com.au Mon Oct 11 23:55:06 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Oct 11 23:55:19 2004 Subject: [python-win32] mixing debug and release .pyd imports In-Reply-To: <31767508.1097512441904.JavaMail.ngmail@webmail04.arcor-online.net> Message-ID: <073601c4afdc$f96f8dc0$0300a8c0@enfoldsystems.local> > Is there ANY way to import release versions of extension > modules (XX.pyd) in a debug > environment? Not really. The easiest way is to rebuild some of the release extensions with debugging information. These rebuilt extensions can then be debugged in an otherwise release version of Python. Mark From geekspeak at hotpop.com Tue Oct 12 17:12:50 2004 From: geekspeak at hotpop.com (Ubergeek) Date: Tue Oct 12 17:12:57 2004 Subject: [python-win32] RE: compilers to build pywin32 In-Reply-To: <11fc01c4ad34$0ad01450$050a0a0a@enfoldsystems.local> References: <11fc01c4ad34$0ad01450$050a0a0a@enfoldsystems.local> Message-ID: <416BF472.1010104@hotpop.com> Mark Hammond wrote: >>Is it not going to be possibile to use MSVC6 for 2.4 anymore? Rats. I >>really need to work on that MinGW compatibility .... > > > The official Python 2.4 release will be built using MSVC 7.1 - hence > distutils defaults to using that compilter. AFAIK no one is particularly > interested in maintaining MSVC6 compatibility for 2.4, but it should > certainly be "possible" :) If you're worried about the cost of upgrading to MSVC 7.1, the command line compiler is available as a free download from Microsoft. It includes just about everything except the MFC and ATL class libraries. Here's the URL, but it's rather lengthy so you might want to just search msdn.microsoft.com for "Visual C++ toolkit". Note that the "2003" and "7.1" version designations are synonymous. http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&displaylang=en From rogelio.flores at gmail.com Tue Oct 12 17:24:06 2004 From: rogelio.flores at gmail.com (Rogelio Flores) Date: Tue Oct 12 17:24:16 2004 Subject: [python-win32] How can I run a win service without python2.0 installation magic? In-Reply-To: <04ea01c4af60$e3359f80$0300a8c0@enfoldsystems.local> References: <04ea01c4af60$e3359f80$0300a8c0@enfoldsystems.local> Message-ID: All I want to do is able to run a python windows service using the win32all build 144 (I have to use python2.0), without using the python2.0 and win32 installers and their setup to be able to distribute my app. I can live with manually changing the system PATH or other environment variables but so far I haven't been successful. I know my service works but only with installed versions of python/win32extensions using their installer. If I start with a clean computer (no python installations) I can register PythonService.exe but my service fails to start unless I run with the debug flag. These are the two error messages that the Event Log registers, but they don't help me at all: Event Type: Error Event Source: Service Control Manager Event Category: None Event ID: 7000 Date: 10/12/2004 Time: 11:11:15 AM User: N/A Computer: ***** Description: The DEXcenter Session Manager service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion. Event Type: Error Event Source: Service Control Manager Event Category: None Event ID: 7009 Date: 10/12/2004 Time: 11:11:15 AM User: N/A Computer: ******* Description: Timeout (30000 milliseconds) waiting for the DEXcenter Session Manager service to connect. Any help will be appreciated, RF From amonroe at columbus.rr.com Tue Oct 12 20:42:12 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Tue Oct 12 20:42:22 2004 Subject: [python-win32] Any plans to implement .rowcount in the odbc module? In-Reply-To: <110e01c4acc3$31e94d70$050a0a0a@enfoldsystems.local> References: <110e01c4acc3$31e94d70$050a0a0a@enfoldsystems.local> Message-ID: <190502903877.20041012144212@columbus.rr.com> >> Any plans to implement .rowcount in the odbc module? > Not by me, but only due to the fact I don't personally use that module. BTW, what do you use instead? Just curious. Alan From rogelio.flores at gmail.com Tue Oct 12 21:35:30 2004 From: rogelio.flores at gmail.com (Rogelio Flores) Date: Tue Oct 12 21:35:36 2004 Subject: [python-win32] Re: How can I run a win service without python2.0 installation magic? In-Reply-To: References: <04ea01c4af60$e3359f80$0300a8c0@enfoldsystems.local> Message-ID: OK, a simple reboot solved my problem, I guess it needed it to be aware of all the changes (to environment variables and the win registry). Thanks everybody anyway, I know you were just about to offer help (it has been the case most times in this list it seems). Isn't great to answer to your own post? ;-) RF On Tue, 12 Oct 2004 11:24:06 -0400, Rogelio Flores wrote: > All I want to do is able to run a python windows service using the > win32all build 144 (I have to use python2.0), without using the > python2.0 and win32 installers and their setup to be able to > distribute my app. I can live with manually changing the system PATH > or other environment variables but so far I haven't been successful. > > I know my service works but only with installed versions of > python/win32extensions using their installer. If I start with a clean > computer (no python installations) I can register PythonService.exe > but my service fails to start unless I run with the debug flag. > > These are the two error messages that the Event Log registers, but > they don't help me at all: > > Event Type: Error > Event Source: Service Control Manager > Event Category: None > Event ID: 7000 > Date: 10/12/2004 > Time: 11:11:15 AM > User: N/A > Computer: ***** > Description: > The DEXcenter Session Manager service failed to start due to the > following error: > The service did not respond to the start or control request in a > timely fashion. > > Event Type: Error > Event Source: Service Control Manager > Event Category: None > Event ID: 7009 > Date: 10/12/2004 > Time: 11:11:15 AM > User: N/A > Computer: ******* > Description: > Timeout (30000 milliseconds) waiting for the DEXcenter Session Manager > service to connect. > > Any help will be appreciated, From mhammond at skippinet.com.au Wed Oct 13 00:09:10 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Oct 13 00:09:15 2004 Subject: [python-win32] Any plans to implement .rowcount in the odbcmodule? In-Reply-To: <190502903877.20041012144212@columbus.rr.com> Message-ID: <02b101c4b0a8$1a22a950$070a0a0a@enfoldsystems.local> > >> Any plans to implement .rowcount in the odbc module? > > > Not by me, but only due to the fact I don't personally use > that module. > > BTW, what do you use instead? Just curious. I don't use databases :) Mark. From craig at coot.net Thu Oct 14 02:00:15 2004 From: craig at coot.net (Craig H. Anderson) Date: Thu Oct 14 03:05:53 2004 Subject: [python-win32] Connection point events, not on Dispatch object? Message-ID: I have a vendor com DLL that is used like this: SerStart = win32com.client.Dispatch('VRNexusS.IServerStartup') VrServer = SerStart.GetIVRNexus How would I attach an event handler to the VrServer object? Example Visual Basic looks like this: Public WithEvents VRServer As IVRNexus ' COM server's interface class. Not creatable by clients. Private SerStart As IServerStartup ' Entry into Agent COM server to get a pointer to INexus since INexus is not creatable by clients. Private Sub VRServer_PDSEvent(ByVal ErrFlag As Boolean, ByVal Command As String, ByVal CmdType As String, ByVal data As Variant) Private Sub Form_Load() On Error GoTo ErrCond Set SerStart = New IServerStartup 'Entry point into DLL. Set VRServer = SerStart.GetIVRNexus ' Set MosServer to point to server object IMoagent. From mhammond at skippinet.com.au Thu Oct 14 03:36:41 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Oct 14 03:36:47 2004 Subject: [python-win32] Connection point events, not on Dispatch object? In-Reply-To: Message-ID: <001c01c4b18e$41e81e20$010a0a0a@enfoldsystems.local> > I have a vendor com DLL that is used like this: > > SerStart = win32com.client.Dispatch('VRNexusS.IServerStartup') > VrServer = SerStart.GetIVRNexus > > How would I attach an event handler to the VrServer object? Something like: SerStart = win32com.client.Dispatch('VRNexusS.IServerStartup') VrServer = SerStart.GetIVRNexus VrServer = win32com.client.DispatchWithEvents(VrServer, YourEventClass) See the docstring for DispatchWithEvents, noting that although the first param is named 'clsid', you can still pass an existing Dispatch object. Mark From lewis.franklin at gmail.com Thu Oct 14 07:02:41 2004 From: lewis.franklin at gmail.com (Lewis Franklin) Date: Thu Oct 14 07:02:43 2004 Subject: [python-win32] Resizing a new program Message-ID: <80150ed604101322024412f7f8@mail.gmail.com> I am wanting to use python-win32 to start a new program and would like to be able to resize the application. When looking through winprocess.py (in the Demos directory) there seems to be a way to set the size of a window. However, when I try to set the dimensions using xy and xySize in run(), it has no effect on the application. I am not a Windows programmer and so am clueless as to how to best go about this problem. Of note, I am using Python2.3 and python-win32 build 202. From craig at coot.net Thu Oct 14 22:29:27 2004 From: craig at coot.net (Craig H. Anderson) Date: Thu Oct 14 23:35:11 2004 Subject: [python-win32] More IE jscript to Python com woes Message-ID: Thank you, Mark Hammond, your help is much appreciated. I got further this time, but still have problems. An error dialog pops up with this: A Runtime Error has occurred. Do you wish to Debug? Line: 24 Error: Automation server can't create object In the Pythonwin trace window: Object with win32trace dispatcher created (object=None) ComGcsMosaixApp.__init__() 8 in ._InvokeEx_-GetInterfaceSafetyOptions(IID('{BB1A2AE1-A4F9-11CF-8F 20-00805F2CD064}'),) [1,0,None] # My Python code from win32comext.axscript.client.framework import COMScript class ComGcsMosaixApp(COMScript): _reg_progid_ = "GCSMosaix.app" # use "print pythoncom.CreateGuid()" _reg_clsid_ = "{C5A4B907-053E-4953-B20D-93DF6598CAE1}" _public_attrs_ = ["Version","Dispo"] _readonly_attrs_ = ["Version"] def __init__(self): COMScript.__init__(self) self.dispoActive = 0 self.Version = "MyVersion" self.Dispo = -1 print 'ComGcsMosaixApp.__init__() 8' # debug // jscript code on ASP page function onSend() { var app = new ActiveXObject("GCSMosaix.app") app.Dispo = 78 document.jscript.action.value="btnSendDispo" document.jscript.submit() } From craig at coot.net Thu Oct 14 23:01:02 2004 From: craig at coot.net (Craig H. Anderson) Date: Fri Oct 15 00:06:45 2004 Subject: [python-win32] Re: More IE jscript to Python com woes Message-ID: Okay, I just realized that IE internet options can be set to run ActiveX controls not marked as safe. Now I see that each ASP/jscript reference var app = new ActiveXObject("GCSMosaix.app") creates a new object. How can I make the Python COM server create just a single instance? From mhammond at skippinet.com.au Fri Oct 15 00:17:35 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri Oct 15 00:17:42 2004 Subject: [python-win32] More IE jscript to Python com woes In-Reply-To: Message-ID: <034a01c4b23b$9c4ea1b0$010a0a0a@enfoldsystems.local> You will have to look up the documentation for GetInterfaceSafetyOptions - the underlying issue is that your HTML code is trying to create a COM object on the client, and IE will only do that for controls marked "safe for scripting". win32comext\axscript\client\*.py uses this IIRC, so may give you some pointers. Be careful you aren't making your clients vulnerable to some attack basked on your object though. Mark. > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of Craig H. Anderson > Sent: Friday, 15 October 2004 6:29 AM > To: python-win32@python.org > Subject: [python-win32] More IE jscript to Python com woes > > > Thank you, Mark Hammond, your help is much appreciated. > I got further this time, but still have problems. > > An error dialog pops up with this: > A Runtime Error has occurred. > Do you wish to Debug? > Line: 24 > Error: Automation server can't create object > > In the Pythonwin trace window: > Object with win32trace dispatcher created (object=None) > ComGcsMosaixApp.__init__() 8 > in 0x04583558>._InvokeEx_-GetInterfaceSafetyOptions(IID('{BB1A2AE > 1-A4F9-11CF-8F > 20-00805F2CD064}'),) [1,0,None] > > # My Python code > from win32comext.axscript.client.framework import COMScript > > class ComGcsMosaixApp(COMScript): > _reg_progid_ = "GCSMosaix.app" > # use "print pythoncom.CreateGuid()" > _reg_clsid_ = "{C5A4B907-053E-4953-B20D-93DF6598CAE1}" > _public_attrs_ = ["Version","Dispo"] > _readonly_attrs_ = ["Version"] > def __init__(self): > COMScript.__init__(self) > self.dispoActive = 0 > self.Version = "MyVersion" > self.Dispo = -1 > print 'ComGcsMosaixApp.__init__() 8' # debug > > // jscript code on ASP page > function onSend() > { > var app = new ActiveXObject("GCSMosaix.app") > app.Dispo = 78 > document.jscript.action.value="btnSendDispo" > document.jscript.submit() > } > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From mc at mclaveau.com Fri Oct 15 01:19:49 2004 From: mc at mclaveau.com (Michel Claveau) Date: Fri Oct 15 01:20:01 2004 Subject: [python-win32] Re: More IE jscript to Python com woes References: Message-ID: <017701c4b244$50b86ac0$0701a8c0@PORTABLES> Bonsoir ! Hi ! Je d?veloppe une solution avec I.E. (comme GUI) et Python (gr?ce ? PyWin ; merci M. Hammond). I develop a solution with I.E. (like GUI) and Python (with PyWin ; thanks M. Hammond) Et, pour contourner les probl?mes je passe pas des .HTA ; c'est int?ressant. And, for turn problems, I use .HTA ; it's fun ! *sorry for my 'good' english* -- Michel Claveau From craig at coot.net Fri Oct 15 18:44:12 2004 From: craig at coot.net (Craig H. Anderson) Date: Fri Oct 15 19:50:00 2004 Subject: [python-win32] Success with COM Connection Point event handling Message-ID: I want to report that I've had success with COM Connection Point event handling. I ran makepy.py on the vendor DLL and it generated the event method signatures used in class IvrEventHandler Thanks again to Mark Hammond for the wonderful software and answering my questions. Code fragments from my working script: class IvrEventHandler: target = None # must be set to object that handles OnPDSBadData(),OnPDSEvent() def __init__(self): pass def OnPDSBadData(self, cause=pythoncom.Empty, Msg=pythoncom.Empty): IvrEventHandler.target.OnPDSBadData(cause,Msg) def OnPDSEvent(self, ErrFlag=pythoncom.Empty, command=pythoncom.Empty, CmdType=pythoncom.Empty, data=pythoncom.Empty): IvrEventHandler.target.OnPDSEvent(ErrFlag,command,CmdType,data) class TestClass: def Run(self): self.SerStart = win32com.client.Dispatch('VRNexusS.IServerStartup') self.IVRNexus = self.SerStart.GetIVRNexus self.VrServer = win32com.client.DispatchWithEvents(self.IVRNexus,IvrEventHandler) for ii in range(60): time.sleep(1) pythoncom.PumpWaitingMessages() From rwupole at msn.com Sat Oct 16 03:31:01 2004 From: rwupole at msn.com (Roger Upole) Date: Sat Oct 16 03:31:06 2004 Subject: [python-win32] Resizing a new program References: <80150ed604101322024412f7f8@mail.gmail.com> Message-ID: <018f01c4b31f$cd4b78d0$19eafea9@rupole> I think the application can choose to ignore these. For instance, if you start python.exe with these set, the console window shows up at the specified place &size. You might want to look at using win32gui.SetWindowPos after the appication has started. The only odd thing I noticed was that win32process defines PySTARTUPINFO.wShowWindow as T_INT, but it really should be a T_SHORT. However, after changing this and recompiling the behaviour is the same. Roger ----- Original Message ----- From: "Lewis Franklin" To: Sent: Thursday, October 14, 2004 1:02 AM Subject: [python-win32] Resizing a new program >I am wanting to use python-win32 to start a new program and would like > to be able to resize the application. When looking through > winprocess.py (in the Demos directory) there seems to be a way to set > the size of a window. However, when I try to set the dimensions using > xy and xySize in run(), it has no effect on the application. I am not > a Windows programmer and so am clueless as to how to best go about > this problem. Of note, I am using Python2.3 and python-win32 build > 202. > > From python at kareta.de Sun Oct 17 01:13:37 2004 From: python at kareta.de (=?ISO-8859-1?B?SvxyZ2VuIEthcmV0YQ==?=) Date: Sun Oct 17 01:07:54 2004 Subject: [python-win32] customize colors in pythonwin Message-ID: <1097968417.4171ab21e6989@webmail.ldc.de> Hello, I'm new to the list. I had recently updated pythonwin to build 202 with python 2.3 on W2K. I like the new possibility to customize pythonwin with the config file and the option to add entries in the tool menu. After playing with it a few nights, I have some questions now: I tried to colorize stings with a spezial color. After some trials I found the python lexer in formatter.py and tried to extend it. But it doesn't work. I found a answer from Neil on the web that pythonwin now use the scintilla builtin python lexer. Is there another way to customize the color of special keywords/strings ? If not, I suggest the only possibility is to rebuilt the scintilla python lexer ? I read something about building a lexer in a dll, but don't understand it completly. Is there a way to do it without compiling the whole pytonwin extension ? Because of the great possibilities to customize pythonwin and also the use of scintilla in my own applications, I wan't to understand the python wrapper around scintilla. I found the scintilla api and also a api for scintilla in wxpython. But not all api-funktions are available in pythonwin. Is there some dokumentation how pythonwin and scintilla work together or have I to study the sources ? In later case, what is the best place to start? I looked in most of the pywin source files and learned a lot, but i miss the overview how they work together. Thanks in advance for any reply :-) regards, J?rgen From tony at tcapp.com Sun Oct 17 05:26:49 2004 From: tony at tcapp.com (Tony Cappellini) Date: Sun Oct 17 11:19:37 2004 Subject: [python-win32] python-win32] Re: inb() and outb() with Python Win32 ? Message-ID: <6.1.2.0.0.20041016202448.045dc1b8@mail.yamato.com> Thomas So what happens on Win2K, NT, and XP, when the below functions are called ? cdll.msvcrt._inp(...) cdll.msvcrt._outp I assume an exception- but I don't see how something like this could be caught in Python's exception handling. thanks Tony Date: Mon, 11 Oct 2004 21:35:01 +0200 From: Thomas Heller Subject: [python-win32] Re: inb() and outb() with Python Win32 ? To: python-win32@python.org Message-ID: Content-Type: text/plain; charset=us-ascii > Are you aware that port I/O in NT/2K/XP requires the help of a kernel > driver? You can do it directly from a Win32 app in Win 98, but not on > the NT-derived systems. True, of course. Thomas From mhammond at skippinet.com.au Mon Oct 18 01:23:35 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Oct 18 01:23:42 2004 Subject: [python-win32] customize colors in pythonwin In-Reply-To: <1097968417.4171ab21e6989@webmail.ldc.de> Message-ID: <01ca01c4b4a0$538ea1c0$0300a8c0@enfoldsystems.local> > Is there another way to customize the color of special > keywords/strings ? > If not, I suggest the only possibility is to rebuilt the > scintilla python > lexer ? I read something about building a lexer in a dll, but > don't understand > it completly. Is there a way to do it without compiling the > whole pytonwin > extension ? Check out pythonwin\pywin\scintilla\formatter.py - that is the old Python implemented lexer. It should give you a few clues. I can't recall if the hooks still exist to allow you to use this formatter - IIRC, you tell scintilla you are using an external lexer, and it calls by way of messages. > Because of the great possibilities to customize pythonwin and > also the use of > scintilla in my own applications, I wan't to understand the > python wrapper > around scintilla. I found the scintilla api and also a api > for scintilla in > wxpython. But not all api-funktions are available in > pythonwin. In this scintilla directory you will find 'control.py' - this is hand-maintained, so is falling behind. Most of the methods are thin wrappers around SendMessage, so adding in the new ones should be easy. > dokumentation how pythonwin and scintilla work together or > have I to study the > sources ? In later case, what is the best place to start? I > looked in most of > the pywin source files and learned a lot, but i miss the > overview how they work > together. > Thanks in advance for any reply :-) There are no docs, but there is also no magic - Pythonwin just uses the scintilla API by sending the appropriate messages. If you make enhancements that others may also like to see, please upload them to a patch at sourceforge, and I will look at getting them in the next release. Mark. From niki at vintech.bg Tue Oct 19 10:09:10 2004 From: niki at vintech.bg (Niki Spahiev) Date: Tue Oct 19 10:09:31 2004 Subject: [python-win32] python-win32] Re: inb() and outb() with Python Win32 ? In-Reply-To: <6.1.2.0.0.20041016202448.045dc1b8@mail.yamato.com> References: <6.1.2.0.0.20041016202448.045dc1b8@mail.yamato.com> Message-ID: <4174CBA6.6070705@vintech.bg> Tony Cappellini wrote: > > > Thomas > > So what happens on Win2K, NT, and XP, when the below functions are called ? > > cdll.msvcrt._inp(...) > cdll.msvcrt._outp > > I assume an exception- but I don't see how something like this could be > caught in Python's exception handling. There is python module for printer control which works under NT, XP HTH Niki Spahiev From theller at python.net Tue Oct 19 11:56:39 2004 From: theller at python.net (Thomas Heller) Date: Tue Oct 19 11:56:20 2004 Subject: [python-win32] Re: python-win32] Re: inb() and outb() with Python Win32 ? References: <6.1.2.0.0.20041016202448.045dc1b8@mail.yamato.com> Message-ID: <1xfvt4iw.fsf@python.net> Tony Cappellini writes: > Thomas > > So what happens on Win2K, NT, and XP, when the below functions are called ? > > cdll.msvcrt._inp(...) > cdll.msvcrt._outp > > I assume an exception- but I don't see how something like this could > be caught in Python's exception handling. Generally speaking, you cannot do port IO: c:\sf\ctypes>python Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from ctypes import * >>> windll.msvcrt._inp(0x80) Traceback (most recent call last): File "", line 1, in ? WindowsError: exception: priviledged instruction >>> Windows throws an exception, that ctypes catches. I do not know what you want to do, but it is possible to install a kernel mode driver that allows access to some ports from user space - special peripherals that are connected to the printer port, for example, may work this way. Thomas From niki at vintech.bg Tue Oct 19 15:13:13 2004 From: niki at vintech.bg (Niki Spahiev) Date: Tue Oct 19 15:13:28 2004 Subject: [python-win32] Re: [Py2exe-users] DllUnregister Question. In-Reply-To: <7jq119h9.fsf@python.net> References: <111401c4acca$1b51e660$050a0a0a@enfoldsystems.local> <41669589.3020307@latte.ca> <7jq119h9.fsf@python.net> Message-ID: <417512E9.1040004@vintech.bg> Thomas Heller wrote: > At least there's a pointer in the pywin32 sources, file > com\win32com\src\dllmain.cpp, which is part of pythoncomxx.dll: > > /*** NOTE: We no longer finalize Python EVER in the COM world > see pycom-dev mailing list archives from April 2000 for why > ***/ After one hour searching i can't find it. Any hints? Niki Spahiev From theller at python.net Tue Oct 19 15:55:16 2004 From: theller at python.net (Thomas Heller) Date: Tue Oct 19 15:54:57 2004 Subject: [python-win32] Re: [Py2exe-users] DllUnregister Question. References: <111401c4acca$1b51e660$050a0a0a@enfoldsystems.local> <41669589.3020307@latte.ca> <7jq119h9.fsf@python.net> <417512E9.1040004@vintech.bg> Message-ID: Niki Spahiev writes: > Thomas Heller wrote: > >> At least there's a pointer in the pywin32 sources, file >> com\win32com\src\dllmain.cpp, which is part of pythoncomxx.dll: >> /*** NOTE: We no longer finalize Python EVER in the COM world >> see pycom-dev mailing list archives from April 2000 for why >> ***/ > > After one hour searching i can't find it. Any hints? Maybe this: http://mailman.pythonpros.com/pipermail/pycom-dev/2000q2/000292.html Thomas From A.BETIS at csee-transport.fr Wed Oct 20 10:27:23 2004 From: A.BETIS at csee-transport.fr (BETIS Alexandre) Date: Wed Oct 20 10:27:24 2004 Subject: [python-win32] Slow COM since Office XP migration Message-ID: Hello to all, I am sure there must be some hints about this somewhere, but I can't seem to find a frank and clear answer to this problem. I hope I will find it here. I have used the python win32com package succesfully for automating boring Word doc generation. This worked at the speed of light using Word 97. Lately, though, my company upgraded to Office XP. Since then, my python scripts have continued to work fine, but the response time has increased dramatically. This is kind of problematic for me. Quick response time is pivotal to an efficient doc generation. Can anyone suggest an option for me? I have tried using static COM. The problem remains. This really looks like something out of python. Note: I have an 'OfficeScan' installed on my machine. I suspect this can also be the problem, but I need to be sure, since this piece of software is not something I can uninstall on my own initiative. Thanks, -- Alex PS: This COM package for python should be placed on the vatican list for sainthood. " Ce message et ses pi?ces jointes sont confidentiels et exclusivement r?serv?s ? leurs destinataires qui s'assureront de l'absence de virus. CSEE Transport n'assume aucune responsabilit? au titre de ce message s'il est alt?r?, d?form?, falsifi?, ind?ment utilis? par des tiers ou encore s'il a caus? des dommages ou pertes de toute nature. This e-mail and any attached files are confidential and exclusively intended for its addressees who will conduct appropriate virus checks. CSEE Transport shall not be liable for the message if altered, changed, falsified, unduly used by third parties nor for any damage or loss." From A.BETIS at csee-transport.fr Wed Oct 20 11:21:30 2004 From: A.BETIS at csee-transport.fr (BETIS Alexandre) Date: Wed Oct 20 11:21:31 2004 Subject: [python-win32] Slow COM since Office XP migration Message-ID: [I am reposting this because of a hard-to-read previous post (I won't name the mail client culprit, everybody knows it) Sorry.] Hello to all, I am sure there must be some hints about this somewhere, but I can't seem to find a frank and clear answer to this problem. I hope I will find it here. I have used the python win32com package succesfully for automating boring Word doc generation. This worked at the speed of light using Word 97. Lately, though, my company upgraded to Office XP. Since then, my python scripts have continued to work fine, but the response time has increased dramatically. This is kind of problematic for me. Quick response time is pivotal to an efficient doc generation. Can anyone suggest an option for me? I have tried using static COM. The problem remains. This really looks like something out of python. Note: I have an 'OfficeScan' installed on my machine. I suspect this can also be the problem, but I need to be sure, since this piece of software is not something I can uninstall on my own initiative. Thanks, -- Alex PS: This COM package for python should be placed on the vatican list for sainthood. " Ce message et ses pi?ces jointes sont confidentiels et exclusivement r?serv?s ? leurs destinataires qui s'assureront de l'absence de virus. CSEE Transport n'assume aucune responsabilit? au titre de ce message s'il est alt?r?, d?form?, falsifi?, ind?ment utilis? par des tiers ou encore s'il a caus? des dommages ou pertes de toute nature. This e-mail and any attached files are confidential and exclusively intended for its addressees who will conduct appropriate virus checks. CSEE Transport shall not be liable for the message if altered, changed, falsified, unduly used by third parties nor for any damage or loss." From mhammond at skippinet.com.au Wed Oct 20 13:25:37 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Oct 20 13:25:47 2004 Subject: [python-win32] Slow COM since Office XP migration In-Reply-To: Message-ID: <042b01c4b697$86bd8220$0300a8c0@enfoldsystems.local> > I have used the python win32com package succesfully for > automating boring Word doc generation. This worked at the > speed of light using Word 97. Lately, though, my company > upgraded to Office XP. > > Since then, my python scripts have continued to work fine, > but the response time has increased dramatically. This is > kind of problematic for me. Quick response time is pivotal to > an efficient doc generation. You should check if you are using early-binding, or "makepy". It is possible that as Office has been upgraded and has later type-libraries, you are now using 'dynamic' objects. You mention "static COM", but it is not clear exactly what you mean. A useful thing is to use win32com.client.gencache.EnsureDispatch() - this magically runs makepy at runtime, ensuring you always have an early-bound, makepy generated object. A repr() of the COM object should make it clear if you are using makepy generated objects. Otherwise it is news to me - but unfortunately I don't have office xp, so can't easily reproduce it. It would be useful if you can narrow down exactly what is slower. > PS: This COM package for python should be placed on the > vatican list for sainthood. Thanks :) Mark -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 2256 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20041020/e20e450d/winmail.bin From haraldarminmassa at gmail.com Wed Oct 20 13:23:39 2004 From: haraldarminmassa at gmail.com (Harald Armin Massa) Date: Wed Oct 20 16:09:44 2004 Subject: [python-win32] Slow COM since Office XP migration (BETIS Alexandre) In-Reply-To: <20041020100130.CB2B61E402D@bag.python.org> References: <20041020100130.CB2B61E402D@bag.python.org> Message-ID: <7be3f35d0410200423367c32db@mail.gmail.com> Hello Alexandre, > I have used the python win32com package succesfully for > automating boring Word doc generation. This worked at the speed > of light using Word 97. Lately, though, my company upgraded to > Office XP. please google for "late and early binding" with com-objekts. It is explained in detail in some talks of Mark, and also somewhere in the documentation. Short: "early binding" requieres some doing which may stick to a particular Word-Version. If some early-binding-libs are not available, pythoncom drops to late binding which is much slower. Good luck, Harald From BRADLEY.S.GASPARD at saic.com Wed Oct 20 17:10:47 2004 From: BRADLEY.S.GASPARD at saic.com (Gaspard, Bradley S) Date: Wed Oct 20 18:58:30 2004 Subject: [python-win32] Newbie wmi + process running in background + stdio question Message-ID: I am using TIm Golden's module to launch an application. This brings up a command console where the application then is writting status info to. Is it possible to instead have this output write to a file in the background? Would appreciate any hints. From drichardson at aogtech.com Wed Oct 20 17:15:16 2004 From: drichardson at aogtech.com (David Richardson) Date: Wed Oct 20 18:58:31 2004 Subject: [python-win32] Basic win32pdh calls on windows 2003 server Message-ID: <002401c4b6b7$a12196e0$6e0a0a0a@aogtech.com> Mark, I was looking on the web for an error message that I am having with one of my own programs and I see that you may have experienced the same thing and have fixed it. Can you share with me, the details of what causes the pdh error -2147481648? Thanks in advance, Sam REFERENCE --------------------- http://mail.python.org/pipermail/python-win32/2004-May/002003.html This is fixed in build 201, from sourceforge.net/projects/pywin32 Mark > -----Original Message----- > From: python-win32-bounces+mhammond=keypoint.com.au at python.org > [mailto:python-win32-bounces+mhammond=HYPERLINK "http://mail.python.org/mailman/listinfo/python-win32"keypoint.com.au at python.org ]On > Behalf Of Moray B. Grieve > Sent: Friday, 28 May 2004 8:25 PM > To: python-win32 at python.org > Subject: [python-win32] Basic win32pdh calls on windows 2003 server > > > I'm having some problems running basic win32pdh commands on > windows 2003 > servers. Making a simple call to win32pdh.EnumObjects(None, > None, 0, 1) > produces the following; > > pywintypes.error: (-2147481648, 'EnumObjects for buffer > size', 'No error > message is available') > > This call runs fine on WinNT, 2000, 2000 server, XP etc. Does anyone > know why this may be happening? I have seen this with Python 2.3.4 and > win32all 1.6.3, as well as older versions of both. > > Thanks in advance for any help on this. > > Moray > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20041020/ef256b7e/attachment.htm From alex at moreati.org.uk Wed Oct 20 20:05:43 2004 From: alex at moreati.org.uk (Alex Willmer) Date: Wed Oct 20 20:05:36 2004 Subject: [python-win32] Newbie wmi + process running in background + stdio question In-Reply-To: References: Message-ID: <200410201905.43122.alex@moreati.org.uk> On Wednesday 20 Oct 2004 16:10, Gaspard, Bradley S wrote: > I am using TIm Golden's module to launch an application. This brings up > a command console where the application then is writting status info to. > Is it possible to instead have this output write to a file in the > background? I'm uncertain how WMI would play with this, but you have any output from a console program written to file by using redirection. For instance the following command will write the output of dir to c:\foo.txt: dir c:\ > c:\foo.txt On unix there is a distinction between standard output (stdout) and standard error (stderr) but I don't believe Windows cmd.exe makes this distinction. Does that help? Alex From tim.golden at viacom-outdoor.co.uk Thu Oct 21 10:11:38 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Thu Oct 21 10:16:33 2004 Subject: [python-win32] Newbie wmi + process running in background + s tdio question Message-ID: [Gaspard, Bradley S] | I am using TIm Golden's module to launch an application. | This brings up a | command console where the application then is writting status | info to. Is | it possible to instead have this output write to a file in | the background? Can you post some code showing what you're doing? I suspect the answer will be that you can't avoid the console window, but it depends on what you're after. AFAIK, this is essentially the same question that gets asked from time to time when someone wants to do os.system ("do_something") and doesn't want the console to appear. As was pointed out elsewhere, you can always redirect the output away to a file, but I suspect that you don't just want the output elsewhere, but that you don't want the console window at all. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From lbates at syscononline.com Thu Oct 21 16:17:35 2004 From: lbates at syscononline.com (Larry Bates) Date: Thu Oct 21 16:17:44 2004 Subject: [python-win32] Newbie wmi + process running in background + stdio question In-Reply-To: <20041021100034.B2B641E401D@bag.python.org> Message-ID: <000201c4b778$b729e070$5d00a8c0@LABWXP> Subject: [python-win32] Newbie wmi + process running in background + stdio question To: "'python-win32@python.org'" Message-ID: Content-Type: text/plain; charset="iso-8859-1" I am using TIm Golden's module to launch an application. This brings up a command console where the application then is writting status info to. Is it possible to instead have this output write to a file in the background? Would appreciate any hints. Take a look at using win32process.CreateProcess instead. You have control over creation of the window. Below is some code I snipped from a working application that may help. # # Didn't use os.system calls because it pops up DOS windows and I needed # to be able to control the APPpath environment under Win/98 & ME # STARTUPINFO=win32process.STARTUPINFO() STARTUPINFO.dwX=0 STARTUPINFO.dwY=0 STARTUPINFO.dwXSize=800 STARTUPINFO.dwYSize=600 commandLine=None processAttributes=None threadAttributes=None bInheritHandles=0 dwCreationFlags=0 if self.OSisNT: newEnvironment=None else: # # Windows/98 & ME don't handle APPpaths correctly, I must get the Apppath # from the registry and pass to win32process.CreateProcess in the newEnvironment # variable so search paths will be handled properly. # path, app=os.path.split(execute_target) # # Lookup APPpath for this application in the registry # #newEnvironment={'path':r'h:\public\orawin\042999\orawin\bin;f:\publ ic\pb65\032200\deploy;h:\public\pixtran\081500\bin'} newEnvironment={'path': self.getAPPpath(app)} # # Start the program # win32process.CreateProcess(execute_target, commandLine, processAttributes, threadAttributes, bInheritHandles, dwCreationFlags, newEnvironment, currentDirectory, STARTUPINFO) From florian.reiser at gmx.de Thu Oct 21 11:09:35 2004 From: florian.reiser at gmx.de (Florian Reiser) Date: Thu Oct 21 16:57:11 2004 Subject: [python-win32] COM error Message-ID: <19894.1098349775@www5.gmx.net> Hi, I use COM to access a self programmed exe file. When I execute it by hand everything is fine. But when Zope executes it, then I sometimes get the error message: com_error: (-2147352567, 'Ausnahmefehler aufgetreten', (0, None, None, None, 0, 0), None) What does this error message mean? Ok, there's something wrong. But has the -2147352567 any special meaning? Greets Florian -- +++ GMX DSL Premiumtarife 3 Monate gratis* + WLAN-Router 0,- EUR* +++ Clevere DSL-Nutzer wechseln jetzt zu GMX: http://www.gmx.net/de/go/dsl From timr at probo.com Thu Oct 21 18:36:50 2004 From: timr at probo.com (Tim Roberts) Date: Thu Oct 21 18:36:57 2004 Subject: [python-win32] Basic win32pdh calls on windows 2003 server In-Reply-To: <20041021100034.B2B641E401D@bag.python.org> References: <20041021100034.B2B641E401D@bag.python.org> Message-ID: <4177E5A2.6010409@probo.com> On Wed, 20 Oct 2004 10:15:16 -0500, "David Richardson" wrote: >I was looking on the web for an error message that I am having with one >of my own programs and I see that you may have experienced the same >thing and have fixed it. Can you share with me, the details of what >causes the pdh error -2147481648? > > You should print out errors like this in hex. It's 800007D0, which is PDH_CSTATUS_NO_MACHINE. From pdhmsg.h: // MessageId: PDH_CSTATUS_NO_MACHINE // // MessageText: // // Unable to connect to specified machine or machine is off line. // #define PDH_CSTATUS_NO_MACHINE ((DWORD)0x800007D0L) -- - Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc. From niki at vintech.bg Thu Oct 21 18:41:38 2004 From: niki at vintech.bg (Niki Spahiev) Date: Thu Oct 21 18:41:56 2004 Subject: [python-win32] COM error In-Reply-To: <19894.1098349775@www5.gmx.net> References: <19894.1098349775@www5.gmx.net> Message-ID: <4177E6C2.9070600@vintech.bg> Florian Reiser wrote: > Hi, > > I use COM to access a self programmed exe file. > When I execute it by hand everything is fine. > But when Zope executes it, then I sometimes get the > error message: > com_error: (-2147352567, 'Ausnahmefehler aufgetreten', (0, None, None, None, > 0, 0), None) > > What does this error message mean? > Ok, there's something wrong. But has the -2147352567 any special meaning? >>> hex(-2147352567) '0x80020009' according to PlatformSDK // // MessageId: DISP_E_EXCEPTION // // MessageText: // // Exception occurred. // #define DISP_E_EXCEPTION _HRESULT_TYPEDEF_(0x80020009L) your COM server signaled exception to COM HTH Niki Spahiev From niki at vintech.bg Thu Oct 21 18:45:23 2004 From: niki at vintech.bg (Niki Spahiev) Date: Thu Oct 21 18:45:40 2004 Subject: [python-win32] how to load 2 python COM DLLs in single app? Message-ID: <4177E7A3.9030000@vintech.bg> I have APP which can load COM DLLs. Creating COM DLL servers with python is easy. Problem is that second DLL refuses to load. Any ideas? Niki Spahiev From mhammond at skippinet.com.au Thu Oct 21 23:13:14 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu Oct 21 23:13:24 2004 Subject: [python-win32] how to load 2 python COM DLLs in single app? In-Reply-To: <4177E7A3.9030000@vintech.bg> Message-ID: <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> Can you be specific about the problem? If the error is a deadlock, then make sure you have the latest py2exe. Mark > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of Niki Spahiev > Sent: Friday, 22 October 2004 2:45 AM > To: python-win32@python.org > Subject: [python-win32] how to load 2 python COM DLLs in single app? > > > I have APP which can load COM DLLs. Creating COM DLL servers > with python > is easy. Problem is that second DLL refuses to load. > > Any ideas? > > Niki Spahiev > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From niki at vintech.bg Fri Oct 22 10:24:20 2004 From: niki at vintech.bg (Niki Spahiev) Date: Fri Oct 22 10:24:25 2004 Subject: [python-win32] how to load 2 python COM DLLs in single app? In-Reply-To: <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> References: <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> Message-ID: <4178C3B4.8000205@vintech.bg> Mark Hammond wrote: > Can you be specific about the problem? If the error is a deadlock, then > make sure you have the latest py2exe. Sorry. With Python 2.3.4 + py2exe 0.5.3 i get MSVC++ runtime error - looks like assert With Python 2.3.4 + installer 6a2 - looks like deadlock in import. With Python 2.2.3 + installer 6a2 - looks like deadlock in creating state. Any other options to try? Or is there working example somewhere? I would prefer to work with installer because with py2exe i get a crash in the app using these servers. Niki Spahiev From theller at python.net Fri Oct 22 14:27:39 2004 From: theller at python.net (Thomas Heller) Date: Fri Oct 22 14:27:27 2004 Subject: [python-win32] Re: how to load 2 python COM DLLs in single app? References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> Message-ID: >> I have APP which can load COM DLLs. Creating COM DLL servers with >> python is easy. Problem is that second DLL refuses to load. >> > Can you be specific about the problem? If the error is a deadlock, then > make sure you have the latest py2exe. > > Mark Unfortunately, the latest released py2exe 0.5.3 doesn't yet contain Mark's thread state fixes. By accident, I've just hacked in py2exe a little more, and it can now create a HTML page explaining module dependencies. Inspired by Toby Dickenson's code http://www.tarind.com/depgraph.html. The results are quite nice, imo, and hopefully I can release 0.5.4 even this night. Thomas From davidf at sjsoft.com Fri Oct 22 15:10:41 2004 From: davidf at sjsoft.com (David Fraser) Date: Fri Oct 22 15:10:49 2004 Subject: [python-win32] py2exe and module dependencies In-Reply-To: References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> Message-ID: <417906D1.6040206@sjsoft.com> Thomas Heller wrote: >By accident, I've just hacked in py2exe a little more, and it can now >create a HTML page explaining module dependencies. Inspired by Toby >Dickenson's code http://www.tarind.com/depgraph.html. >The results are quite nice, imo, and hopefully I can release 0.5.4 even >this night. > > Hi Thomas Not meaning to be rude, but I must say that the code does have problems with complex modules (won't work with my code :-)). But then again, py2exe does too... are you using his module dependency finders or the standard py2exe system? Anyway module dependency description would be quite helpful for resolving unneeded dependencies in py2exe Cheers David From theller at python.net Fri Oct 22 15:29:43 2004 From: theller at python.net (Thomas Heller) Date: Fri Oct 22 15:29:31 2004 Subject: [python-win32] Re: py2exe and module dependencies References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> <417906D1.6040206@sjsoft.com> Message-ID: David Fraser writes: > Thomas Heller wrote: > >>By accident, I've just hacked in py2exe a little more, and it can now >>create a HTML page explaining module dependencies. Inspired by Toby >>Dickenson's code http://www.tarind.com/depgraph.html. >>The results are quite nice, imo, and hopefully I can release 0.5.4 even >>this night. >> > Hi Thomas > > Not meaning to be rude, but I must say that the code does have > problems with complex modules (won't work with my code :-)). > But then again, py2exe does too... You mean, py2exe *has* problems with your code? > are you using his module dependency finders or the standard py2exe > system? py2exe uses the standard Python's modulefinder. If it has problems with some code, it may be a bug. Toby has simply overridden some methods, so that dependencies are collected - that's what I also use, plus I format a html page from the results. > Anyway module dependency description would be quite helpful for > resolving unneeded dependencies in py2exe Yes, that's the use case. With the html page full of links, it's easy to answer questions like - why the hell is this module included? - is that module really needed (for pure Python modules, the html page has a link which show the .py file in the browser) Anyway, I haven't yet looked at the module that Bob Ippolito has written for py2app, maybe it works better than modulefinder, and it can be used in the future for py2exe too. Thomas From niki at vintech.bg Fri Oct 22 16:29:56 2004 From: niki at vintech.bg (Niki Spahiev) Date: Fri Oct 22 16:30:02 2004 Subject: [python-win32] Re: how to load 2 python COM DLLs in single app? In-Reply-To: References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> Message-ID: <41791964.9060107@vintech.bg> Thomas Heller wrote: > > Unfortunately, the latest released py2exe 0.5.3 doesn't yet contain > Mark's thread state fixes. I tried run_dll.c v1.9 it's step forward (no crash) but second DLL replaces sys.path instead of adding to it. Niki Spahiev From davidf at sjsoft.com Fri Oct 22 16:38:57 2004 From: davidf at sjsoft.com (David Fraser) Date: Fri Oct 22 16:39:05 2004 Subject: [python-win32] Re: py2exe and module dependencies In-Reply-To: References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> <417906D1.6040206@sjsoft.com> Message-ID: <41791B81.6030909@sjsoft.com> Thomas Heller wrote: >David Fraser writes: > > > >>Thomas Heller wrote: >> >> >> >>>By accident, I've just hacked in py2exe a little more, and it can now >>>create a HTML page explaining module dependencies. Inspired by Toby >>>Dickenson's code http://www.tarind.com/depgraph.html. >>>The results are quite nice, imo, and hopefully I can release 0.5.4 even >>>this night. >>> >>> >>> >>Hi Thomas >> >>Not meaning to be rude, but I must say that the code does have >>problems with complex modules (won't work with my code :-)). >>But then again, py2exe does too... >> >> >You mean, py2exe *has* problems with your code? > > Actually nothing serious, and this was based on vague memories, so please disregard ... >>are you using his module dependency finders or the standard py2exe >>system? >> >> >py2exe uses the standard Python's modulefinder. If it has problems with >some code, it may be a bug. Toby has simply overridden some methods, so >that dependencies are collected - that's what I also use, plus I format >a html page from the results. > > OK great >>Anyway module dependency description would be quite helpful for >>resolving unneeded dependencies in py2exe >> >> >Yes, that's the use case. With the html page full of links, it's easy >to answer questions like >- why the hell is this module included? >- is that module really needed (for pure Python modules, the html page >has a link which show the .py file in the browser) > >Anyway, I haven't yet looked at the module that Bob Ippolito has written >for py2app, maybe it works better than modulefinder, and it can be used >in the future for py2exe too. > > Looking forward to the new version... David From christian at TreesforLife.org Fri Oct 22 16:48:25 2004 From: christian at TreesforLife.org (Christian Junker) Date: Fri Oct 22 16:48:30 2004 Subject: [python-win32] script as .dll file Message-ID: <8643B74BC5B4C045B96E7031CA94CBBD35F622@tfls02.tfl.net> Hi all, don't know if it's the right place to ask here, but I just read the other thread about DLLs so I thought I could ask my question as well: How do I compile a .py file into a .dll (PIC) file? And I am not talking about a COM-server or anything, just a simple Python script file. Best regards Christian Junker -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20041022/5eed8c23/attachment.html From theller at python.net Fri Oct 22 16:54:37 2004 From: theller at python.net (Thomas Heller) Date: Fri Oct 22 16:54:25 2004 Subject: [python-win32] Re: how to load 2 python COM DLLs in single app? References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> <41791964.9060107@vintech.bg> Message-ID: Niki Spahiev writes: > Thomas Heller wrote: > >> Unfortunately, the latest released py2exe 0.5.3 doesn't yet contain >> Mark's thread state fixes. > > I tried run_dll.c v1.9 it's step forward (no crash) but second DLL > replaces sys.path instead of adding to it. If you would like to work on a patch, it seems that the init_with_instance() function in start.c needs to be changed, depending on whether Python is already initialized or not. But this may open a can of worms. The only really clean way to do it would be to let py2exe create single-file com servers, which even don't rely on a separate python.dll. Thomas From niki at vintech.bg Fri Oct 22 18:20:14 2004 From: niki at vintech.bg (Niki Spahiev) Date: Fri Oct 22 18:20:21 2004 Subject: [python-win32] Re: how to load 2 python COM DLLs in single app? In-Reply-To: References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> <41791964.9060107@vintech.bg> Message-ID: <4179333E.4090700@vintech.bg> Thomas Heller wrote: > If you would like to work on a patch, it seems that the > init_with_instance() function in start.c needs to be changed, depending > on whether Python is already initialized or not. > > But this may open a can of worms. > > The only really clean way to do it would be to let py2exe create > single-file com servers, which even don't rely on a separate python.dll. But there are more DLL and PYD files needed to do the work. They all need python23.dll. Niki Spahiev From theller at python.net Fri Oct 22 19:18:14 2004 From: theller at python.net (Thomas Heller) Date: Fri Oct 22 19:18:01 2004 Subject: [python-win32] Re: how to load 2 python COM DLLs in single app? References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> <41791964.9060107@vintech.bg> <4179333E.4090700@vintech.bg> Message-ID: <8y9yllih.fsf@python.net> Niki Spahiev writes: > Thomas Heller wrote: > >> If you would like to work on a patch, it seems that the >> init_with_instance() function in start.c needs to be changed, depending >> on whether Python is already initialized or not. >> But this may open a can of worms. >> The only really clean way to do it would be to let py2exe create >> single-file com servers, which even don't rely on a separate python.dll. > > But there are more DLL and PYD files needed to do the work. They all > need python23.dll. Of course. Back to the original problem (using several frozen dll com servers in a single process), I envision these solutions, in increasing order of difficulty: 1. Patch py2exe's code so that sys.path is not replaced but extended when Python is already initialized. This gives no isolation between the com dlls (and the main process, if it also uses Python) at all. 2. Run the com dll servers in different interpreters, with Py_NewInterpreter(). According to the python docs, extension modules are still shared - this may be good, or may be bad. 3. Create completely standalone, single file dlls, with no external python.dll needed. 3a. The 'official' way to achive this is to make a static python build - in other words: recompile python itself plus all extension modules into a single executable (dll). This is easy, if you use ctypes to implement your com server. It will be more difficult if you use pywin32, as it is imo not yet ready to be compiled as builtin modules. py2exe may be changed to help with this, as soon as it's possible: it can create a config.c file listing the extension modules initxxx functions, compile it and link it together with the rest. The 'rest' in this case can be Python, plus all the extensions, as static link libraries. 3b. A hacky way may be this: It would be possible imo to create an PE file parser/editor, which takes some dlls, reads the PE headers, import tables, and whatever it needs and builds a new executable by combining the code segments and creating new import tables. I don't know if that's really possible... Thomas From mhammond at skippinet.com.au Sat Oct 23 03:21:01 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat Oct 23 03:21:17 2004 Subject: [python-win32] how to load 2 python COM DLLs in single app? In-Reply-To: <4178C3B4.8000205@vintech.bg> Message-ID: <154c01c4b89e$9572f8a0$0300a8c0@enfoldsystems.local> > Sorry. > With Python 2.3.4 + py2exe 0.5.3 i get MSVC++ runtime error - > looks like > assert Hmmm. That is strange. py2exe 0.5.4 has the deadlock fix, but its not at all clear they are the same problem. > I would prefer to work with installer because with py2exe i > get a crash in the app using these servers. I'm afraid I don't do any work with installer - py2exe has been successfully used by me for a number of complex products (but not without a number of (ongoing) tweaks - hence a thread-state deadlock was only fixed recently). I did use installer before, but seemed to have a bit of trouble getting patches in, so switched to py2exe where I didn't have that problem. Mark From email at thepete.net Sun Oct 24 02:42:29 2004 From: email at thepete.net (Pete Hodgson) Date: Sun Oct 24 22:01:52 2004 Subject: [python-win32] pythoncom.CoCreateInstance(...) problems Message-ID: <417AFA75.708@thepete.net> Hi all, Firstly, apologies for any dumbness, I'm a python newbie. I'm trying to use pythoncom to build a DirectShow Filter Graph, but I'm having problems getting the correct COM interface with pythoncom.CoCreateInstance(...). To try and diagnose the problem, I've written a toy C program which seems to me to be directly equivalent to the python script I'm having problems with. Here are the two programs: <------------START OF MY PYTHON IMPLEMENTATION---------------------> import pythoncom CLSID_FilterGraph = pythoncom.MakeIID('{E436EBB3-524F-11CE-9F53-0020AF0BA770}') IID_IGraphBuilder = pythoncom.MakeIID('{56A868A9-0AD4-11CE-B03A-0020AF0BA770}') print "CLSID_FilterGraph:", CLSID_FilterGraph print "IID_IGraphBuilder:", IID_IGraphBuilder pythoncom.CoInitialize() IFilterGraph = pythoncom.CoCreateInstance( CLSID_FilterGraph, None, pythoncom.CLSCTX_INPROC_SERVER, IID_IGraphBuilder ) <------------END OF MY PYTHON IMPLEMENTATION---------------------> When I run the above from IDLE, I get the following: <----------PYTHON OUTPUT---------------> IDLE 1.0.3 ==== No Subprocess ==== >>> CLSID_FilterGraph: {E436EBB3-524F-11CE-9F53-0020AF0BA770} IID_IGraphBuilder: {56A868A9-0AD4-11CE-B03A-0020AF0BA770} Traceback (most recent call last): File "D:\work\Personal\RM2MP3\rm2mp3.py", line 11, in ? IFilterGraph = pythoncom.CoCreateInstance( CLSID_FilterGraph, None, pythoncom.CLSCTX_INPROC_SERVER, IID_IGraphBuilder ) TypeError: There is no interface object registered that supports this IID >>> <------END PYTHON OUTPUT---------------> <------------START OF MY C IMPLEMENTATION---------------------> #include "stdafx.h" #include "dshow.h" int _tmain(int argc, _TCHAR* argv[]) { HRESULT hr; if( FAILED( CoInitialize(NULL) ) ) return -1; GUID _CLSID_FilterGraph; UuidFromString( (unsigned char*)"E436EBB3-524F-11CE-9F53-0020AF0BA770" , &_CLSID_FilterGraph ); GUID _IID_IGraphBuilder; UuidFromString( (unsigned char*)"56A868A9-0AD4-11CE-B03A-0020AF0BA770" , &_IID_IGraphBuilder ); IGraphBuilder *pIGraphBuilder; hr = CoCreateInstance( _CLSID_FilterGraph, NULL , CLSCTX_INPROC_SERVER, IID_IGraphBuilder , (void**) &pIGraphBuilder ); if( FAILED(hr) ) return -2; return 0; } <------------END OF MY C IMPLEMENTATION---------------------> The above C implementation compiles and runs fine, returning "CoCreateInstance(...) succeeded". Can anyone see why the C implementation works and the python one doesn't? I'm using the same CLSIDs and IIDs for both, and calling CoCreateInstance(...) in an identical manner. Any suggestions gratefully received! Cheers, Pete From mhammond at skippinet.com.au Sun Oct 24 23:44:16 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun Oct 24 23:44:22 2004 Subject: [python-win32] pythoncom.CoCreateInstance(...) problems In-Reply-To: <417AFA75.708@thepete.net> Message-ID: <1e3e01c4ba12$9d8bd0a0$0300a8c0@enfoldsystems.local> > IFilterGraph = pythoncom.CoCreateInstance( CLSID_FilterGraph, None, > pythoncom.CLSCTX_INPROC_SERVER, IID_IGraphBuilder ) Unfortunately, only IDispatch interfaces, or those with special C++ support can be used from Python. To use this interface you would probably need to write an special win32com extension - just like the other win32com extensions, such as MAPI, adsi, etc. Mark From niki at vintech.bg Mon Oct 25 09:53:01 2004 From: niki at vintech.bg (Niki Spahiev) Date: Mon Oct 25 09:53:12 2004 Subject: [python-win32] Re: how to load 2 python COM DLLs in single app? In-Reply-To: <8y9yllih.fsf@python.net> References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> <41791964.9060107@vintech.bg> <4179333E.4090700@vintech.bg> <8y9yllih.fsf@python.net> Message-ID: <417CB0DD.4090606@vintech.bg> Thomas Heller wrote: > 1. Patch py2exe's code so that sys.path is not replaced but extended > when Python is already initialized. This gives no isolation between the > com dlls (and the main process, if it also uses Python) at all. > > 2. Run the com dll servers in different interpreters, with > Py_NewInterpreter(). According to the python docs, extension modules > are still shared - this may be good, or may be bad. 2a. Installer for example renames mk4py.dll found in package foo as foo.mk4py.dll IMO this way we can have separate copy of each extension in each interpreter. I am trying to grok Phillip J. Eby's ideas and produce something about Py_NewInterpreter. > > 3. Create completely standalone, single file dlls, with no external > python.dll needed. IMHO not good - will need separate tests with each release. Niki Spahiev From mhammond at skippinet.com.au Mon Oct 25 12:55:53 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon Oct 25 12:56:12 2004 Subject: [python-win32] Re: how to load 2 python COM DLLs in single app? In-Reply-To: <417CB0DD.4090606@vintech.bg> Message-ID: <02ab01c4ba81$3bf49a10$0300a8c0@enfoldsystems.local> > I am trying to grok Phillip J. Eby's ideas and produce > something about Py_NewInterpreter. Multiple interpreter states are effectively deprecated. There are a number of known issues, including that the PyGILState APIs don't work them (for the exact reason that they are effectively deprecated!) Guido, Tim Peters and I discussed this in the process of putting together the GILState APIs. The PyWin32 extensions, and py2exe, use PyGILState. Ultimately, the problem is that everyone has punted on multiple-interpreter issues. A correct solution requires fundamental changes to the Python import mechanism (eg, C extension modules with "globals" would need to become interpreter-state aware). The problem is effectively the same as multiple init/finalize sequences not being able to work correctly/cleanly. I don't have any specific recommendation, but you should be aware of the general problem, and the general lack of momentum in any solution :( As Thomas mentioned, completely independent Python instances via static linking is probably the most realistic, even if ugly option. Mark From python at kareta.de Mon Oct 25 15:20:31 2004 From: python at kareta.de (=?ISO-8859-1?B?SvxyZ2VuIEthcmV0YQ==?=) Date: Mon Oct 25 15:21:01 2004 Subject: [python-win32] Installer Message-ID: <1098710431.417cfd9f74575@webmail.ldc.de> Hello, in the last mails sometimes the Installer was anounced. I suggest Gordon McMillans installer_5b4 was talked about. I tried 5b4 with python 2.3 and get errormessages with 'SET_LINENO'. As the SET_LINENO opcode was removed from python 2.3 I thought it doesn't work anymore. I also tried to check Gordons website but it is still unavailable (www.mcmillan- inc.com). Can anybody please give me a state about the installer and is the content of Gordons site still available ? regards, J?rgen From davidf at sjsoft.com Mon Oct 25 15:31:45 2004 From: davidf at sjsoft.com (David Fraser) Date: Mon Oct 25 15:31:53 2004 Subject: [python-win32] Installer In-Reply-To: <1098710431.417cfd9f74575@webmail.ldc.de> References: <1098710431.417cfd9f74575@webmail.ldc.de> Message-ID: <417D0041.1050308@sjsoft.com> J?rgen Kareta wrote: >Hello, > >in the last mails sometimes the Installer was anounced. I suggest Gordon >McMillans installer_5b4 was talked about. > >I tried 5b4 with python 2.3 and get errormessages with 'SET_LINENO'. As the >SET_LINENO opcode was removed from python 2.3 I thought it doesn't work anymore. >I also tried to check Gordons website but it is still unavailable (www.mcmillan- >inc.com). > >Can anybody please give me a state about the installer and is the content of >Gordons site still available ? > >regards, >J?rgen > Apparently Gordon is still working on his installer although the website doesn't work and hasn't for months. I have a mirror of his site which includes the latest install_6 alpha (6a2) I know of: http://davidf.sjsoft.com/mirrors/mcmillan-inc/ The latest version is available from the downloqad directory: http://davidf.sjsoft.com/mirrors/mcmillan-inc/dnld/ More info in the comp.lang.python archives Hope that helps David From cedric.delfosse at linbox.com Mon Oct 25 15:53:04 2004 From: cedric.delfosse at linbox.com (Cedric Delfosse) Date: Mon Oct 25 16:28:13 2004 Subject: [python-win32] Linbox-Converter Message-ID: <1098712383.12766.96.camel@replic.metz> Hello, for your information, my company has opensourced Linbox-Converter, a MS-Office files converter. More informations here: http://www.linbox.com/en/converter GForge project page: http://adullact.net/projects/lbx-converter/ I'd like to thank all the people from this mailing-list that helped us (directly or indirectly) to write this software. And of course, special thanks to Mark Hammond for Python-Win32. Best 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 graemeglass at gmail.com Mon Oct 25 16:31:17 2004 From: graemeglass at gmail.com (Graeme Glass) Date: Mon Oct 25 16:38:00 2004 Subject: [python-win32] Python Programming on Win32 Message-ID: Just a shout out to Mark and Andy for the great book!!! Highly recommend this book to anyone using python on win32 platform. Thanks, Graeme From python at kareta.de Mon Oct 25 17:09:22 2004 From: python at kareta.de (=?ISO-8859-1?B?SvxyZ2VuIEthcmV0YQ==?=) Date: Mon Oct 25 17:09:56 2004 Subject: [python-win32] Re:Installer Message-ID: <1098716962.417d1722c2b4a@webmail.ldc.de> Hello David, thanks for your replay. I'd like to hear that this nice pice of code is still available:-) regards J?rgen From janeaustine50 at hotmail.com Mon Oct 25 18:38:03 2004 From: janeaustine50 at hotmail.com (Austine Jane) Date: Mon Oct 25 18:39:13 2004 Subject: [python-win32] firefox automation like ie automation through win32com? Message-ID: I don't know if this is the right place for ask this question but it's really hard to decide where to ask it, since the question relates to a few things simultaneously. I know of win32com techniques to control IE outside with python scripts. I use it for web site testing and love it so much. Now I have to control firefox browser outside with python scripts. Is it possible? I feel so desperate now. Jane _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.com/ From timr at probo.com Mon Oct 25 21:06:18 2004 From: timr at probo.com (Tim Roberts) Date: Mon Oct 25 21:06:22 2004 Subject: [python-win32] script as .dll file In-Reply-To: <20041023012119.C03701E400E@bag.python.org> References: <20041023012119.C03701E400E@bag.python.org> Message-ID: <417D4EAA.9080005@probo.com> On Fri, 22 Oct 2004 09:48:25 -0500, "Christian Junker" wrote: >Hi all, > >don't know if it's the right place to ask here, but I just read the other thread about DLLs so I thought I could ask my question as well: > >How do I compile a .py file into a .dll (PIC) file? And I am not talking about a COM-server or anything, just a simple Python script file. > > You can't, for the same reason you couldn't do it with Visual Basic. Python is interpreted, so there has to be an interpreter in there. The right way to do it -- just like with Visual Basic -- is to make an out-of-process COM server. Theoretically, I suppose you could write a C++ wrapper that fired up an interpreter and called classes in your script, but believe me when I say that would be more trouble that a simple COM server. -- - Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc. From alipolatel at yahoo.com Mon Oct 25 21:33:29 2004 From: alipolatel at yahoo.com (Ali Polatel) Date: Mon Oct 25 21:33:32 2004 Subject: [python-win32] Linux\Windows Message-ID: <20041025193329.44032.qmail@web61006.mail.yahoo.com> Dear tutors, I have written a programme for windows (no GUI but some commands which create and write things in text files) I want to modify this programme so that it will work in Linux... I think there is no need to change the usual functions and classes all I need to do is a modification in creating files outside the programme. If anyone who knows how to do this in Linux can you tell me the equivalent of the function in Linux?: "go=open('c:/test.txt','w')" go.write('Hello world\n') Another thing is in windows the programme can understand it self-directory with os.getcwd() command...Can we also do it in Linux?I mean for example when I do: import os os.getcwd() the interpreter gives "c:\python23" How to do same in Linux? And I am not someone who is acquianted with Linux..Can someone create directories in Linux?(like the mkdir() function in windows) Thanks all for your help Ali Polatel --------------------------------- Do you Yahoo!? vote.yahoo.com - Register online to vote today! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20041025/a2d428a7/attachment.html From wyvernlist at crm3.com Tue Oct 26 01:29:46 2004 From: wyvernlist at crm3.com (Wyvern List) Date: Tue Oct 26 01:29:45 2004 Subject: [python-win32] Can't import wmi in scripts run by nrpe_nt Message-ID: <1098746986.8940.19.camel@localhost> Hi all, I'm having a curious problem and was wondering if anyone might have some insight. As a bit of background, nrpe_nt is a Nagios (www.nagios.org) addon. It is a service that runs on Windows machines and allows nagios to execute arbitrary scripts on that machine using the check_nrpe plugin. When nagios calls nrpe_nt on a remote machine with a specific command to execute, the nrpe_nt service maps the nagios command to a specific command to be executed on the windows box. for example nrpe_nt might have a definition to map the nagios command 'check_disk' to a command such as "C:\Python23\python.exe C:\NRPE_NT\bin\DiskFree.py" The aforementioned DiskFree.py is a simple python script I nabbed from Tim Golden's "WMI Cookbook" that uses the wmi module. It works like a charm when called locally, but when called by nrpe_nt the script bombs out with the non-helpful message: tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c check_python Traceback (most recent call last): I checked sys.path - it printed out the correct locations when run by nrpe_nt. I tried using the imp module to do some more debugging, and found that python could find the wmi module, but it bombed when I tried to load it using load_module. I tried it with ActivePython but got the same problem. Could this be related to the WMI multithreading issue? Thanks, Jan --- Jan Van Uytven Computer Systems & Network Engineer Convergent Media Network wyvern@crm3.com Randomly selected from my quote-file: "I smell blood and an era of prominent madmen." -W.H. Auden >>> LEGAL STUFF <<< This electronic message transmission, including any attached files, contains information which may be confidential and/or privileged. The information is intended to be for the SOLE use of the individual or entity named above. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution or use of the contents of this information is prohibited. This message is not to be forwarded for any reason without prior consent of the sender. If you have received this electronic transmission in error, please notify the sender immediately by telephone (250) 386-4266 or by a 'reply to sender only' message and destroy all electronic and hard copies of the communication, including attachments, without reading or saving in any manner. From tim.golden at viacom-outdoor.co.uk Tue Oct 26 09:38:48 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Tue Oct 26 09:43:46 2004 Subject: [python-win32] Linux\Windows Message-ID: [Ali Polatel] > I have written a programme for windows (no GUI but > some commands which create and write things in text files) > I want to modify this programme so that it will work in Linux... > If anyone who knows how to do this in Linux can you tell me > the equivalent of the function in Linux?: > "go=open('c:/test.txt','w')" > go.write('Hello world\n') Ummm... the only thing you need to change is the location of the file. If you don't know where to put the file on Linux instead of "c:/" then maybe you ought to find out before you go any further. A sensible choice might be: go = open ("~/test.txt", "w") which will put the file in the user's home directory. > Another thing is in windows the programme can > understand it self-directory with os.getcwd() > command...Can we also do it in Linux? Yes. > And I am not someone who is acquianted with Linux.. > Can someone create directories in Linux? > (like the mkdir() function in windows) Yes. By the way, if you haven't already, please post to the main Python newsgroup / mailing list; either news:comp.lang.python or http://mail.python.org/mailman/listinfo/python-list HTH TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From craig at coot.net Tue Oct 26 14:46:11 2004 From: craig at coot.net (Craig H. Anderson) Date: Tue Oct 26 15:53:18 2004 Subject: [python-win32] py2exe app on Windows 95 Message-ID: I'm getting desparate. I have 80 Windows 95 workstations and an py2exe app that won't run. There is not enough hard drive space to load the Python development tools. When I run the exe the hardrive goes busy, but the app does not start or give any error messages. The app works fine on windows XP and Windows 98. Any pointers on py2exe apps on Windows 95 are appreciated. Thanks. From tim.golden at viacom-outdoor.co.uk Tue Oct 26 15:57:47 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Tue Oct 26 16:03:03 2004 Subject: [python-win32] Can't import wmi in scripts run by nrpe_nt Message-ID: [Wyvern List] | When nagios calls nrpe_nt on a remote machine with a specific | command to execute, the nrpe_nt service maps the nagios command | to a specific command to be executed on the windows box. | for example nrpe_nt might have a definition to map the nagios | command 'check_disk' to a command such as | "C:\Python23\python.exe C:\NRPE_NT\bin\DiskFree.py" | | The aforementioned DiskFree.py is a simple python script I nabbed from | Tim Golden's "WMI Cookbook" that uses the wmi module. It works like a | charm when called locally, but when called by nrpe_nt the script bombs | out with the non-helpful message: | | tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c check_python | Traceback (most recent call last): I'm not sure I understand what's happening here. Is my understanding of the scenario correct? On machine A you can run some Nagios command on machine A which indirectly runs diskfree.py on machine A, invoking WMI on machine A etc. This works. On machine A you run some Nagios command on machine B which indirectly runs diskfree.py on machine B, invoking WMI on machine B. This gies some error. In none of this are you trying to invoke WMI remotely. Is this correct? TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From steve at holdenweb.com Tue Oct 26 06:25:29 2004 From: steve at holdenweb.com (Steve Holden) Date: Tue Oct 26 16:54:53 2004 Subject: [python-win32] Sending MAPI email Message-ID: <417DD1B9.6040802@holdenweb.com> I tried the code recently posted on the list, but sadly got: ... File "sendmapi.py", line 23, in SendEMAPIMail mapi.MAPIInitialize(None) pywintypes.com_error: (-2147467259, 'Unspecified error', None, None) What obvious setup step do I appear to have forgotten (having remembered to makepy the MAPI stuff)? regards Steve -- http://www.holdenweb.com http://pydish.holdenweb.com Holden Web LLC +1 800 494 3119 From craig at coot.net Tue Oct 26 15:48:42 2004 From: craig at coot.net (Craig H. Anderson) Date: Tue Oct 26 16:55:58 2004 Subject: [python-win32] Re: py2exe app on Windows 95 Message-ID: App is still not running, but I found some log output finally. Traceback (most recent call last): File "WOCloseApp.py", line 2, in ? File "adodbapi\__init__.pyc", line 1, in ? File "adodbapi\adodbapi.pyc", line 24, in ? File "win32com\__init__.pyc", line 5, in ? File "win32api.pyc", line 9, in ? File "win32api.pyc", line 7, in __load ImportError: DLL load failed: A device attached to the system is not functioning. line 5 c/Python23/Lib/site-packages/win32com/__init__.py import win32api, sys, os The dist folder has a file win32api.pyd setup.py from distutils.core import setup import py2exe setup(name = "GcsDirecTech", version = "1.0", packages = ["GcsDirecTech" ], windows = ["GcsDirecTech/WOCloseApp.py" ], console = ["GcsDirecTech/Hello.py" ] ) From tim.golden at viacom-outdoor.co.uk Tue Oct 26 16:53:18 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Tue Oct 26 16:58:23 2004 Subject: [python-win32] Re: py2exe app on Windows 95 Message-ID: No details to hand, but I distinctly remember Mark H saying that pywin32 no longer supported Win95. Try checking the python-win32 archives (or maybe Mark or someone more knowledgeable is reading this)... TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From niki at vintech.bg Tue Oct 26 17:42:31 2004 From: niki at vintech.bg (Niki Spahiev) Date: Tue Oct 26 17:42:46 2004 Subject: [python-win32] Re: py2exe app on Windows 95 In-Reply-To: References: Message-ID: <417E7067.7030303@vintech.bg> Craig H. Anderson wrote: > > App is still not running, but I found some log output finally. > Traceback (most recent call last): > File "WOCloseApp.py", line 2, in ? > File "adodbapi\__init__.pyc", line 1, in ? > File "adodbapi\adodbapi.pyc", line 24, in ? > File "win32com\__init__.pyc", line 5, in ? > File "win32api.pyc", line 9, in ? > File "win32api.pyc", line 7, in __load > ImportError: DLL load failed: A device attached to the system is not > functioning. This strange message means that some of imports of win32api.pyd are missing. Are you using latest pywin32? There was problem with b202 IIRC Niki Spahiev From steve at holdenweb.com Tue Oct 26 16:41:35 2004 From: steve at holdenweb.com (Steve Holden) Date: Tue Oct 26 18:17:05 2004 Subject: [python-win32] Forget last posting Message-ID: <417E621F.9040801@holdenweb.com> Everything appears to work correctly when I set a valid profile name, so please ignore my last question: that was the obvious step I overlooked. regards Steve -- http://www.holdenweb.com http://pydish.holdenweb.com Holden Web LLC +1 800 494 3119 From craig at coot.net Tue Oct 26 17:17:52 2004 From: craig at coot.net (Craig H. Anderson) Date: Tue Oct 26 18:25:16 2004 Subject: [python-win32] Re: py2exe app on Windows 95 In-Reply-To: <417E7067.7030303@vintech.bg> References: <417E7067.7030303@vintech.bg> Message-ID: I've tried pywin32-201 and pywin32-203. Both give this error. Niki Spahiev writes: > Craig H. Anderson wrote: >> >> App is still not running, but I found some log output finally. >> Traceback (most recent call last): >> File "WOCloseApp.py", line 2, in ? >> File "adodbapi\__init__.pyc", line 1, in ? >> File "adodbapi\adodbapi.pyc", line 24, in ? >> File "win32com\__init__.pyc", line 5, in ? >> File "win32api.pyc", line 9, in ? >> File "win32api.pyc", line 7, in __load >> ImportError: DLL load failed: A device attached to the system is not >> functioning. > > This strange message means that some of imports of win32api.pyd are > missing. Are you using latest pywin32? > > There was problem with b202 IIRC > > Niki Spahiev > From steve at holdenweb.com Tue Oct 26 18:21:08 2004 From: steve at holdenweb.com (Steve Holden) Date: Tue Oct 26 18:26:35 2004 Subject: [python-win32] Forget last posting In-Reply-To: <417E621F.9040801@holdenweb.com> References: <417E621F.9040801@holdenweb.com> Message-ID: <417E7974.6050806@holdenweb.com> Steve Holden wrote: > Everything appears to work correctly when I set a valid profile name, so > please ignore my last question: that was the obvious step I overlooked. > > regards > Steve However the messages appear as unread in my Outbox folder. Clearly MAPI allows me to vary this, so I'd appreciate it if someone could point me to the requisite docs (there's a LOT of MAPI stuff out there, so Google is swamping me a bit). thanks Steve -- http://www.holdenweb.com http://pydish.holdenweb.com Holden Web LLC +1 800 494 3119 From christian at TreesforLife.org Tue Oct 26 18:55:52 2004 From: christian at TreesforLife.org (Christian Junker) Date: Tue Oct 26 18:56:03 2004 Subject: [python-win32] firefox automation like ie automation throughwin32com? Message-ID: <8643B74BC5B4C045B96E7031CA94CBBD435B1C@tfls02.tfl.net> I tried that before as well. Mozilla and derived distributions have their own component model XPCOM which is not really an extension to COM, but very different. I didn't find any way to connect to it and I would like to control certain things with Python scripts as well. So if anyone knows something about this topic, please let Austin, me and the whole list know. Best regards Christian Junker > -----Original Message----- > From: Austine Jane [mailto:janeaustine50@hotmail.com] > Sent: Monday, October 25, 2004 11:38 AM > To: python-win32@python.org > Subject: [python-win32] firefox automation like ie automation > throughwin32com? > > > I don't know if this is the right place for ask this question > but it's > really hard to decide where to ask it, since the question > relates to a few > things simultaneously. > > I know of win32com techniques to control IE outside with > python scripts. I > use it for web site testing and love it so much. > > Now I have to control firefox browser outside with python > scripts. Is it > possible? I feel so desperate now. > > Jane > > _________________________________________________________________ > FREE pop-up blocking with the new MSN Toolbar - get it now! > http://toolbar.msn.com/ > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From pythonmailing at web.de Tue Oct 26 19:14:34 2004 From: pythonmailing at web.de (Marek Kubica) Date: Tue Oct 26 19:10:46 2004 Subject: [python-win32] firefox automation like ie automation through win32com? In-Reply-To: <8643B74BC5B4C045B96E7031CA94CBBD435B1C@tfls02.tfl.net> References: <8643B74BC5B4C045B96E7031CA94CBBD435B1C@tfls02.tfl.net> Message-ID: <20041026191434.00004bbe@galileo> On Tue, 26 Oct 2004 11:55:52 -0500 "Christian Junker" wrote: > I tried that before as well. > Mozilla and derived distributions have their own component model XPCOM > which is not really an extension to COM, but very different. I didn't > find any way to connect to it and I would like to control certain > things with Python scripts as well. So if anyone knows something about > this topic, please let Austin, me and the whole list know. Look here for XPCOM docs: http://www.mozilla.org/projects/xpcom/ and here for a Python Binding http://aspn.activestate.com/ASPN/Downloads/Komodo/PyXPCOM/ I find it quite interessting, but never tried it... and PyXPCOM seems to be quite old. Maybe you could use the mozctl(x).dll, it seems to be embeddable into other programs... greets, Marek From niki at vintech.bg Tue Oct 26 19:17:07 2004 From: niki at vintech.bg (Niki Spahiev) Date: Tue Oct 26 19:17:20 2004 Subject: [python-win32] Re: py2exe app on Windows 95 In-Reply-To: References: <417E7067.7030303@vintech.bg> Message-ID: <417E8693.1070005@vintech.bg> Craig H. Anderson wrote: > I've tried pywin32-201 and pywin32-203. Both give this error. Get "dependency walker" and check win32api.pyd on win95 Niki From wyvernlist at crm3.com Tue Oct 26 19:29:20 2004 From: wyvernlist at crm3.com (Jan Van Uytven (Wyvern)) Date: Tue Oct 26 19:29:16 2004 Subject: [python-win32] Can't import wmi in scripts run by nrpe_nt In-Reply-To: References: Message-ID: <1098811760.7559.19.camel@localhost> I'm sorry, I could have phrased this better. BTW, I'd like to congratulate you on wmi. If it weren't so useful to me I wouldn't be trying to solve this problem. Machine A is a linux box. It has Nagios installed on it. On this machine is a plugin, check_nrpe, which can be called to return the result of a given command on a remote box that runs the nrpe daemon, such as Machine B. Machine B is a Windows 2003 server. It has Python 2.3, The Win32 extensions, and WMI installed. It has a service, nrpe_nt, which can receive commands from Machine A to execute and return the results of any script or executable you define. On Machine B, I have written a simple script, check_python.py, It's just this: import sys,wmi print "Imported wmi!" sys.exit(0) On Machine B, this works fine when I run it from the command line ("python check_python.py") or from inside PythonWin. I have set up nrpe_nt so that when it receives the command 'check_python' from Machine A it executes this: "C:\Python23\python.exe C:\NRPE_NT\bin\check_python.py" However when I actually run the command the script bombs out and the only reply I get from Machine B (on Machine A, where check_nrpe is) is tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c check_python Traceback (most recent call last): After removing 'wmi' from the import list, it worked. But putting it back in causes the script to bomb, and I don't know why. These work: * import sys,os * import sys,os,win32com * import sys,os,win32com,win32security But this doesn't: * import sys,wmi I also tried the full path version of the command manually. It works. So there's something different that happens when you import wmi from an interactive script versus when it's called remotely by nrpe_nt. I've asked the nrpe_nt dev, but he's stumped (not being a python guy). Is there something specific that happens when wmi gets imported? I used the imp module, and the problem is not that the module can't be found, it's that something weird happens when it gets loaded. Thanks, Jan On Tue, 2004-10-26 at 14:57 +0100, Tim Golden wrote: > [Wyvern List] > | When nagios calls nrpe_nt on a remote machine with a specific > | command to execute, the nrpe_nt service maps the nagios command > | to a specific command to be executed on the windows box. > | for example nrpe_nt might have a definition to map the nagios > | command 'check_disk' to a command such as > | "C:\Python23\python.exe C:\NRPE_NT\bin\DiskFree.py" > | > | The aforementioned DiskFree.py is a simple python script I nabbed from > | Tim Golden's "WMI Cookbook" that uses the wmi module. It works like a > | charm when called locally, but when called by nrpe_nt the script bombs > | out with the non-helpful message: > | > | tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c check_python > | Traceback (most recent call last): > > I'm not sure I understand what's happening here. Is my understanding > of the scenario correct? > > On machine A you can run some Nagios command on machine A > which indirectly runs diskfree.py on machine A, invoking WMI > on machine A etc. This works. > > On machine A you run some Nagios command on machine B > which indirectly runs diskfree.py on machine B, invoking WMI > on machine B. This gies some error. > > In none of this are you trying to invoke WMI remotely. > > Is this correct? > > TJG > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 --- Jan Van Uytven Computer Systems & Network Engineer Convergent Media Network wyvern@crm3.com Randomly selected from my quote-file: "Before a word can be said, there must be silence. Before, and after." - Ursulu K. Le Guin, "A Wizard of Earthsea" >>> LEGAL STUFF <<< This electronic message transmission, including any attached files, contains information which may be confidential and/or privileged. The information is intended to be for the SOLE use of the individual or entity named above. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution or use of the contents of this information is prohibited. This message is not to be forwarded for any reason without prior consent of the sender. If you have received this electronic transmission in error, please notify the sender immediately by telephone (250) 386-4266 or by a 'reply to sender only' message and destroy all electronic and hard copies of the communication, including attachments, without reading or saving in any manner. From Jim.Vickroy at noaa.gov Tue Oct 26 19:57:26 2004 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Oct 26 19:57:32 2004 Subject: [python-win32] writing a "cluster-aware" service ? In-Reply-To: <1098811760.7559.19.camel@localhost> Message-ID: Could someone point to a resource for writing "cluster-aware" services? Is it possible to do this in Python? Thanks, -- jv From Richard.Martin at thomson.net Tue Oct 26 20:22:03 2004 From: Richard.Martin at thomson.net (Martin Richard) Date: Tue Oct 26 20:23:16 2004 Subject: [python-win32] Can't import wmi in scripts run by nrpe_nt Message-ID: <3531F1FE12C5B4489D2014F59B46691302142961@bvtnsmail01.am.thmulti.com> Jan, Could it have anything to do with the privileges available to you when running locally vs. those available for whatever-the-effective-user-is when running remote? Or perhaps the environment variables for each of those? Rick -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org] On Behalf Of Jan Van Uytven (Wyvern) Sent: Tuesday, October 26, 2004 10:29 AM To: python-win32@python.org Subject: RE: [python-win32] Can't import wmi in scripts run by nrpe_nt I'm sorry, I could have phrased this better. BTW, I'd like to congratulate you on wmi. If it weren't so useful to me I wouldn't be trying to solve this problem. Machine A is a linux box. It has Nagios installed on it. On this machine is a plugin, check_nrpe, which can be called to return the result of a given command on a remote box that runs the nrpe daemon, such as Machine B. Machine B is a Windows 2003 server. It has Python 2.3, The Win32 extensions, and WMI installed. It has a service, nrpe_nt, which can receive commands from Machine A to execute and return the results of any script or executable you define. On Machine B, I have written a simple script, check_python.py, It's just this: import sys,wmi print "Imported wmi!" sys.exit(0) On Machine B, this works fine when I run it from the command line ("python check_python.py") or from inside PythonWin. I have set up nrpe_nt so that when it receives the command 'check_python' from Machine A it executes this: "C:\Python23\python.exe C:\NRPE_NT\bin\check_python.py" However when I actually run the command the script bombs out and the only reply I get from Machine B (on Machine A, where check_nrpe is) is tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c check_python Traceback (most recent call last): After removing 'wmi' from the import list, it worked. But putting it back in causes the script to bomb, and I don't know why. These work: * import sys,os * import sys,os,win32com * import sys,os,win32com,win32security But this doesn't: * import sys,wmi I also tried the full path version of the command manually. It works. So there's something different that happens when you import wmi from an interactive script versus when it's called remotely by nrpe_nt. I've asked the nrpe_nt dev, but he's stumped (not being a python guy). Is there something specific that happens when wmi gets imported? I used the imp module, and the problem is not that the module can't be found, it's that something weird happens when it gets loaded. Thanks, Jan On Tue, 2004-10-26 at 14:57 +0100, Tim Golden wrote: > [Wyvern List] > | When nagios calls nrpe_nt on a remote machine with a specific > | command to execute, the nrpe_nt service maps the nagios command > | to a specific command to be executed on the windows box. > | for example nrpe_nt might have a definition to map the nagios > | command 'check_disk' to a command such as > | "C:\Python23\python.exe C:\NRPE_NT\bin\DiskFree.py" > | > | The aforementioned DiskFree.py is a simple python script I nabbed > | from Tim Golden's "WMI Cookbook" that uses the wmi module. It works > | like a charm when called locally, but when called by nrpe_nt the > | script bombs out with the non-helpful message: > | > | tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c check_python > | Traceback (most recent call last): > > I'm not sure I understand what's happening here. Is my understanding > of the scenario correct? > > On machine A you can run some Nagios command on machine A which > indirectly runs diskfree.py on machine A, invoking WMI on machine A > etc. This works. > > On machine A you run some Nagios command on machine B > which indirectly runs diskfree.py on machine B, invoking WMI on > machine B. This gies some error. > > In none of this are you trying to invoke WMI remotely. > > Is this correct? > > TJG > > ______________________________________________________________________ > __ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 --- Jan Van Uytven Computer Systems & Network Engineer Convergent Media Network wyvern@crm3.com Randomly selected from my quote-file: "Before a word can be said, there must be silence. Before, and after." - Ursulu K. Le Guin, "A Wizard of Earthsea" >>> LEGAL STUFF <<< This electronic message transmission, including any attached files, contains information which may be confidential and/or privileged. The information is intended to be for the SOLE use of the individual or entity named above. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution or use of the contents of this information is prohibited. This message is not to be forwarded for any reason without prior consent of the sender. If you have received this electronic transmission in error, please notify the sender immediately by telephone (250) 386-4266 or by a 'reply to sender only' message and destroy all electronic and hard copies of the communication, including attachments, without reading or saving in any manner. _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From wyvernlist at crm3.com Tue Oct 26 20:54:59 2004 From: wyvernlist at crm3.com (Jan Van Uytven (Wyvern)) Date: Tue Oct 26 20:54:56 2004 Subject: [python-win32] Can't import wmi in scripts run by nrpe_nt In-Reply-To: <3531F1FE12C5B4489D2014F59B46691302142961@bvtnsmail01.am.thmulti.com> References: <3531F1FE12C5B4489D2014F59B46691302142961@bvtnsmail01.am.thmulti.com> Message-ID: <1098816899.7774.11.camel@localhost> Hi Martin, I had considered this and set the nrpe_nt service to run as myself (a domain admin) instead of the system account. It did not make a difference. I modified the script to print sys.path and ran it through nrpe. It correctly printed out the contents of the PYTHONPATH variable. Thanks for the thought, though. Jan On Tue, 2004-10-26 at 11:22 -0700, Martin Richard wrote: > Jan, > > Could it have anything to do with the privileges available to you when > running locally vs. those available for whatever-the-effective-user-is > when running remote? Or perhaps the environment variables for each of > those? > > Rick > > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org] On Behalf Of Jan Van Uytven > (Wyvern) > Sent: Tuesday, October 26, 2004 10:29 AM > To: python-win32@python.org > Subject: RE: [python-win32] Can't import wmi in scripts run by nrpe_nt > > > I'm sorry, I could have phrased this better. > > BTW, I'd like to congratulate you on wmi. If it weren't so useful to me > I wouldn't be trying to solve this problem. > > Machine A is a linux box. It has Nagios installed on it. On this machine > is a plugin, check_nrpe, which can be called to return the result of a > given command on a remote box that runs the nrpe daemon, such as Machine > B. > > Machine B is a Windows 2003 server. It has Python 2.3, The Win32 > extensions, and WMI installed. It has a service, nrpe_nt, which can > receive commands from Machine A to execute and return the results of any > script or executable you define. > > On Machine B, I have written a simple script, check_python.py, It's just > this: > > import sys,wmi > print "Imported wmi!" > sys.exit(0) > > On Machine B, this works fine when I run it from the command line > ("python check_python.py") or from inside PythonWin. > > I have set up nrpe_nt so that when it receives the command > 'check_python' from Machine A it executes this: "C:\Python23\python.exe > C:\NRPE_NT\bin\check_python.py" > > However when I actually run the command the script bombs out and the > only reply I get from Machine B (on Machine A, where check_nrpe is) is > > tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c check_python > Traceback (most recent call last): > > After removing 'wmi' from the import list, it worked. But putting it > back in causes the script to bomb, and I don't know why. These work: > * import sys,os > * import sys,os,win32com > * import sys,os,win32com,win32security > But this doesn't: > * import sys,wmi > > I also tried the full path version of the command manually. It works. > > So there's something different that happens when you import wmi from an > interactive script versus when it's called remotely by nrpe_nt. I've > asked the nrpe_nt dev, but he's stumped (not being a python guy). > > Is there something specific that happens when wmi gets imported? I used > the imp module, and the problem is not that the module can't be found, > it's that something weird happens when it gets loaded. > > Thanks, > > Jan > > > > > On Tue, 2004-10-26 at 14:57 +0100, Tim Golden wrote: > > [Wyvern List] > > | When nagios calls nrpe_nt on a remote machine with a specific > > | command to execute, the nrpe_nt service maps the nagios command > > | to a specific command to be executed on the windows box. > > | for example nrpe_nt might have a definition to map the nagios > > | command 'check_disk' to a command such as > > | "C:\Python23\python.exe C:\NRPE_NT\bin\DiskFree.py" > > | > > | The aforementioned DiskFree.py is a simple python script I nabbed > > | from Tim Golden's "WMI Cookbook" that uses the wmi module. It works > > | like a charm when called locally, but when called by nrpe_nt the > > | script bombs out with the non-helpful message: > > | > > | tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c check_python > > | Traceback (most recent call last): > > > > I'm not sure I understand what's happening here. Is my understanding > > of the scenario correct? > > > > On machine A you can run some Nagios command on machine A which > > indirectly runs diskfree.py on machine A, invoking WMI on machine A > > etc. This works. > > > > On machine A you run some Nagios command on machine B > > which indirectly runs diskfree.py on machine B, invoking WMI on > > machine B. This gies some error. > > > > In none of this are you trying to invoke WMI remotely. > > > > Is this correct? > > > > TJG > > > > ______________________________________________________________________ > > __ > > This e-mail has been scanned for all viruses by Star. The > > service is powered by MessageLabs. For more information on a proactive > > anti-virus service working around the clock, around the globe, visit: > > http://www.star.net.uk > > > ________________________________________________________________________ > > _______________________________________________ > > Python-win32 mailing list > > Python-win32@python.org > > http://mail.python.org/mailman/listinfo/python-win32 > --- > Jan Van Uytven > Computer Systems & Network Engineer > Convergent Media Network > wyvern@crm3.com > > Randomly selected from my quote-file: > > "Before a word can be said, there must be silence. Before, and after." > - Ursulu K. Le Guin, "A Wizard of Earthsea" > > > >>> LEGAL STUFF <<< > This electronic message transmission, including any attached files, > contains information which may be confidential and/or privileged. The > information is intended to be for the SOLE use of the individual or > entity named above. If you are not the intended recipient, be aware > that any review, disclosure, copying, distribution or use of the > contents of this information is prohibited. This message is not to be > forwarded for any reason without prior consent of the sender. > > If you have received this electronic transmission in error, please > notify the sender immediately by telephone (250) 386-4266 or by a > 'reply to sender only' message and destroy all electronic and hard > copies of the communication, including attachments, without reading > or saving in any manner. > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 --- Jan Van Uytven Computer Systems & Network Engineer Convergent Media Network wyvern@crm3.com Randomly selected from my quote-file: "Whenever I watch TV and see those poor starving kids all over the world, I can't help but cry. I mean I'd love to be skinny like that, but not with all those flies and death and stuff." - Mariah Carey >>> LEGAL STUFF <<< This electronic message transmission, including any attached files, contains information which may be confidential and/or privileged. The information is intended to be for the SOLE use of the individual or entity named above. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution or use of the contents of this information is prohibited. This message is not to be forwarded for any reason without prior consent of the sender. If you have received this electronic transmission in error, please notify the sender immediately by telephone (250) 386-4266 or by a 'reply to sender only' message and destroy all electronic and hard copies of the communication, including attachments, without reading or saving in any manner. From rwupole at msn.com Tue Oct 26 22:59:36 2004 From: rwupole at msn.com (Roger Upole) Date: Tue Oct 26 22:59:46 2004 Subject: [python-win32] Re: Can't import wmi in scripts run by nrpe_nt Message-ID: <001601c4bb9e$b54f8190$d3b7f904@rupole> Someone had a similar problem a while back: http://mail.python.org/pipermail/python-win32/2004-May/001948.html In that case, import was finding \system32\wmi.dll first and the import failed with a particularly unhelpful error msg. Does the process that fails have it's current working directory as \system32 ? Roger >>> I'm sorry, I could have phrased this better. >>> BTW, I'd like to congratulate you on wmi. If it weren't so useful to me >>> I wouldn't be trying to solve this problem. >>> Machine A is a linux box. It has Nagios installed on it. On this machine >>> is a plugin, check_nrpe, which can be called to return the result of a >>> given command on a remote box that runs the nrpe daemon, such as Machine >>> B. >>> Machine B is a Windows 2003 server. It has Python 2.3, The Win32 >>> extensions, and WMI installed. It has a service, nrpe_nt, which can >>> receive commands from Machine A to execute and return the results of any >>> script or executable you define. >>> On Machine B, I have written a simple script, check_python.py, It's just >>> this: >>> import sys,wmi >>> print "Imported wmi!" >>> sys.exit(0) >>> On Machine B, this works fine when I run it from the command line >>> ("python check_python.py") or from inside PythonWin. >>> I have set up nrpe_nt so that when it receives the command >>> 'check_python' from Machine A it executes this: >>> "C:\Python23\python.exe C:\NRPE_NT\bin\check_python.py" >>> However when I actually run the command the script bombs out and the >>> only reply I get from Machine B (on Machine A, where check_nrpe is) is >>> tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c check_python >>> Traceback (most recent call last): >>> After removing 'wmi' from the import list, it worked. But putting it >>> back in causes the script to bomb, and I don't know why. >>> These work: >>> * import sys,os >>> * import sys,os,win32com >>> * import sys,os,win32com,win32security >>> But this doesn't: >>> * import sys,wmi >>> I also tried the full path version of the command manually. It works. >>> So there's something different that happens when you import wmi from an >>> interactive script versus when it's called remotely by nrpe_nt. I've >>> asked the nrpe_nt dev, but he's stumped (not being a python guy). >>> Is there something specific that happens when wmi gets imported? I used >>> the imp module, and the problem is not that the module can't be found, >>> it's that something weird happens when it gets loaded. >>> Thanks, >>> Jan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20041026/c127482f/attachment-0001.htm From mhammond at skippinet.com.au Wed Oct 27 01:25:32 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Oct 27 01:25:53 2004 Subject: [python-win32] Re: py2exe app on Windows 95 In-Reply-To: Message-ID: <0ab701c4bbb3$1e9c33f0$0300a8c0@enfoldsystems.local> > No details to hand, but I distinctly remember Mark H > saying that pywin32 no longer supported Win95. Try > checking the python-win32 archives (or maybe Mark or > someone more knowledgeable is reading this)... That is correct. Win95 is no longer supported. Mark. From mhammond at skippinet.com.au Wed Oct 27 01:28:46 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Oct 27 01:28:48 2004 Subject: [python-win32] Forget last posting In-Reply-To: <417E7974.6050806@holdenweb.com> Message-ID: <0ab801c4bbb3$8a4a1ef0$0300a8c0@enfoldsystems.local> IIRC, the "read" status is part of the MAPI PR_MESSAGE_FLAGS property. You should find an example of tweaking this property in SpamBayes. Mark > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of Steve Holden > Sent: Wednesday, 27 October 2004 2:21 AM > To: python-win32@python.org > Subject: Re: [python-win32] Forget last posting > > > Steve Holden wrote: > > > Everything appears to work correctly when I set a valid > profile name, so > > please ignore my last question: that was the obvious step I > overlooked. > > > > regards > > Steve > However the messages appear as unread in my Outbox folder. > Clearly MAPI > allows me to vary this, so I'd appreciate it if someone could > point me > to the requisite docs (there's a LOT of MAPI stuff out there, > so Google > is swamping me a bit). > > thanks > Steve > -- > http://www.holdenweb.com > http://pydish.holdenweb.com > Holden Web LLC +1 800 494 3119 > > _______________________________________________ > 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 Oct 27 09:25:15 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Oct 27 09:30:17 2004 Subject: [python-win32] Can't import wmi in scripts run by nrpe_nt Message-ID: | BTW, I'd like to congratulate you on wmi. If it weren't so | useful to me I wouldn't be trying to solve this problem. Thanks for the bouquet. In fact, the people who really deserve congratulations are the MS team who put the WMI stuff together, and Mark H and the other contributors to pywin32. All I've done is put some lightweight plumbing in place to make the whole experience a little easier to cope with. | I'm sorry, I could have phrased this better. That's all right; your explanation below (snipped) makes it perfectly clear. I suspect the problem is that the nrpe_nt process runs as a service. There is (probably) a .dll called wmi in your windows system directory. When the service runs, it probably runs as the system user in the system directory. When it imports wmi, it actually tries to import the wmi.dll (which is nothing to do with Python, but rather to do with wmi itself). It either fails nicely or bombs completely, depending slightly on what version of Python you're running. Two possible solutions, both quite simple: a) Run the service outside the c:\winnt\system32 (or whatever) directory. Or at least do an os.chdir before importing wmi. b) Rename wmi.py on that machine to pywmi.py (or whatever other name takes your fancy) and try again. Let me know if that helps TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From janeaustine50 at hotmail.com Wed Oct 27 13:48:31 2004 From: janeaustine50 at hotmail.com (Austine Jane) Date: Wed Oct 27 13:49:11 2004 Subject: [python-win32] firefox automation like ie automation throughwin32com? Message-ID: >Look here for XPCOM docs: http://www.mozilla.org/projects/xpcom/ and >here for a Python Binding >http://aspn.activestate.com/ASPN/Downloads/Komodo/PyXPCOM/ > >I find it quite interessting, but never tried it... and PyXPCOM seems >to be quite old. > >Maybe you could use the mozctl(x).dll, it seems to be embeddable into >other programs... > >greets, Marek Thanks, but I expected that someone might say "go and look into XPCOM, that might work". However, I haven't yet seen anyone who wrote a concrete example of using it with Python. Maybe the author of PyXPCOM might help us? Jane _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.com/ From mhammond at skippinet.com.au Wed Oct 27 15:55:46 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed Oct 27 15:55:51 2004 Subject: [python-win32] firefox automation like ie automationthroughwin32com? In-Reply-To: Message-ID: <0ccb01c4bc2c$aa299010$0300a8c0@enfoldsystems.local> > Thanks, but I expected that someone might say "go and look > into XPCOM, that > might work". However, I haven't yet seen anyone who wrote a > concrete example of using it with Python. > > Maybe the author of PyXPCOM might help us? Sadly, that is me again :) Unfortunately I don't use XPCOM much these days. Last I checked, XPCOM is an application component model. It makes no attempt to support "out-of-process" components. The mozctl COM bridge may help, but I believe that it is targetted at allowing a "mozilla control window" to be used in your COM app in the same way you HTMLHelp or Outlook etc uses use an IE window - ie, it is still inside your application. If fairly confident that is still true for XPCOM, and 99.9% confident that is still true for pyXPCOM. It simply isn't what XPCOM is trying to do. I'm not sure if Mozilla/Firefox now has or is developing a COM or any other "automation" mechanism. Mark From Jason.Hihn at verint.com Wed Oct 27 16:27:57 2004 From: Jason.Hihn at verint.com (Hihn, Jason) Date: Wed Oct 27 16:28:01 2004 Subject: [python-win32] Linking in 3rd party libs Message-ID: I am trying to build PyQt into python under MSVC6. I successfully did this in unix, and I compiled the individual packages in win32, but the instructions don't make sense for win32. The unix (and instructions) that I have rely on a configure script, but there is no such thing for win32. I need to know how to convert the Makefile.pre.in and config.c.in changes to work. The PyQt instructions are here: http://www.river-bank.demon.co.uk/docs/pyqt/PyQt.html#AEN135 I also had trouble with compiling python for windows. I made all the projects successfully, but what is the final step? (Equiv to "make install")? Thanks! __________________________________________________________________________________________ This electronic message may contain proprietary and confidential information of Verint Systems Inc., its affiliates and/or subsidiaries. The information is intended to be for the use of the individual(s) or entity(ies) named above. If you are not the intended recipient (or authorized to receive this e-mail for the intended recipient), you may not use, copy, disclose or distribute to anyone this message or any information contained in this message. If you have received this electronic message in error, please notify us by replying to this e-mail. (1) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20041027/edc0efcd/attachment.htm From wyvernlist at crm3.com Wed Oct 27 20:26:48 2004 From: wyvernlist at crm3.com (Jan Van Uytven (Wyvern)) Date: Wed Oct 27 20:26:43 2004 Subject: [python-win32] Re: Can't import wmi in scripts run by nrpe_nt In-Reply-To: <001601c4bb9e$b54f8190$d3b7f904@rupole> References: <001601c4bb9e$b54f8190$d3b7f904@rupole> Message-ID: <1098901608.7155.1.camel@localhost> Thanks Roger! That is indeed the problem, as a quick "print os.getcwd()" proved. After I renamed wmi.py to pywmi.py, the problem vanished. Yay! I don't understand why it would be trying to load wmi.dll. Is there a dll import facility in Python? Is there a way to get around this problem? Jan On Tue, 2004-10-26 at 16:59 -0400, Roger Upole wrote: > Someone had a similar problem a while back: > > http://mail.python.org/pipermail/python-win32/2004-May/001948.html > > In that case, import was finding \system32\wmi.dll first > and the import failed with a particularly unhelpful error > msg. Does the process that fails have it's current working > directory as \system32 ? > > Roger > > > > >>> I'm sorry, I could have phrased this better. > > >>> BTW, I'd like to congratulate you on wmi. If it weren't so useful > to me > >>> I wouldn't be trying to solve this problem. > > >>> Machine A is a linux box. It has Nagios installed on it. On this > machine > >>> is a plugin, check_nrpe, which can be called to return the result > of a > >>> given command on a remote box that runs the nrpe daemon, such as > Machine > >>> B. > > >>> Machine B is a Windows 2003 server. It has Python 2.3, The Win32 > >>> extensions, and WMI installed. It has a service, nrpe_nt, which > can > >>> receive commands from Machine A to execute and return the results > of any > >>> script or executable you define. > > >>> On Machine B, I have written a simple script, check_python.py, > It's just > >>> this: > > >>> import sys,wmi > >>> print "Imported wmi!" > >>> sys.exit(0) > > >>> On Machine B, this works fine when I run it from the command line > >>> ("python check_python.py") or from inside PythonWin. > > >>> I have set up nrpe_nt so that when it receives the command > >>> 'check_python' from Machine A it executes this: > >>> "C:\Python23\python.exe C:\NRPE_NT\bin\check_python.py" > > >>> However when I actually run the command the script bombs out and > the > >>> only reply I get from Machine B (on Machine A, where check_nrpe > is) is > > >>> tombstone libexec # ./check_nrpe -H xxx.xxx.xxx.xxx -c > check_python > >>> Traceback (most recent call last): > > >>> After removing 'wmi' from the import list, it worked. But putting > it > >>> back in causes the script to bomb, and I don't know why. > >>> These work: > >>> * import sys,os > >>> * import sys,os,win32com > >>> * import sys,os,win32com,win32security > >>> But this doesn't: > >>> * import sys,wmi > > >>> I also tried the full path version of the command manually. It > works. > > >>> So there's something different that happens when you import wmi > from an > >>> interactive script versus when it's called remotely by nrpe_nt. > I've > >>> asked the nrpe_nt dev, but he's stumped (not being a python guy). > > >>> Is there something specific that happens when wmi gets imported? I > used > >>> the imp module, and the problem is not that the module can't be > found, > >>> it's that something weird happens when it gets loaded. > > >>> Thanks, > > >>> Jan > > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 --- Jan Van Uytven Computer Systems & Network Engineer Convergent Media Network wyvern@crm3.com Randomly selected from my quote-file: "Whip me. Beat me. Make me maintain AIX." -paul138 >>> LEGAL STUFF <<< This electronic message transmission, including any attached files, contains information which may be confidential and/or privileged. The information is intended to be for the SOLE use of the individual or entity named above. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution or use of the contents of this information is prohibited. This message is not to be forwarded for any reason without prior consent of the sender. If you have received this electronic transmission in error, please notify the sender immediately by telephone (250) 386-4266 or by a 'reply to sender only' message and destroy all electronic and hard copies of the communication, including attachments, without reading or saving in any manner. From wyvernlist at crm3.com Wed Oct 27 21:02:49 2004 From: wyvernlist at crm3.com (Jan Van Uytven (Wyvern)) Date: Wed Oct 27 21:02:49 2004 Subject: [python-win32] Can't import wmi in scripts run by nrpe_nt In-Reply-To: References: Message-ID: <1098903769.7160.11.camel@localhost> On Wed, 2004-10-27 at 08:25 +0100, Tim Golden wrote: > | BTW, I'd like to congratulate you on wmi. If it weren't so > | useful to me I wouldn't be trying to solve this problem. > > Thanks for the bouquet. In fact, the people who really deserve > congratulations are the MS team who put the WMI stuff together, > and Mark H and the other contributors to pywin32. All I've > done is put some lightweight plumbing in place to make the > whole experience a little easier to cope with. I noticed Mark Hammond posts to this newsgroup too. Thanks Mark, and all other contributors, for making life easier for the beleagured sysadmin! :) > > | I'm sorry, I could have phrased this better. > > That's all right; your explanation below (snipped) makes > it perfectly clear. I suspect the problem is that the nrpe_nt > process runs as a service. There is (probably) a .dll called > wmi in your windows system directory. When the service runs, > it probably runs as the system user in the system directory. > When it imports wmi, it actually tries to import the wmi.dll > (which is nothing to do with Python, but rather to do with > wmi itself). It either fails nicely or bombs completely, > depending slightly on what version of Python you're running. > > Two possible solutions, both quite simple: > > a) Run the service outside the c:\winnt\system32 (or whatever) > directory. Or at least do an os.chdir before importing wmi. > b) Rename wmi.py on that machine to pywmi.py (or whatever other > name takes your fancy) and try again. > > Let me know if that helps > Roger pointed this out too, and is indeed the problem. Thanks! I'll see if it's possible to get the nrpe_nt service to run in another directory, and failing that use the os.chdir trick you suggested. :) Thanks again for your help :) > TJG > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 --- Jan Van Uytven Computer Systems & Network Engineer Convergent Media Network wyvern@crm3.com Randomly selected from my quote-file: Men in their arrogance claim to understand the nature of creation, and devise elaborate theories to describe its behavior. But always they discover in the end that God was quite a bit more clever than they thought. -- Sister Miriam Godwinson, "We Must Dissent" >>> LEGAL STUFF <<< This electronic message transmission, including any attached files, contains information which may be confidential and/or privileged. The information is intended to be for the SOLE use of the individual or entity named above. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution or use of the contents of this information is prohibited. This message is not to be forwarded for any reason without prior consent of the sender. If you have received this electronic transmission in error, please notify the sender immediately by telephone (250) 386-4266 or by a 'reply to sender only' message and destroy all electronic and hard copies of the communication, including attachments, without reading or saving in any manner. From craig at coot.net Wed Oct 27 20:10:09 2004 From: craig at coot.net (Craig H. Anderson) Date: Wed Oct 27 21:17:26 2004 Subject: [python-win32] Re: py2exe app on Windows 95. One more question Message-ID: I was able to round up enough Windows 98 and 2000 boxes for my immediate need, but I have a bunch of Windows 98 boxes I would like to support. Is an old version of Pywin32 or win32all available that I could use to write Python apps for Windows 95? Thanks. From animesh at neolinuxsolutions.com Thu Oct 28 14:00:31 2004 From: animesh at neolinuxsolutions.com (Animesh Bansriyar) Date: Thu Oct 28 13:57:42 2004 Subject: [python-win32] Problem with Adding a Custom Header to Outgoing E-mails from a python Outlook Addin Message-ID: <1098964831.469.11.camel@laptop> Hi All, I am trying to attach a custom header to outgoing mails from a python based outlook addin. I have taken up the outlookaddin.py template from the win32com module and have been tring to figure it out but am not being able to do anything to it. Could anybody explain about the methods and attributes of a COMEventClass in this regard. I am new to programming on Windows and have little idea about COM. Please provide some pointers. Thanks in Advance, Animesh -- Animesh Bansriyar From Jason.Hihn at verint.com Thu Oct 28 20:53:11 2004 From: Jason.Hihn at verint.com (Hihn, Jason) Date: Thu Oct 28 20:53:46 2004 Subject: [python-win32] Link issues Message-ID: I've altered python to link in some 3rd party libs. Everything seems to be ok, but I get the following errors. I have no idea why they are... Can anyone help? python23.lib(python23.dll) : error LNK2005: _PyType_IsSubtype already defined in typeobject.obj python23.lib(python23.dll) : error LNK2005: _PyEval_SaveThread already defined in ceval.obj .... python23.lib(python23.dll) : warning LNK4006: _PyType_IsSubtype already defined in typeobject.obj; second definition ignored python23.lib(python23.dll) : warning LNK4006: _PyEval_SaveThread already defined in ceval.obj; second definition ignored ... Creating library ./pythoncore.lib and object ./pythoncore.exp LINK : fatal error LNK1561: entry point must be defined Error executing link.exe. pythoncore.exe - 67 error(s), 66 warning(s) __________________________________________________________________________________________ This electronic message may contain proprietary and confidential information of Verint Systems Inc., its affiliates and/or subsidiaries. The information is intended to be for the use of the individual(s) or entity(ies) named above. If you are not the intended recipient (or authorized to receive this e-mail for the intended recipient), you may not use, copy, disclose or distribute to anyone this message or any information contained in this message. If you have received this electronic message in error, please notify us by replying to this e-mail. (1) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20041028/114767ea/attachment.htm From animesh at neolinuxsolutions.com Fri Oct 29 12:38:18 2004 From: animesh at neolinuxsolutions.com (Animesh Bansriyar) Date: Fri Oct 29 12:38:59 2004 Subject: [python-win32] Problem with Adding a Custom Header to Outgoing E-mails from a python Outlook Addin In-Reply-To: <934895d004102810342b18ebbc@mail.gmail.com> References: <1098964831.469.11.camel@laptop> <934895d004102810342b18ebbc@mail.gmail.com> Message-ID: <1099046298.513.12.camel@laptop> Hi, I would make an easier question. We have put in some code and used Inspectors and mailItems. But We are getting the message which we are trying to send as a MAPIOBJECT. But I am not being able to understand how do I add a header to the object or even, try and do something about this. Can we make a Message Object from this MAPI Object. The message we are getting is infact a MailItem and we can at best make a MAPIOBJECT Out of it. Plese help Thanks in advance, Animesh On Thu, 2004-10-28 at 23:04, Alias Alias wrote: > Hi, > > I recommend that you look to Visual Basic. There is a lot more > support, examples, and documentation out there for Visual Basic. > Then, once > you have your prototype finished, come back to the Python example > and things will make much more sense. > Thanks for yor suggesstions, but we already have a working version of our outlook addin in Visual Basic. We now are trying to port it to Python. From niki at vintech.bg Fri Oct 29 14:37:45 2004 From: niki at vintech.bg (Niki Spahiev) Date: Fri Oct 29 14:37:52 2004 Subject: [python-win32] Re: how to load 2 python COM DLLs in single app? In-Reply-To: <8y9yllih.fsf@python.net> References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> <41791964.9060107@vintech.bg> <4179333E.4090700@vintech.bg> <8y9yllih.fsf@python.net> Message-ID: <41823999.6050709@vintech.bg> Thomas Heller wrote: > Back to the original problem (using several frozen dll com servers in a > single process), I envision these solutions, in increasing order of > difficulty: > > 1. Patch py2exe's code so that sys.path is not replaced but extended > when Python is already initialized. This gives no isolation between the > com dlls (and the main process, if it also uses Python) at all. > > 2. Run the com dll servers in different interpreters, with > Py_NewInterpreter(). According to the python docs, extension modules > are still shared - this may be good, or may be bad. > > 3. Create completely standalone, single file dlls, with no external > python.dll needed. New idea: 4. Use load_dynamic() and prefix all dlls _socket.pyd => prefix_socket.pyd then load_dynamic( "_socket", path + "prefix_socket.pyd" ) and also rename py*23.dll to py*MN.dll (where M,N are random characters) and patch all pyd files to import from new names. This looks like complete separation. comments? Niki Spahiev P.S. maybe even prefix = MN From theller at python.net Fri Oct 29 20:32:17 2004 From: theller at python.net (Thomas Heller) Date: Fri Oct 29 20:32:07 2004 Subject: [python-win32] Re: how to load 2 python COM DLLs in single app? References: <4177E7A3.9030000@vintech.bg> <08c701c4b7b2$c7efcde0$0300a8c0@enfoldsystems.local> <41791964.9060107@vintech.bg> <4179333E.4090700@vintech.bg> <8y9yllih.fsf@python.net> <41823999.6050709@vintech.bg> Message-ID: Niki Spahiev writes: > Thomas Heller wrote: >> Back to the original problem (using several frozen dll com servers in a >> single process), I envision these solutions, in increasing order of >> difficulty: >> 1. Patch py2exe's code so that sys.path is not replaced but extended >> when Python is already initialized. This gives no isolation between the >> com dlls (and the main process, if it also uses Python) at all. >> 2. Run the com dll servers in different interpreters, with >> Py_NewInterpreter(). According to the python docs, extension modules >> are still shared - this may be good, or may be bad. >> 3. Create completely standalone, single file dlls, with no external >> python.dll needed. > > New idea: > > 4. Use load_dynamic() and prefix all dlls > > _socket.pyd => prefix_socket.pyd > > then load_dynamic( "_socket", path + "prefix_socket.pyd" ) > > and also rename py*23.dll to py*MN.dll (where M,N are random > characters) and patch all pyd files to import from new names. > > This looks like complete separation. > > comments? > > Niki Spahiev > > P.S. maybe even prefix = MN Sure, this should work. But it may be more complicated than it seems at first, because the extension dlls may link to each other dynamically (for example, pythoncom.dll links to pywintypes.dll), and, again, pythoncom.dll and pywintypes.dll are loaded via special mechanisms already. Thomas From theller at python.net Fri Oct 29 21:18:56 2004 From: theller at python.net (Thomas Heller) Date: Fri Oct 29 21:18:47 2004 Subject: [python-win32] Re: pythoncom.CoCreateInstance(...) problems References: <417AFA75.708@thepete.net> <1e3e01c4ba12$9d8bd0a0$0300a8c0@enfoldsystems.local> Message-ID: >> IFilterGraph = pythoncom.CoCreateInstance( CLSID_FilterGraph, None, >> pythoncom.CLSCTX_INPROC_SERVER, IID_IGraphBuilder ) > > Unfortunately, only IDispatch interfaces, or those with special C++ support > can be used from Python. To use this interface you would probably need to > write an special win32com extension - just like the other win32com > extensions, such as MAPI, adsi, etc. Why not try ctypes.com? Thomas From mcicogni at libero.it Sun Oct 31 17:18:42 2004 From: mcicogni at libero.it (Mauro Cicognini) Date: Sun Oct 31 17:18:51 2004 Subject: [python-win32] Building extensions with non-MSVC compilers Message-ID: <41851062.6060301@libero.it> Hi everybody, I've tried to Google for all past references to the subject, but I could not find any conclusive answer to my real question, which is "Will a mingw-built extension work with a standard MSVC-built Python interpreter?" I'm asking because I am one of the (two) people trying to maintain the Win32 build of Python-LDAP. As you might know, it is actually just a thin wrapper (coming mostly from SWIG) around a stock LDAP library distro, which currently is OpenLDAP (used to be UMich at some time in the past). Those libraries used to support MSVC for win32 builds; however, this support is unfortunately all but defunct. After a prolenged hiatus, during which win32 support deteriorated, it was resurrected, but using mingw instead. This is likely due to lack of manpower on the core developers' part, and I do not blame them, as mingw is much easier to maintain in an almost entirely UNIX-oriented project. At this point, AFAICT I'm left with three options: 1. maintain MSVC support within OpenLDAP (although just for the core libraries) 2. build Python-LDAP with mingw, and see what happens 3. abandon the win32 port of Python-LDAP, and start work on new software providing a similar API using ADSI through the pythonCOM extension. Being hard pressed for time, what I'd like to do is obviously option 2, which also appears to me to be the best idea going forward. Option 1, in fact, isn't very elegant, and may require some nontrivial analysis of the underlying C code for obscure incompatibilities which by no means I intend to do. Option 3 is conceptually tempting, could pose less risk of obsolescence moving forward (and maybe even possible with less effort than I expect), but I completely lack the resources to work on it, and I'd also wonder how much MS's implementation covers of the original LDAP API draft. So this brings me back to the original question: what happens when one uses an interpreter and an extension built with different compilers? Thanks in advance for any suggestions, Mauro From p.f.moore at gmail.com Sun Oct 31 18:29:42 2004 From: p.f.moore at gmail.com (Paul Moore) Date: Sun Oct 31 18:29:45 2004 Subject: [python-win32] Building extensions with non-MSVC compilers In-Reply-To: <41851062.6060301@libero.it> References: <41851062.6060301@libero.it> Message-ID: <79990c6b04103109294a5a367f@mail.gmail.com> On Sun, 31 Oct 2004 17:18:42 +0100, Mauro Cicognini wrote: > Hi everybody, > I've tried to Google for all past references to the subject, but I could > not find any conclusive answer to my real question, which is "Will a > mingw-built extension work with a standard MSVC-built Python interpreter?" Yes. If you use distutils, --compiler=mingw is supported. See the "Installing Python Modules" manual, section 6.2.2 for the details, but basically, mingw-built extensions are set up to use the same CRT as the standard Python binary, so all should be fine. Paul. From waldemar.osuch at gmail.com Sun Oct 31 19:12:43 2004 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Sun Oct 31 19:12:51 2004 Subject: [python-win32] win32com: How to Dispatch a Word document Message-ID: <6fae955404103110123201b3eb@mail.gmail.com> I would like to have a Word Document instance with all methods and properties visible during interactive session. This is my currnet apporach: PythonWin 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32. Portions Copyright 1994-2004 Mark Hammond (mhammond@skippinet.com.au) - see 'Help/About PythonWin' for further copyright information. >>> from win32com.client import gencache, Dispatch >>> gencache.EnsureModule('{00020905-0000-0000-C000-000000000046}', 0, 8, 1, bForDemand=True) >>> word = Dispatch('Word.Application') >>> word >>> doc = word.Documents.Add() >>> doc As you can see I am getting a dynamic object not knowing its methods/properties. What I would like to get is: >>> doc = Dispatch('Word.Document') >>> doc >>> Is there a way to get what I want? Or do I have to have Word VBA window open just to see its properties after all. Waldemar From bgailer at alum.rpi.edu Sun Oct 31 19:44:59 2004 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Sun Oct 31 19:44:18 2004 Subject: [python-win32] win32com: How to Dispatch a Word document In-Reply-To: <6fae955404103110123201b3eb@mail.gmail.com> References: <6fae955404103110123201b3eb@mail.gmail.com> Message-ID: <6.1.2.0.0.20041031113845.045d9b40@mail.mric.net> At 11:12 AM 10/31/2004, Waldemar Osuch wrote: >I would like to have a Word Document instance with all methods and >properties visible during interactive session. This is my currnet >apporach: > >PythonWin 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit >(Intel)] on win32. >Portions Copyright 1994-2004 Mark Hammond (mhammond@skippinet.com.au) >- see 'Help/About PythonWin' for further copyright information. > >>> from win32com.client import gencache, Dispatch > >>> gencache.EnsureModule('{00020905-0000-0000-C000-000000000046}', 0, >8, 1, bForDemand=True) >from >'C:\DOCUME~1\osuchw\LOCALS~1\Temp\gen_py\2.3\00020905-0000-0000-C000-000000000046x0x8x1\__init__.py'> > >>> word = Dispatch('Word.Application') > >>> word >instance at 0x18074720> > >>> doc = word.Documents.Add() > >>> doc > > >As you can see I am getting a dynamic object not knowing its >methods/properties. >What I would like to get is: > >>> doc = Dispatch('Word.Document') > >>> doc >at 0x37038040> > >>> > >Is there a way to get what I want? Get Steve Roman's Learning Word Programming (O'Reilly). Invaluable reference. Will save you hours. I think Pythonwin will autocomplete after you type doc. if you have run MakePy on Word. >Or do I have to have Word VBA >window open just to >see its properties after all. > >Waldemar >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From davidrushby at yahoo.com Sun Oct 31 20:56:39 2004 From: davidrushby at yahoo.com (David Rushby) Date: Sun Oct 31 20:56:42 2004 Subject: [python-win32] Building extensions with non-MSVC compilers In-Reply-To: <79990c6b04103109294a5a367f@mail.gmail.com> Message-ID: <20041031195639.58392.qmail@web11002.mail.yahoo.com> --- Paul Moore wrote: > On Sun, 31 Oct 2004 17:18:42 +0100, Mauro Cicognini > wrote: > > Hi everybody, > > I've tried to Google for all past references to the subject, > > but I could not find any conclusive answer to my real question, > > which is "Will a mingw-built extension work with a standard > > MSVC-built Python interpreter?" > > Yes. If you use distutils, --compiler=mingw is supported. See the > "Installing Python Modules" manual, section 6.2.2 for the details... The aim of the process described there is to create a GCC-compatible equivalent of the MSVC library "pythonVV.lib" (where VV would be 23 for Python 2.3), typically named "libpythonVV.a" and placed in the same directory as "pythonVV.lib". I got tired of repeating the process with different versions of Python and MinGW, so I automated the process in this script: http://kinterbasdb.sourceforge.net/other/cext/mingw_support.py The "pexports" tool that the script uses is in MinGW's mingw-utils package, and "dlltool" is in the binutils package. The intent is that mingw_support.py can be included alongside setup.py in the source distribution of a Python C extension, and setup.py can call 'import mingw_support; mingw_support.generateMinGWPythonLib()' during the build process to ease the experience of an end user compiling the extension with MinGW rather than MSVC. --- I don't know whether OpenLDAP or its Python wrapper include any C++, but if so, beware of this irritating bug when you attempt to build with mingw: http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=877165 That's fixed in CVS, which is reflected in Python 2.4b1, and should also be fixed in Python 2.3.5. --- The GCC compiler itself executes slowly compared to most commercial compilers (including MSVC), but the quality of the code generated by the latest versions of GCC is pretty good. I've written several processor-bound Python extension modules (I'm not referring to kinterbasdb, which is not processor-bound), and have been pleasantly surprised by the performance of GCC 3.4 versus MSVC 6.0 and 7.1. In one integer-intensive C code base, the speed of code compiled with MinGW GCC 3.4.2 (with aggressive optimization settings "-mtune=athlon-xp -DNDEBUG -O3 -fmove-all-movables -freduce-all-givs -ftracer -fomit-frame-pointer -ffast-math") surpasses MSVC 6.0 by 17%, and MSVC 7.1 by 10%. In a much larger and more diverse C++ code base (still integer-intensive, and compiled with the same optimization settings), GCC 3.4.2 ties with MSVC 7.1 unless MSVC 7.1's link-time code generation is enabled, in which case MSVC is 10% faster. The link-time code generation in MSVC 7.1 seems pretty buggy, though, so it's not always a viable option. The size of GCC-generated binaries is consistently larger than that of MSVC binaries, especially if C++ is involved. For whatever reason, MinGW doesn't use Microsoft's C++ runtime library by default, and licensing constraints complicate the non-static use of the GNU version, so MinGW statically compiles any required STL code into the .pyd (http://www.mingw.org/mingwfaq.shtml#faq-C++size ). The MinGW .pyd from the C++ code base I spoke of is more than twice as large as its MSVC equivalent. It's worth noting that the "free" command-line version of MSVC 7.1 (http://msdn.microsoft.com/visualc/vctoolkit2003/ ) can be made to compile and link both C and C++ extensions with Python 2.4, if you're willing to go to a lot of trouble: - Downloading and installing the .NET 1.1 runtime and .NET SDK. - Downloading and installing the huge Windows Platform SDK, which has a particularly annoying through-the-web, IE-only installer (this can be circumvented and the files saved for offline installation). - Overriding distutils' insistence that the full version of VStudio 2003 be installed. - Using the msvcrt.lib from the Platform SDK (msvcrt.lib is not included with the command-line version of MSVC 7.1). - Generating msvcprt.lib on the basis of msvcp71.dll (msvcprt.lib is also not included with the command-line version of MSVC 7.1). __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail