From mhammond at skippinet.com.au Fri Aug 1 00:53:33 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 1 Aug 2008 08:53:33 +1000 Subject: [python-win32] pywin32 build 212 released Message-ID: <035201c8f360$42e6c890$c8b459b0$@com.au> Hi all, I'm happy to announce the release of pywin32 build 212 This is a fairly minor release, with fixes to the few issues found since build 211, plus a few other minor additions (as usual, many contributed by Roger Upole.) The full change notes are at https://sourceforge.net/project/shownotes.php?release_id=616849 Get it now via https://sourceforge.net/project/showfiles.php?group_id=78018 Thanks to everyone who contributed, reported bugs, etc. Cheers, Mark From mc at mclaveau.com Fri Aug 1 07:31:47 2008 From: mc at mclaveau.com (Michel Claveau) Date: Fri, 1 Aug 2008 07:31:47 +0200 Subject: [python-win32] pywin32 build 212 released In-Reply-To: <035201c8f360$42e6c890$c8b459b0$@com.au> References: <035201c8f360$42e6c890$c8b459b0$@com.au> Message-ID: <35DC40E451894485976AE9DDAB803240@MCI1330> Hello! > I'm happy to announce the release of pywin32 build 212 I'm happy to thank Mark, for that. Michel Claveau From marcus at internetnowasp.net Fri Aug 1 08:31:17 2008 From: marcus at internetnowasp.net (Marcus.CM) Date: Fri, 01 Aug 2008 14:31:17 +0800 Subject: [python-win32] py2exe bug with email.MIMEText Message-ID: <4892ADB5.9060804@internetnowasp.net> There is a bug with py2exe when (at least under windows) when importing email # example testmime.py import email msg = email.MIMEText.MIMEText("dsafdafdasfA") print "ok" 1. Save the text above and setup as testmime.py 2. Run it and u can see "ok" 3. Create setup.py and run : python setup.py py2exe 4. Run the testmime.exe and u will get error "Import error : No module name text" # Example setup.py from distutils.core import setup import py2exe setup(console=['testmime.py']) Anyone knows the fix for this? From marcus at internetnowasp.net Fri Aug 1 08:36:56 2008 From: marcus at internetnowasp.net (Marcus.CM) Date: Fri, 01 Aug 2008 14:36:56 +0800 Subject: [python-win32] py2exe bug with email.MIMEText In-Reply-To: <4892ADB5.9060804@internetnowasp.net> References: <4892ADB5.9060804@internetnowasp.net> Message-ID: <4892AF08.6020303@internetnowasp.net> Hi, After some debugging, i found the solution is to :- import email import email.mime.text import email.iterators import email.generator import email.utils Marcus. Marcus.CM wrote: > There is a bug with py2exe when (at least under windows) when > importing email > > # example testmime.py > import email > msg = email.MIMEText.MIMEText("dsafdafdasfA") > print "ok" > > 1. Save the text above and setup as testmime.py > 2. Run it and u can see "ok" > 3. Create setup.py and run : python setup.py py2exe > 4. Run the testmime.exe and u will get error "Import error : No module > name text" > > # Example setup.py > from distutils.core import setup > import py2exe > setup(console=['testmime.py']) > > Anyone knows the fix for this? > > > > -- > http://mail.python.org/mailman/listinfo/python-list > From graemeglass at gmail.com Fri Aug 1 09:20:34 2008 From: graemeglass at gmail.com (Graeme Glass) Date: Fri, 1 Aug 2008 09:20:34 +0200 Subject: [python-win32] when was pythonwin develop? In-Reply-To: References: Message-ID: On Thu, Jul 31, 2008 at 11:39 PM, Emanuel Sotelo wrote: > hello, everybody > perhaps somebody already ask this question but a i dont now the answer > > at what year was pythonwin develop, or at what year was his first release? > > is Mark Hammond the creator of pythonwin or was someone else? > > who help at the develoment of pythonwin? > > > i hope some can help me aswer this questions. > > ------------------------------ > ?Tus fotos son un desorden? La soluci?n a tus males se llama Galer?a > fotogr?fica de Windows Live > http://sourceforge.net/projects/pywin32/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mytekmail at gmail.com Fri Aug 1 10:29:36 2008 From: mytekmail at gmail.com (brendon wolff-piggott) Date: Fri, 1 Aug 2008 10:29:36 +0200 Subject: [python-win32] How to find a Type Library for makepy? Message-ID: Hi All I'm trying to automate using an Office component for character recognition using python. I can see the type library from the VB Express IDE I downloaded to get it working. When I run makepy on it using: import win32com.client.makepy win32com.client.makepy.ShowInfo("Microsoft Office Document Imaging Viewer Control 12.0") I get: Could not locate a type library matching 'Microsoft Office Document Imaging Viewer Control 12.0' I know the DLL name, and have checked that it is registered. But the library name passed to makepy does not appear in the registry. Do I need to edit the registry to fix this? Where should I look for documentation on this? I looked at the makepy script, but was out of my depth very quickly! Thanks! Brendon Wolff-Piggott -------------- next part -------------- An HTML attachment was scrubbed... URL: From werner.bruhin at free.fr Fri Aug 1 13:57:39 2008 From: werner.bruhin at free.fr (Werner F. Bruhin) Date: Fri, 01 Aug 2008 13:57:39 +0200 Subject: [python-win32] py2exe bug with email.MIMEText In-Reply-To: <4892ADB5.9060804@internetnowasp.net> References: <4892ADB5.9060804@internetnowasp.net> Message-ID: Hi Marcus, Marcus.CM wrote: > There is a bug with py2exe when (at least under windows) when importing > email > > # example testmime.py > import email > msg = email.MIMEText.MIMEText("dsafdafdasfA") > print "ok" > > 1. Save the text above and setup as testmime.py > 2. Run it and u can see "ok" > 3. Create setup.py and run : python setup.py py2exe > 4. Run the testmime.exe and u will get error "Import error : No module > name text" > > # Example setup.py > from distutils.core import setup > import py2exe > setup(console=['testmime.py']) > > Anyone knows the fix for this? I see that you did find a solution for your problem. An alternative solution is to force py2exe to include all of the email package. packages = ['matplotlib.numerix', 'pytz.zoneinfo.UTC', 'email', 'encodings', ... etc] Werner From timr at probo.com Fri Aug 1 18:39:17 2008 From: timr at probo.com (Tim Roberts) Date: Fri, 01 Aug 2008 09:39:17 -0700 Subject: [python-win32] How to find a Type Library for makepy? In-Reply-To: References: Message-ID: <48933C35.3020306@probo.com> brendon wolff-piggott wrote: > > I'm trying to automate using an Office component for character > recognition using python. I can see the type library from the VB > Express IDE I downloaded to get it working. When I run makepy on it > using: > > import win32com.client.makepy > win32com.client.makepy.ShowInfo("Microsoft Office Document Imaging > Viewer Control 12.0") > > I get: > Could not locate a type library matching 'Microsoft Office Document > Imaging Viewer Control 12.0' > > I know the DLL name, and have checked that it is registered. But the > library name passed to makepy does not appear in the registry. Do I > need to edit the registry to fix this? Where should I look for > documentation on this? That's the friendly name of the control itself, not the name of the type library. In version 11, the type library name was "Microsoft Office Document Imaging 11.0 Type Library". The class name of the control is LMDocViewer.LMDocView, or at least it was in version 11, so you should be able to do vwr = win32com.client.Dispatch( 'LMDocViewer.LMDocView' ) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mhammond at skippinet.com.au Sat Aug 2 03:33:18 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 2 Aug 2008 11:33:18 +1000 Subject: [python-win32] when was pythonwin develop? Message-ID: <03f901c8f43f$bfdbf700$3f93e500$@com.au> > hello, everybody > perhaps somebody already ask this question but a i dont now the answer > > at what year was pythonwin develop, or at what year was his first release? 1994 or so (at least, that is what the copyright message tells me - it may well have been 1993 that I kicked it off) > is Mark Hammond the creator of pythonwin or was someone else? Yep, although there have been many significant contributors in the past. Specifically, win32com was started by Greg Stein and Bill Tutt. > who help at the develoment of pythonwin? Many people over the years. Mark From mytekmail at gmail.com Mon Aug 4 10:00:32 2008 From: mytekmail at gmail.com (brendon wolff-piggott) Date: Mon, 4 Aug 2008 10:00:32 +0200 Subject: [python-win32] How to find a Type Library for makepy? Message-ID: brendon wolff-piggott wrote: > > >> I'm trying to automate using an Office component for character > > recognition using python. I can see the type library from the VB >> Express IDE I downloaded to get it working. When I run makepy on it >> using: >> >> import win32com.client.makepy >> win32com.client.makepy.ShowInfo("Microsoft Office Document Imaging >> Viewer Control 12.0") >> >> I get: >> Could not locate a type library matching 'Microsoft Office Document >> Imaging Viewer Control 12.0' Tim Roberts wrote: > That's the friendly name of the control itself, not the name of the type > library. In version 11, the type library name was "Microsoft Office >Document Imaging 11.0 Type Library". >The class name of the control is LMDocViewer.LMDocView, or at least it >was in version 11, so you should be able to do > vwr = win32com.client.Dispatch( 'LMDocViewer.LMDocView' ) Thanks Tim, I replaced your string with 'MODI.Document' from the [VersionIndependentProgID] key, and it seems to be up and running! This reference helped too: http://coding.derkeiler.com/Archive/Python/comp.lang.python/2005-11/msg04306.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Mon Aug 4 15:29:24 2008 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 04 Aug 2008 14:29:24 +0100 Subject: [python-win32] Is this user a member of a given Active Directory group? In-Reply-To: References: Message-ID: <48970434.3080308@timgolden.me.uk> Vernon Cole wrote: > My company makes use of Active Directory to determine what rights a > given user has in an application system. If the user is a member of a > certain group, then (s)he has the right to perform some set of > functions. For example, if VCOLE is a member of WCPO-CREATE then I can > create new purchase orders. Maybe someone's already picked this up, in which case sorry for the duplicate. (I'm away in Manchester at the moment and only checking email occasionally). The answer might be one of two things, depending on how your app works. Conventionally, what one does is to determine whether a given SID (representing an access group such as WCPO-CREATE) is present and enabled in the process token of the currently logged-on token (which might be an impersonation token). The alternative is to check the user's AD entry for group membership, which is a whole different set of APIs. The former suffers from the fact that the logged-on token's groups might have been superseded by some security change. ie if the user logged on at 8am then his token represents his group memberships at that point. If he was denied some group at 8.30am and it's now 9am, his token will still contain this group but his AD group membership will show otherwise. Assuming the first, then it's quite simple. You use the CheckTokenMembership function in the win32security module against the logged-on token. I've created a (local) WCPO-CREATE group and put myself in it. This, then is the test I would use: [using 4 spaces which I think you prefer :) ] import win32security GROUP_NAME = "WCPO-CREATE" sid, system, type = win32security.LookupAccountName ( None, GROUP_NAME ) if win32security.CheckTokenMembership ( None, sid ): print "I am in", GROUP_NAME else: print "I am not in", GROUP_NAME If you had a local group which shadowed an AD group, you'd need to specify a domain or a DC name as the first param of the LookupAccountName. Using None as the first of the params to CheckTokenMembership should use the process token even if it's an impersonation token. This is generally what you want. TJG From vernondcole at gmail.com Mon Aug 4 23:46:20 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 4 Aug 2008 15:46:20 -0600 Subject: [python-win32] Is this user a member of a given Active Directory group? In-Reply-To: <48970434.3080308@timgolden.me.uk> References: <48970434.3080308@timgolden.me.uk> Message-ID: Tim, You Da Man! Vernon based on your suggestion, I have: import win32security def testMemberOf(GROUP_NAME): try: sid, system, type = win32security.LookupAccountName(None, GROUP_NAME) except: raise ValueError, '"%s" is not a valid group name'%GROUP_NAME return win32security.CheckTokenMembership(None, sid) On Mon, Aug 4, 2008 at 7:29 AM, Tim Golden wrote: > Vernon Cole wrote: > >> My company makes use of Active Directory to determine what rights a given >> user has in an application system. If the user is a member of a certain >> group, then (s)he has the right to perform some set of functions. For >> example, if VCOLE is a member of WCPO-CREATE then I can create new purchase >> orders. >> > > Maybe someone's already picked this up, in which case > sorry for the duplicate. (I'm away in Manchester at > the moment and only checking email occasionally). > > The answer might be one of two things, depending on > how your app works. Conventionally, what one does is > to determine whether a given SID (representing an > access group such as WCPO-CREATE) is present and > enabled in the process token of the currently > logged-on token (which might be an impersonation > token). The alternative is to check the user's AD entry > for group membership, which is a whole different > set of APIs. The former suffers from the fact that > the logged-on token's groups might have been superseded > by some security change. ie if the user logged on at > 8am then his token represents his group memberships > at that point. If he was denied some group at 8.30am > and it's now 9am, his token will still contain this > group but his AD group membership will show otherwise. > > Assuming the first, then it's quite simple. You > use the CheckTokenMembership function in the > win32security module against the logged-on token. > > I've created a (local) WCPO-CREATE group and put > myself in it. This, then is the test I would use: > [using 4 spaces which I think you prefer :) ] > > > import win32security > > GROUP_NAME = "WCPO-CREATE" > > sid, system, type = win32security.LookupAccountName ( > None, GROUP_NAME > ) > if win32security.CheckTokenMembership ( > None, sid > ): > print "I am in", GROUP_NAME > else: > print "I am not in", GROUP_NAME > > > > If you had a local group which shadowed an AD group, > you'd need to specify a domain or a DC name as the > first param of the LookupAccountName. Using None > as the first of the params to CheckTokenMembership > should use the process token even if it's an > impersonation token. This is generally what you > want. > > TJG > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Aug 5 11:55:59 2008 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 05 Aug 2008 10:55:59 +0100 Subject: [python-win32] Is this user a member of a given Active Directory group? In-Reply-To: References: <48970434.3080308@timgolden.me.uk> Message-ID: <489823AF.3090906@timgolden.me.uk> Vernon Cole wrote: > Tim, > You Da Man! > Vernon > > based on your suggestion, I have: > > import win32security > > def testMemberOf(GROUP_NAME): > try: > sid, system, type = win32security.LookupAccountName(None, > GROUP_NAME) > except: > raise ValueError, '"%s" is not a valid group name'%GROUP_NAME > return win32security.CheckTokenMembership(None, sid) > Glad it helped. One thing -- which I imagine you will have thought of for yourself, but just in case... -- is that catching *all* exceptions might mask something more than a misspelt group name. But, clearly, the effect is the same: you can't do the check against the group. TJG From egregio at gmail.com Tue Aug 5 14:02:51 2008 From: egregio at gmail.com (_ _) Date: Tue, 5 Aug 2008 14:02:51 +0200 Subject: [python-win32] Create dll from python source code Message-ID: <1bdf59490808050502i2b4c3b9bj72db8a1394987db3@mail.gmail.com> How create a dll from python source code?... py2exe? Thanks a lot... -------------- next part -------------- An HTML attachment was scrubbed... URL: From kain94 at gmail.com Tue Aug 5 15:37:45 2008 From: kain94 at gmail.com (Kain) Date: Tue, 5 Aug 2008 15:37:45 +0200 Subject: [python-win32] WSH and Python Message-ID: <22984bc70808050637i4e69dfbbxed59e0801f4523ac@mail.gmail.com> Hi, I'm working on a wsh script which import some Python ressources. I wish to create a Python COM Object in order to wrap my wsh scripts to an imported Python module. But, After many tryings and days, I'have not succeed in it. The code below is very simple but when I try to run the WSH's job I get a pythoncom error from policy.py. But the com server is well registered according to python engine and Windows registery so what's happend ? Could you help me ? Thanks, Kain. *********** The python exception *************** Microsoft (R) Windows Script Host Version 5.7 Copyright (C) Microsoft Corporation 1996-2001. Tous droits reserves. pythoncom error: ERROR: server.policy could not create an instance. Traceback (most recent call last): File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 144, in CreateInstance return retObj._CreateInstance_(clsid, reqIID) File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 202, in _CreateInstance_ myob = call_func(classSpec) File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 734, in call_func return resolve_func(spec)(*args) File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 723, in resolve_func module = _import_module(mname) File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 742, in _import_module __import__(mname) <type 'exceptions.ImportError'>: No module named PyClass pythoncom error: Unexpected gateway error Traceback (most recent call last): File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 144, in CreateInstance return retObj._CreateInstance_(clsid, reqIID) File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 202, in _CreateInstance_ myob = call_func(classSpec) File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 734, in call_func return resolve_func(spec)(*args) File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 723, in resolve_func module = _import_module(mname) File "C:\Program Files\Python25\Lib\site-packages\win32com\server\policy.py", line 742, in _import_module __import__(mname) <type 'exceptions.ImportError'>: No module named PyClass pythoncom error: CPyFactory::CreateInstance failed to create instance. (80004005) *********** The WSH souce file *************** <job id="pyimport"> <script language="python" src="./Classes/python/pyimport.pys"> </script> <script language="vbscript"> <![CDATA[ Private Function EvalCmd() Register() Dim oPy : Set oPy = CreateObject("Python.PyClass") EvalCmd = oPy.pouet() End Function ]]> </script> <script language="vbscript"> <![CDATA[ wscript.echo(EvalCmd()) ]]> </script> </job> *********** The Python souce file *************** # DECLARE PYTHON DEPENDENCIES # from pythoncom import CreateGuid from win32com.server.register import RegisterServer, UnregisterServer, UseCommandLine # DEBUG MODE # DEBUGGING = 1 # DECLARE PYTHON COM CLASS # class PyClass: _reg_clsid_ = "{C76F559C-D725-4318-B198-0A9CCB98FB5D}" _reg_progid_ = "Python.PyClass" _reg_desc_ = "Python PyClass" _reg_class_spec_ = "win32com.servers.PyImport.PyClass" _public_methods_ = ["pouet"] def pouet(self): return "pouet" # PYTHON COM SERVER # def Register(): if __name__=='__main__': return UseCommandLine(PyClass, debug=DEBUGGING) else: # __name__ value is set to "__ax_main__" when called from WSH return RegisterServer(PyClass._reg_clsid_, PyClass._reg_class_spec_, PyClass._reg_desc_, PyClass._reg_progid_) def Unregister(): return UnregisterServer(PyClass._reg_clsid_) if __name__=='__main__': if "--unregister" in sys.argv: Unregister() else: Register() -------------- next part -------------- An HTML attachment was scrubbed... URL: From kain94 at gmail.com Tue Aug 5 15:43:49 2008 From: kain94 at gmail.com (Kain) Date: Tue, 5 Aug 2008 15:43:49 +0200 Subject: [python-win32] WSH and Python In-Reply-To: <22984bc70808050637i4e69dfbbxed59e0801f4523ac@mail.gmail.com> References: <22984bc70808050637i4e69dfbbxed59e0801f4523ac@mail.gmail.com> Message-ID: <22984bc70808050643s206da626k445ce34b238f55f0@mail.gmail.com> Sorry for xml tags. I've think that "<" and ">" wouldn't been allowed. K. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Tue Aug 5 16:15:30 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 6 Aug 2008 00:15:30 +1000 Subject: [python-win32] Create dll from python source code In-Reply-To: <1bdf59490808050502i2b4c3b9bj72db8a1394987db3@mail.gmail.com> References: <1bdf59490808050502i2b4c3b9bj72db8a1394987db3@mail.gmail.com> Message-ID: <064401c8f705$bb75dd20$32619760$@com.au> I'm not aware of a tool that will turn a python script into a DLL with arbitrary entry-points. py2exe will let you create DLLs with entry points suitable for COM objects or ISAPI extensions. HTH, Mark ---- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of _ _ Sent: Tuesday, 5 August 2008 10:03 PM To: python-win32 at python.org Subject: [python-win32] Create dll from python source code How create a dll from python source code?... py2exe? Thanks a lot... From kain94 at gmail.com Tue Aug 5 16:53:39 2008 From: kain94 at gmail.com (Kain) Date: Tue, 5 Aug 2008 16:53:39 +0200 Subject: [python-win32] WSH and Python Message-ID: <22984bc70808050753v66f5c8bft9572e85fb77f521f@mail.gmail.com> Oki, I've found. It seems that Python doesn't recognize *.pys files as regular modules. So, I've just change my python script file extension to *.py and it works fine. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bb31l at theotherbell.com Tue Aug 5 18:51:23 2008 From: bb31l at theotherbell.com (Brenda Bell) Date: Tue, 5 Aug 2008 12:51:23 -0400 Subject: [python-win32] MAPI Advise Sink Message-ID: <9260131D-D51C-4886-93A4-8A2CD48F4433@theotherbell.com> I'm trying to write a simple program that connects to MAPI and listens for change events on the contents table for the default receive folder. According to the documentation, PyIMAPITable.Advise takes a PyIMAPIAdviseSink. It's unclear as to how I implement an object that supports this interface. The IMAPIAdviseSink interface is defined in mapi32.dll, but mapi32.dll does not contain a type library. I have been able to implement a Sink class: IID_IMAPIAdviseSink = pythoncom.MakeIID('{00020302-0000-0000- C000-000000000046}') IID_Sink = pythoncom.MakeIID('{65C60411-8743-4c0a-863F-757831F8E56B}') class Sink(): _com_interfaces_ = [IID_IMAPIAdviseSink] _reg_progid_ = 'Python.CarboniteMapiAdviseSink' _reg_clsid_ = str(IID_Sink) _public_methods_ = ['OnNotify'] def OnNotify(self, foo, bar): print "Notification triggered." I can create an instance as long as I ask for IUnknown: sink = pythoncom.CoCreateInstance(IID_Sink, None, pythoncom.CLSCTX_ALL, pythoncom.IID_IUnknown) But if I ask for IID_IMAPIAdviseSink or attempt to pass the IUnknown to Advise, policy.py fails with "No such interface supported". Can someone point me to a sample or to documentation that will help me figure out what I'm doing wrong? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Wed Aug 6 00:49:26 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 6 Aug 2008 08:49:26 +1000 Subject: [python-win32] MAPI Advise Sink In-Reply-To: <9260131D-D51C-4886-93A4-8A2CD48F4433@theotherbell.com> References: <9260131D-D51C-4886-93A4-8A2CD48F4433@theotherbell.com> Message-ID: <069101c8f74d$8aa300e0$9fe902a0$@com.au> I'm afraid that the MAPI module doesn't support that interface and its unlikely you will be able to get it going with an IDispatch based interface. This interface is very small though, so if you are willing to take a little messing around I could add that interface and send you a new copy of the MAPI module - contact me off-line if that interests you. Cheers, Mark From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of Brenda Bell Sent: Wednesday, 6 August 2008 2:51 AM To: python-win32 at python.org Subject: [python-win32] MAPI Advise Sink I'm trying to write a simple program that connects to MAPI and listens for change events on the contents table for the default receive folder. According to the documentation, PyIMAPITable.Advise takes a PyIMAPIAdviseSink. It's unclear as to how I implement an object that supports this interface. The IMAPIAdviseSink interface is defined in mapi32.dll, but mapi32.dll does not contain a type library. I have been able to implement a Sink class: IID_IMAPIAdviseSink = pythoncom.MakeIID('{00020302-0000-0000-C000-000000000046}') IID_Sink = pythoncom.MakeIID('{65C60411-8743-4c0a-863F-757831F8E56B}') class Sink(): _com_interfaces_ = [IID_IMAPIAdviseSink] _reg_progid_ = 'Python.CarboniteMapiAdviseSink' _reg_clsid_ = str(IID_Sink) _public_methods_ = ['OnNotify'] def OnNotify(self, foo, bar): print "Notification triggered." I can create an instance as long as I ask for IUnknown: sink = pythoncom.CoCreateInstance(IID_Sink, None, pythoncom.CLSCTX_ALL, pythoncom.IID_IUnknown) But if I ask for IID_IMAPIAdviseSink or attempt to pass the IUnknown to Advise, policy.py fails with "No such interface supported". Can someone point me to a sample or to documentation that will help me figure out what I'm doing wrong? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gundlach at gmail.com Wed Aug 6 14:52:47 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Wed, 6 Aug 2008 08:52:47 -0400 Subject: [python-win32] pywin32 install via setuptools -- conclusion? Message-ID: Hi, I've got a module that relies on pywin32 being installed (to consume but not create COM objects, and to respond to COM events). My module installs with easy_install, and I'd love to have its dependency graph automatically install pywin32, or at least the bits important for COM object and event consumption. Is this possible? I found a thread from last year to this effect, but the outcome wasn't clear (at least to me). Thanks! Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Wed Aug 6 20:43:12 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 6 Aug 2008 12:43:12 -0600 Subject: [python-win32] Bugfix version of adodbapi available Message-ID: This is mostly a big "thank you" for Adam Vandenberg. (Anyone who knows him, please buy him a beer!) Adam submitted a bug report on sourceforge indicating that one should call CoInitialize() BEFORE Dispatch(), not AFTER. I made the change on my development machine, and could see no changes. Everything worked before and still worked after. Meanwhile, I had a long running python script on another machine which kept erroring out and crashing several hours into its operation. More investigation and several re-runs later, I found that it was an InterfaceError exception at adodbapi.connect() time, right where Adam said the error was. I put the patched adodbapi on the production machine and *magic* -- the error went away! Score one for open source software. I would NEVER have found that bug. -- The patched software is on CVS. Also included is a bug fix from Bob Kline so that nextset() will work even when one of the result sets is empty, and some cleanup of the unit tests also suggested by Bob Kline. Thank you, Bob. I also removed all attempts to test against an AS400 database. The SQL was too weird. I would have had to modify every CREATE TABLE, SELECT, UPDATE, and INSERT statement in the test suite. -- Of course, the fixed version of adodbapi will be included with the next release of pywin32. I note that the download rate on adodbapi.sourceforge.net has gone to zero for the last two months (with the release of pywin32 v 211). Thank you Mark. -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Thu Aug 7 07:34:04 2008 From: mc at mclaveau.com (Michel Claveau) Date: Thu, 7 Aug 2008 07:34:04 +0200 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: References: Message-ID: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> Hi! ActiveState has a package, for install Python + Pywin32 (+ others), with quiet install. @-salutations Michel Claveau From gundlach at gmail.com Thu Aug 7 19:43:48 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Thu, 7 Aug 2008 13:43:48 -0400 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> References: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> Message-ID: Hi, Sorry to be dense, but I assume you mean the ActiveState cookbook at http://code.activestate.com/recipes/langs/python/ ? I have looked through there for something related to installing pywin32, and came up empty. Do you remember anything else about the recipe? The project name, maybe? Thanks for your help, Michael On Thu, Aug 7, 2008 at 1:34 AM, Michel Claveau wrote: > Hi! > > ActiveState has a package, for install Python + Pywin32 (+ others), with > quiet install. > > @-salutations > > Michel Claveau > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gundlach at gmail.com Fri Aug 8 16:14:57 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Fri, 8 Aug 2008 10:14:57 -0400 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: <489C4F91.7080708@co.marshall.ia.us> References: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> <489C4F91.7080708@co.marshall.ia.us> Message-ID: On Fri, Aug 8, 2008 at 9:52 AM, Mike Driscoll wrote: > > Michael Gundlach wrote: >> >> Hi, >> >> Sorry to be dense, but I assume you mean the ActiveState cookbook at http://code.activestate.com/recipes/langs/python/ ? >> > > He's probably referring to "ActivePython": > > http://www.activestate.com/Products/activepython/index.mhtml > http://www.activestate.com/Products/activepython/feature_list.mhtml > > Mike Thanks, Mike. Michel, thanks for the tip. Having my users install the ActivePython distribution isn't really a better solution, as I'd just be replacing "install pywin32" with "install ActivePython". Instead, I'm looking for a way to use distutils to install my module on a user's computer, and at the same time, install the necessary bits of pywin32 so that COM object consumption and COM event registration are supported. That way, the user just types easy_install and voila, everything is in place. If this doesn't exist yet for pywin32, I might be willing to have a go at writing the patch, if I had some pointers. Perhaps it would be possible to make a distutils pywin32 package which turned around, downloaded the install executable, and ran it; then module developers could install_requires pywin32 and it would Just Work. I'm new to distutils, pywin32, and COM, but I'm willing to learn :) Any more ideas, anyone? Michael From gundlach at gmail.com Fri Aug 8 16:49:51 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Fri, 8 Aug 2008 10:49:51 -0400 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: <489C58F0.9080302@pythonlibrary.org> References: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> <489C4F91.7080708@co.marshall.ia.us> <489C58F0.9080302@pythonlibrary.org> Message-ID: Thanks, Mike. If I figure out the syntax I'll post again for everybody's benefit. Michael On Fri, Aug 8, 2008 at 10:32 AM, Mike Driscoll wrote: > I think easy_install supports a lot of that. If you set up your "setup.py" > file correctly, it will try to download what you want or give a message to > the user to do it manually. Getting just bits and pieces of pywin32 probably > isn't something that it supports, however. And I don't think Hammond has an > egg version of Pywin32 either...if there was one, then easy_install would > work. > > ------------------- > Mike Driscoll > > Blog: http://blog.pythonlibrary.org > Python Extension Building Network: http://www.pythonlibrary.org > > From cgalvan at enthought.com Fri Aug 8 16:59:19 2008 From: cgalvan at enthought.com (Christopher Galvan) Date: Fri, 08 Aug 2008 09:59:19 -0500 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: References: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> <489C4F91.7080708@co.marshall.ia.us> Message-ID: <489C5F47.4090601@enthought.com> Michael Gundlach wrote: > On Fri, Aug 8, 2008 at 9:52 AM, Mike Driscoll > wrote: > >> Michael Gundlach wrote: >> >>> Hi, >>> >>> Sorry to be dense, but I assume you mean the ActiveState cookbook at http://code.activestate.com/recipes/langs/python/ ? >>> >>> >> He's probably referring to "ActivePython": >> >> http://www.activestate.com/Products/activepython/index.mhtml >> http://www.activestate.com/Products/activepython/feature_list.mhtml >> >> Mike >> > > Thanks, Mike. > > Michel, thanks for the tip. Having my users install the ActivePython > distribution isn't really a better solution, as I'd just be replacing > "install pywin32" with "install ActivePython". > > Instead, I'm looking for a way to use distutils to install my module > on a user's computer, and at the same time, install the necessary bits > of pywin32 so that COM object consumption and COM event registration > are supported. That way, the user just types > > easy_install > > and voila, everything is in place. > > If this doesn't exist yet for pywin32, I might be willing to have a go > at writing the patch, if I had some pointers. Perhaps it would be > possible to make a distutils pywin32 package which turned around, > downloaded the install executable, and ran it; then module developers > could install_requires pywin32 and it would Just Work. I'm new to > distutils, pywin32, and COM, but I'm willing to learn :) > > Any more ideas, anyone? > > Michael > _______________________________________________ > I work for a company called Enthought who also ships a Python Distribution(EPD) which includes an 'egg' version of pywin32 that someone could easy_install. The entire distribution is free, but unfortunately there is an annual fee to access the egg repository for individual packages. However, I would be more than willing to help you get started with using setuptools and creating an egg for pywin32 :). Even if the pywin32 project doesn't upload the egg to PyPi, there is still another way through setuptools to make a single install step for your users. -- Chris Galvan From mdriscoll at co.marshall.ia.us Fri Aug 8 17:02:12 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Fri, 08 Aug 2008 10:02:12 -0500 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: References: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> <489C4F91.7080708@co.marshall.ia.us> Message-ID: <489C5FF4.3080404@co.marshall.ia.us> Michael Gundlach wrote: > On Fri, Aug 8, 2008 at 9:52 AM, Mike Driscoll > wrote: > >> Michael Gundlach wrote: >> >>> Hi, >>> >>> Sorry to be dense, but I assume you mean the ActiveState cookbook at http://code.activestate.com/recipes/langs/python/ ? >>> >>> >> He's probably referring to "ActivePython": >> >> http://www.activestate.com/Products/activepython/index.mhtml >> http://www.activestate.com/Products/activepython/feature_list.mhtml >> >> Mike >> > > Thanks, Mike. > > Michel, thanks for the tip. Having my users install the ActivePython > distribution isn't really a better solution, as I'd just be replacing > "install pywin32" with "install ActivePython". > > Instead, I'm looking for a way to use distutils to install my module > on a user's computer, and at the same time, install the necessary bits > of pywin32 so that COM object consumption and COM event registration > are supported. That way, the user just types > > easy_install > > and voila, everything is in place. > > If this doesn't exist yet for pywin32, I might be willing to have a go > at writing the patch, if I had some pointers. Perhaps it would be > possible to make a distutils pywin32 package which turned around, > downloaded the install executable, and ran it; then module developers > could install_requires pywin32 and it would Just Work. I'm new to > distutils, pywin32, and COM, but I'm willing to learn :) > > Any more ideas, anyone? > > Michael > I think easy_install supports a lot of that. If you set up your "setup.py" file correctly, it will try to download what you want or give a message to the user to do it manually. Getting just bits and pieces of pywin32 probably isn't something that it supports, however. And I don't think Hammond has an egg version of Pywin32 either...if there was one, then easy_install would work. ------------------- Mike Driscoll Blog: http://blog.pythonlibrary.org Python Extension Building Network: http://www.pythonlibrary.org From mdriscoll at co.marshall.ia.us Fri Aug 8 17:02:48 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Fri, 08 Aug 2008 10:02:48 -0500 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: <489C5F47.4090601@enthought.com> References: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> <489C4F91.7080708@co.marshall.ia.us> <489C5F47.4090601@enthought.com> Message-ID: <489C6018.8020901@co.marshall.ia.us> Christopher Galvan wrote: > Michael Gundlach wrote: >> On Fri, Aug 8, 2008 at 9:52 AM, Mike Driscoll >> wrote: >> >>> Michael Gundlach wrote: >>> >>>> Hi, >>>> >>>> Sorry to be dense, but I assume you mean the ActiveState cookbook >>>> at http://code.activestate.com/recipes/langs/python/ ? >>>> >>>> >>> He's probably referring to "ActivePython": >>> >>> http://www.activestate.com/Products/activepython/index.mhtml >>> http://www.activestate.com/Products/activepython/feature_list.mhtml >>> >>> Mike >>> >> >> Thanks, Mike. >> >> Michel, thanks for the tip. Having my users install the ActivePython >> distribution isn't really a better solution, as I'd just be replacing >> "install pywin32" with "install ActivePython". >> >> Instead, I'm looking for a way to use distutils to install my module >> on a user's computer, and at the same time, install the necessary bits >> of pywin32 so that COM object consumption and COM event registration >> are supported. That way, the user just types >> >> easy_install >> >> and voila, everything is in place. >> >> If this doesn't exist yet for pywin32, I might be willing to have a go >> at writing the patch, if I had some pointers. Perhaps it would be >> possible to make a distutils pywin32 package which turned around, >> downloaded the install executable, and ran it; then module developers >> could install_requires pywin32 and it would Just Work. I'm new to >> distutils, pywin32, and COM, but I'm willing to learn :) >> >> Any more ideas, anyone? >> >> Michael >> _______________________________________________ >> > I work for a company called Enthought who also ships a Python > Distribution(EPD) which includes an 'egg' version > of pywin32 that someone could easy_install. The entire distribution > is free, but unfortunately there is an annual fee > to access the egg repository for individual packages. However, I > would be more than willing to help you get > started with using setuptools and creating an egg for pywin32 :). > Even if the pywin32 project doesn't upload the egg to > PyPi, there is still another way through setuptools to make a single > install step for your users. > > -- Chris Galvan > If they don't want it, I can host the egg at pythonlibrary.org. Let me know if I can help. I'm kind of green with the setuptools / easy_install thing too, but it's on my "TODO" list of things to learn. Mike From cgalvan at enthought.com Fri Aug 8 17:18:51 2008 From: cgalvan at enthought.com (Christopher Galvan) Date: Fri, 08 Aug 2008 10:18:51 -0500 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: <489C5F87.6030808@pythonlibrary.org> References: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> <489C4F91.7080708@co.marshall.ia.us> <489C5F47.4090601@enthought.com> <489C5F87.6030808@pythonlibrary.org> Message-ID: <489C63DB.9060101@enthought.com> Mike Driscoll wrote: > Christopher Galvan wrote: >> Michael Gundlach wrote: >>> On Fri, Aug 8, 2008 at 9:52 AM, Mike Driscoll >>> wrote: >>> >>>> Michael Gundlach wrote: >>>> >>>>> Hi, >>>>> >>>>> Sorry to be dense, but I assume you mean the ActiveState cookbook >>>>> at http://code.activestate.com/recipes/langs/python/ ? >>>>> >>>>> >>>> He's probably referring to "ActivePython": >>>> >>>> http://www.activestate.com/Products/activepython/index.mhtml >>>> http://www.activestate.com/Products/activepython/feature_list.mhtml >>>> >>>> Mike >>>> >>> >>> Thanks, Mike. >>> >>> Michel, thanks for the tip. Having my users install the ActivePython >>> distribution isn't really a better solution, as I'd just be replacing >>> "install pywin32" with "install ActivePython". >>> >>> Instead, I'm looking for a way to use distutils to install my module >>> on a user's computer, and at the same time, install the necessary bits >>> of pywin32 so that COM object consumption and COM event registration >>> are supported. That way, the user just types >>> >>> easy_install >>> >>> and voila, everything is in place. >>> >>> If this doesn't exist yet for pywin32, I might be willing to have a go >>> at writing the patch, if I had some pointers. Perhaps it would be >>> possible to make a distutils pywin32 package which turned around, >>> downloaded the install executable, and ran it; then module developers >>> could install_requires pywin32 and it would Just Work. I'm new to >>> distutils, pywin32, and COM, but I'm willing to learn :) >>> >>> Any more ideas, anyone? >>> >>> Michael >>> _______________________________________________ >>> >> I work for a company called Enthought who also ships a Python >> Distribution(EPD) which includes an 'egg' version >> of pywin32 that someone could easy_install. The entire distribution >> is free, but unfortunately there is an annual fee >> to access the egg repository for individual packages. However, I >> would be more than willing to help you get >> started with using setuptools and creating an egg for pywin32 :). >> Even if the pywin32 project doesn't upload the egg to >> PyPi, there is still another way through setuptools to make a single >> install step for your users. >> >> -- Chris Galvan >> > > If they don't want it, I can host the egg at pythonlibrary.org. Let me > know if I can help. I'm kind of green with the setuptools / > easy_install thing too, but it's on my "TODO" list of things to learn. > > Mike > > Sure thing, I'm always hanging out in #setuptools and #distutils on freenode.net if you want to discuss it in more detail, or anyone for that matter :) -- Chris Galvan From gundlach at gmail.com Fri Aug 8 17:16:34 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Fri, 8 Aug 2008 11:16:34 -0400 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: <489C5F47.4090601@enthought.com> References: <85EB3ECBB83C4106BBDA836CD5BF6234@MCI1330> <489C4F91.7080708@co.marshall.ia.us> <489C5F47.4090601@enthought.com> Message-ID: Hi Christopher, On Fri, Aug 8, 2008 at 10:59 AM, Christopher Galvan wrote: > I work for a company called Enthought who also ships a Python I just read about Enthought for the first time the other day. It seems that Enthought and ActiveState do similar things. > Distribution(EPD) which includes an 'egg' version > of pywin32 that someone could easy_install. The entire distribution is > free, but unfortunately there is an annual fee > to access the egg repository for individual packages. However, I would be Would it be against Enthought's license for me to pay the annual fee, download the egg, modify it in some way, and then make it freely available? I read the applicable part of the license and it sounds like if I modify the egg for my own use, then after the license terminates I can still keep and distribute the modified copy. I don't want to violate the spirit of their license, so maybe this isn't kosher, but I'd also like to avoid duplication of effort! :) > more than willing to help you get > started with using setuptools and creating an egg for pywin32 :). Even if > the pywin32 project doesn't upload the egg to > PyPi, there is still another way through setuptools to make a single install > step for your users. Right -- by pointing explicitly to where the egg file can be found, correct? Thanks very much for the offer of help -- if my above license hack is a no-go, then I'll probably see you on IRC. Michael From Brad.Johnson at ballardtech.com Fri Aug 8 21:32:05 2008 From: Brad.Johnson at ballardtech.com (Brad Johnson) Date: Fri, 8 Aug 2008 19:32:05 +0000 (UTC) Subject: [python-win32] =?utf-8?q?Friendlier_pywintypes=2Ecom=5Ferror_mess?= =?utf-8?q?ages?= Message-ID: I am using pywin32 scripting as a client to my C++ COM application. Many of my functions in C++ are returning errors such as E_FAIL, E_POINTER, E_INVALIDARG, etc... However, the error message in Python is often cryptic such as a simple "Exception occurred" with the error code. I suppose I could handle these exceptions and somehow post my own strings as the error message, but I figured I'd ask if there is a list of supported error codes that give more information. From timr at probo.com Fri Aug 8 23:44:12 2008 From: timr at probo.com (Tim Roberts) Date: Fri, 08 Aug 2008 14:44:12 -0700 Subject: [python-win32] Friendlier pywintypes.com_error messages In-Reply-To: References: Message-ID: <489CBE2C.3090206@probo.com> Brad Johnson wrote: > I am using pywin32 scripting as a client to my C++ COM application. Many of my > functions in C++ are returning errors such as E_FAIL, E_POINTER, E_INVALIDARG, > etc... > ...which are, after all, just numbers. E_FAIL is 0x80004005, which shows in the exception report as -2147467259. E_POINTER is 0x80004003. E_INVALIDARG is 0x80070057. > However, the error message in Python is often cryptic such as a simple > "Exception occurred" with the error code. > The code is buried in that report. One trick is not to look at the first large negative number (which is usually the generic "an error occurred" error), but instead look for the second large negative number: >>/ com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, / >>/ -2147467259), None) / Here, -2147352567 is DISP_E_EXCEPTION, which means "exception occurred". The real error code is -2147467259, which is 0x80004005, which is E_FAIL. > I suppose I could handle these exceptions and somehow post my own strings as the > error message, but I figured I'd ask if there is a list of supported error codes > that give more information. > Not sure what you mean by "supported error codes". There are HRESULT error numbers spread all over the include files in the Platform SDK. The most common (like the three you mentioned) are in WinError.h. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mhammond at skippinet.com.au Sat Aug 9 08:08:20 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 9 Aug 2008 16:08:20 +1000 Subject: [python-win32] Friendlier pywintypes.com_error messages In-Reply-To: References: Message-ID: <008e01c8f9e6$55529950$fff7cbf0$@com.au> Just following up from what Tim said: > However, the error message in Python is often cryptic such as a simple > "Exception occurred" with the error code. When DISP_E_EXECEPTION occurs, the object generating the error fills the data that comes back in the extra tuple. This information has the capability to carry extra message text, but as you have seen, most apps don't bother. If all you have is the error code (like the -2147467259 Tim mentioned), you can use win32api.FormatMessage() to get the text: >>> win32api.FormatMessage(-2147467259) 'Unspecified error\r\n' >>> Which is the "official", but unhelpful english text for E_FAIL. Obviously though, these numbers can't carry application specific information - which is what that extra tuple is used for in the first place. Cheers, Mark From mhammond at skippinet.com.au Sat Aug 9 08:08:20 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 9 Aug 2008 16:08:20 +1000 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: References: Message-ID: <008f01c8f9e6$5749ae60$05dd0b20$@com.au> See also http://bugs.python.org/setuptools/issue18 - the short story is that there is a fixed, but unreleased bug in setuptools that still prevents things working 100% Cheers, Mark From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of Michael Gundlach Sent: Wednesday, 6 August 2008 10:53 PM To: python-win32 at python.org Subject: [python-win32] pywin32 install via setuptools -- conclusion? Hi, I've got a module that relies on pywin32 being installed (to consume but not create COM objects, and to respond to COM events). My module installs with easy_install, and I'd love to have its dependency graph automatically install pywin32, or at least the bits important for COM object and event consumption. Is this possible? I found a thread from last year to this effect, but the outcome wasn't clear (at least to me). Thanks! Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From gundlach at gmail.com Sat Aug 9 08:38:44 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Sat, 9 Aug 2008 02:38:44 -0400 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: <008f01c8f9e6$5749ae60$05dd0b20$@com.au> References: <008f01c8f9e6$5749ae60$05dd0b20$@com.au> Message-ID: Mark, that's great! I hadn't realized that it was so close to installable via easy_install. It's less great that setuptools doesn't seem to have been released in two years... does anyone (Eby?) know the rough timeline for the next release? And if not, I'll go back to plan C, and see if I can figure out a workaround :) Michael On Sat, Aug 9, 2008 at 2:08 AM, Mark Hammond wrote: > See also http://bugs.python.org/setuptools/issue18 - the short story is that > there is a fixed, but unreleased bug in setuptools that still prevents > things working 100% > > > > Cheers, > > > > Mark > > > > From: python-win32-bounces at python.org > [mailto:python-win32-bounces at python.org] On Behalf Of Michael Gundlach > Sent: Wednesday, 6 August 2008 10:53 PM > To: python-win32 at python.org > Subject: [python-win32] pywin32 install via setuptools -- conclusion? > > > > Hi, > > I've got a module that relies on pywin32 being installed (to consume but not > create COM objects, and to respond to COM events). My module installs with > easy_install, and I'd love to have its dependency graph automatically > install pywin32, or at least the bits important for COM object and event > consumption. > > Is this possible? I found a thread from last year to this effect, but the > outcome wasn't clear (at least to me). > > Thanks! > Michael From cgalvan at enthought.com Sat Aug 9 09:06:17 2008 From: cgalvan at enthought.com (Chris Galvan) Date: Sat, 09 Aug 2008 02:06:17 -0500 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: References: <008f01c8f9e6$5749ae60$05dd0b20$@com.au> Message-ID: <489D41E9.8060309@enthought.com> A lot of people have been frustrated with the lack of development on setuptools, which is partially do to the fact that Phillip has been busy with other (paid) projects, but also that he is really the only developer :) However, he has been allotting more time recently and plans to release 0.6 final release by the end of August. -- Chris Galvan Michael Gundlach wrote: > Mark, that's great! I hadn't realized that it was so close to > installable via easy_install. > > It's less great that setuptools doesn't seem to have been released in > two years... does anyone (Eby?) know the rough timeline for the next > release? > > And if not, I'll go back to plan C, and see if I can figure out a workaround :) > > Michael > > On Sat, Aug 9, 2008 at 2:08 AM, Mark Hammond wrote: > >> See also http://bugs.python.org/setuptools/issue18 - the short story is that >> there is a fixed, but unreleased bug in setuptools that still prevents >> things working 100% >> >> >> >> Cheers, >> >> >> >> Mark >> >> >> >> From: python-win32-bounces at python.org >> [mailto:python-win32-bounces at python.org] On Behalf Of Michael Gundlach >> Sent: Wednesday, 6 August 2008 10:53 PM >> To: python-win32 at python.org >> Subject: [python-win32] pywin32 install via setuptools -- conclusion? >> >> >> >> Hi, >> >> I've got a module that relies on pywin32 being installed (to consume but not >> create COM objects, and to respond to COM events). My module installs with >> easy_install, and I'd love to have its dependency graph automatically >> install pywin32, or at least the bits important for COM object and event >> consumption. >> >> Is this possible? I found a thread from last year to this effect, but the >> outcome wasn't clear (at least to me). >> >> Thanks! >> Michael >> > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From mdriscoll at co.marshall.ia.us Sat Aug 9 16:51:30 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Sat, 9 Aug 2008 09:51:30 -0500 (CDT) Subject: [python-win32] Build 211 still linked from main page Message-ID: <9996485.139151218293490973.JavaMail.root@zimbra> Hi, I noticed just now that if I go to the main page for pywin32 on SourceForge and click the big green button, I get taken to the 211 build instead of the 212: http://sourceforge.net/projects/pywin32/ Is this intentional? Mike From gundlach at gmail.com Mon Aug 11 12:59:30 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Mon, 11 Aug 2008 06:59:30 -0400 Subject: [python-win32] pywin32 install via setuptools -- conclusion? In-Reply-To: <489D41E9.8060309@enthought.com> References: <008f01c8f9e6$5749ae60$05dd0b20$@com.au> <489D41E9.8060309@enthought.com> Message-ID: Sweet! Thanks to everyone for your suggestions and info. Michael On Sat, Aug 9, 2008 at 3:06 AM, Chris Galvan wrote: > A lot of people have been frustrated with the lack of development on > setuptools, which is partially do to the fact that Phillip has been busy > with other (paid) projects, but also that he is really the only developer :) > However, he has been allotting more time recently and plans to release 0.6 > final release by the end of August. > > -- Chris Galvan > > Michael Gundlach wrote: >> >> Mark, that's great! I hadn't realized that it was so close to >> installable via easy_install. >> >> It's less great that setuptools doesn't seem to have been released in >> two years... does anyone (Eby?) know the rough timeline for the next >> release? >> >> And if not, I'll go back to plan C, and see if I can figure out a >> workaround :) >> >> Michael >> >> On Sat, Aug 9, 2008 at 2:08 AM, Mark Hammond >> wrote: >> >>> >>> See also http://bugs.python.org/setuptools/issue18 - the short story is >>> that >>> there is a fixed, but unreleased bug in setuptools that still prevents >>> things working 100% >>> >>> >>> >>> Cheers, >>> >>> >>> >>> Mark >>> >>> >>> >>> From: python-win32-bounces at python.org >>> [mailto:python-win32-bounces at python.org] On Behalf Of Michael Gundlach >>> Sent: Wednesday, 6 August 2008 10:53 PM >>> To: python-win32 at python.org >>> Subject: [python-win32] pywin32 install via setuptools -- conclusion? >>> >>> >>> >>> Hi, >>> >>> I've got a module that relies on pywin32 being installed (to consume but >>> not >>> create COM objects, and to respond to COM events). My module installs >>> with >>> easy_install, and I'd love to have its dependency graph automatically >>> install pywin32, or at least the bits important for COM object and event >>> consumption. >>> >>> Is this possible? I found a thread from last year to this effect, but >>> the >>> outcome wasn't clear (at least to me). >>> >>> Thanks! >>> Michael >>> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> >> > > From abermudez at hispasec.com Mon Aug 11 13:01:17 2008 From: abermudez at hispasec.com (Alejandro Bermudez Aragurz) Date: Mon, 11 Aug 2008 13:01:17 +0200 Subject: [python-win32] About ctypes and getprocaddress Message-ID: <48A01BFD.7030601@hispasec.com> Hello list, I'm working with ctypes doing a wrapper for a DLL. I use LoadLibrary, FreeLibrary and GetProcAddress of windows system API (kernel32.dll). The problem is the following: Inside a DLL there are 4 function. I can to request its address of 3 functions without problem (GetProcAddress return the correct value), but the 4th function work sometimes. Sometime, GetProcAddress return NULL value and GetLastError return error code 127. But others time, return the correct address and GetLastError return 0 (no error ocurred). I don't change the code between each try. I print too the pefile exports and this function appers in the pe file. The DLL is always the same. The python code is always the same. Why don't work well GetProcAddress sometime, and other time work well? Here post my code test: import ctypes import time import tool_pefile #DLLs manager funcion_open = ctypes.windll.kernel32.LoadLibraryA funcion_close = ctypes.windll.kernel32.FreeLibrary funcion_direccion = ctypes.windll.kernel32.GetProcAddress #Manejo de errores funcion_error = ctypes.windll.kernel32.GetLastError if __name__ == '__main__': count = 5 while count: #pe file hPE = tool_pefile.Tool() txt = hPE.info_txt("c:\\windows\\system32\\TrIDLib.dll") print txt #Se abre la DLL dllname = ctypes.create_string_buffer(len("c:\\windows\\system32\\TrIDLib.dll")) dllname.value = "TrIDLib.dll" hDLL = funcion_open( dllname ) error = funcion_error() print str(error) #name = "TrID_Analyze" name = "TrID_LoadDefsPack" print hDLL #time.sleep(4) funcion = ctypes.create_string_buffer(len(name)) funcion.value = name print funcion.value direccion = funcion_direccion( hDLL, funcion ) print hex(direccion) error = funcion_error() print str(error) res = funcion_close( hDLL ) print res error = funcion_error() print str(error) print "To sleep" count -= 1 time.sleep(2) From mhammond at skippinet.com.au Mon Aug 11 14:05:54 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 11 Aug 2008 22:05:54 +1000 Subject: [python-win32] Build 211 still linked from main page In-Reply-To: <9996485.139151218293490973.JavaMail.root@zimbra> References: <9996485.139151218293490973.JavaMail.root@zimbra> Message-ID: <015101c8fbaa$9e6d8990$db489cb0$@com.au> > I noticed just now that if I go to the main page for pywin32 on > SourceForge and click the big green button, I get taken to the 211 > build instead of the 212: > > http://sourceforge.net/projects/pywin32/ > > Is this intentional? Nope - fixed now - thanks! Mark From gundlach at gmail.com Tue Aug 12 08:14:40 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Tue, 12 Aug 2008 02:14:40 -0400 Subject: [python-win32] Play MP3s from Windows, Just Works Message-ID: Hi, Is there a way to play an MP3 from Python 2.5 in Windows, that doesn't require compiling C first? I'd like to make a package easy_installable [a different one this time!] that can then play MP3s without any other fuss. I've looked through the python-win32 archives, I've looked on Google, I've looked on PyPI. - Using COM to WMPlayer.OCX doesn't work unless you're in PythonWin or wxPython. - audiere doesn't have Python 2.5 bindings and I haven't been successful manipulating the C DLL with ctypes. - pyMedia requires that the target machine have Visual Studio or Cygwin installed. - snack requires Tcl/Tk and others. - os.system() only manages to open Windows Media Player, along with a bunch of IE-clickety-click noises, and still won't play the passed file arg. - everything else is for Linux! The best bet seems to be 2.5 bindings to audiere, but I have no idea if that's possible. Someone claims to have managed to build 2.4 bindings for audiere, but the link to the project is now dead. After the wealth of Batteries Included modules in Python, it was a bit surprising to find nothing yet that Just Works. Suggestions? If nothing else, I'll add to my List Of Projects "write a cross-platform pymp3"... Michael From gerdusvanzyl at gmail.com Tue Aug 12 09:26:19 2008 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Tue, 12 Aug 2008 09:26:19 +0200 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: References: Message-ID: <91882ea90808120026s70f51a35wa784dae81a53a37c@mail.gmail.com> Try pyglet [pyglet.org]. It wraps avbin for mp3,ogg reading and plays using directsound, alsa, etc. Not sure if it could be made easy_installable. ~Gerdus On Tue, Aug 12, 2008 at 8:14 AM, Michael Gundlach wrote: > Hi, > > Is there a way to play an MP3 from Python 2.5 in Windows, that doesn't > require compiling C first? I'd like to make a package > easy_installable [a different one this time!] that can then play MP3s > without any other fuss. > > I've looked through the python-win32 archives, I've looked on Google, > I've looked on PyPI. > - Using COM to WMPlayer.OCX doesn't work unless you're in PythonWin > or wxPython. > - audiere doesn't have Python 2.5 bindings and I haven't been > successful manipulating the C DLL with ctypes. > - pyMedia requires that the target machine have Visual Studio or > Cygwin installed. > - snack requires Tcl/Tk and others. > - os.system() only manages to open Windows Media Player, along with > a bunch of IE-clickety-click noises, and still won't play the passed > file arg. > - everything else is for Linux! > > The best bet seems to be 2.5 bindings to audiere, but I have no idea > if that's possible. Someone claims to have managed to build 2.4 > bindings for audiere, but the link to the project is now dead. After > the wealth of Batteries Included modules in Python, it was a bit > surprising to find nothing yet that Just Works. > > Suggestions? If nothing else, I'll add to my List Of Projects "write > a cross-platform pymp3"... > > Michael > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From sidnei at enfoldsystems.com Tue Aug 12 13:53:54 2008 From: sidnei at enfoldsystems.com (Sidnei da Silva) Date: Tue, 12 Aug 2008 08:53:54 -0300 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: <91882ea90808120026s70f51a35wa784dae81a53a37c@mail.gmail.com> References: <91882ea90808120026s70f51a35wa784dae81a53a37c@mail.gmail.com> Message-ID: On Tue, Aug 12, 2008 at 4:26 AM, Gerdus van Zyl wrote: > Try pyglet [pyglet.org]. It wraps avbin for mp3,ogg reading and plays > using directsound, alsa, etc. Not sure if it could be made > easy_installable. Maybe PyGame? Same issue re: being easy_install-able though. -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 From vernondcole at gmail.com Tue Aug 12 16:45:59 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 12 Aug 2008 08:45:59 -0600 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: References: <91882ea90808120026s70f51a35wa784dae81a53a37c@mail.gmail.com> Message-ID: As always, remember that mp3 is proprietary, and the owner has shown willingness to be nasty about licensing it. Therefore, anything that is "easy to install" is possibly illegal and/or will open you to a lawsuit. If you are doing new work, better to use ogg. On Tue, Aug 12, 2008 at 5:53 AM, Sidnei da Silva wrote: > On Tue, Aug 12, 2008 at 4:26 AM, Gerdus van Zyl > wrote: > > Try pyglet [pyglet.org]. It wraps avbin for mp3,ogg reading and plays > > using directsound, alsa, etc. Not sure if it could be made > > easy_installable. > > Maybe PyGame? Same issue re: being easy_install-able though. > > -- > Sidnei da Silva > Enfold Systems http://enfoldsystems.com > Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From egregio at gmail.com Tue Aug 12 16:49:33 2008 From: egregio at gmail.com (_ _) Date: Tue, 12 Aug 2008 16:49:33 +0200 Subject: [python-win32] Create dll from python source code In-Reply-To: <064401c8f705$bb75dd20$32619760$@com.au> References: <1bdf59490808050502i2b4c3b9bj72db8a1394987db3@mail.gmail.com> <064401c8f705$bb75dd20$32619760$@com.au> Message-ID: <1bdf59490808120749t76fe35f6y42cc6807a01d6c1a@mail.gmail.com> I try use pyrex to create dll from py source code. Works!, but I dont know how include win32 extension modules in my dll.... Can you help me please?... I need to include PyQt too... Thanks a lot!! 2008/8/5 Mark Hammond > I'm not aware of a tool that will turn a python script into a DLL with > arbitrary entry-points. py2exe will let you create DLLs with entry points > suitable for COM objects or ISAPI extensions. > > HTH, > > Mark > > ---- > > From: python-win32-bounces at python.org > [mailto:python-win32-bounces at python.org] On Behalf Of _ _ > Sent: Tuesday, 5 August 2008 10:03 PM > To: python-win32 at python.org > Subject: [python-win32] Create dll from python source code > > How create a dll from python source code?... py2exe? > > Thanks a lot... > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wcdsoft at live.com Tue Aug 12 17:11:44 2008 From: wcdsoft at live.com (Walter Decker) Date: Tue, 12 Aug 2008 11:11:44 -0400 Subject: [python-win32] GetModuleFileName requires Process or Thread handle? Message-ID: Hello, Can someone help me diagnose why the following fails to retrieve the 'exe' name KillByName? Some code copied from unnamed webpage: import sysimport osimport timeimport win32apiimport win32process def StartAProcess(RunCmd): StartupInfo = win32process.STARTUPINFO() np = win32process.CreateProcess( None, # program RunCmd, # command line None, # process security attributes None, # thread attributes 1, # inherit handles 0, # Don't need anything here. None, # new environment None, # new directory StartupInfo) print "StartAProcess np: " + str(np) def KillByName(matchstring): processList = win32process.EnumProcesses() print "KillByName processList: " + str(processList) msLower = matchstring.lower() print "KillByName msLower: " + msLower for pid in processList: try: print "KillByName pid: " + str(pid) handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, False, pid) print "KillByName handle: " + str(handle) exe = win32api.GetModuleFileName(handle) print "KillByName exe: " + exe print "KillByName oneProcess: handle " + str(handle) + " pid " + str(pid) + " exe " + exe if exe.lower() == mslower: print "KillByName found pid: " + str(pid) #win32api.TerminateProcess(handle,0) #win32api.CloseHandle(handle) except: pass if __name__ == "__main__": if 2 == len(sys.argv): StartAProcess(sys.argv[1]) time.sleep(10.0) KillByName(sys.argv[1]) Is a handle a handle a handle? The win32api.CreateProcess that started the process returns two (2) handles (hProcess and hThread) and the OpenProcess call above returns the second of those two handles (the hThread). Is it that I need the 'other' handle as in: "The result is a tuple of (hProcess, hThread, dwProcessId, dwThreadId)" to send to win32api.GetModuleFileName(handle)? The 'try' 'except' catches on the win32api.GetModuleFileName. Regards, Walter. _________________________________________________________________ Get more from your digital life. Find out how. http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home2_082008 -------------- next part -------------- An HTML attachment was scrubbed... URL: From execrable at gmail.com Tue Aug 12 17:45:56 2008 From: execrable at gmail.com (Brian Parma) Date: Tue, 12 Aug 2008 08:45:56 -0700 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: References: <91882ea90808120026s70f51a35wa784dae81a53a37c@mail.gmail.com> Message-ID: If you don't need to control the playback with your program but just launch it (in WMP), try os.startfile instead of os.system. On Tue, Aug 12, 2008 at 7:45 AM, Vernon Cole wrote: > As always, remember that mp3 is proprietary, and the owner has shown > willingness to be nasty about licensing it. Therefore, anything that is > "easy to install" is possibly illegal and/or will open you to a lawsuit. If > you are doing new work, better to use ogg. > > On Tue, Aug 12, 2008 at 5:53 AM, Sidnei da Silva > wrote: > >> On Tue, Aug 12, 2008 at 4:26 AM, Gerdus van Zyl >> wrote: >> > Try pyglet [pyglet.org]. It wraps avbin for mp3,ogg reading and plays >> > using directsound, alsa, etc. Not sure if it could be made >> > easy_installable. >> >> Maybe PyGame? Same issue re: being easy_install-able though. >> >> -- >> Sidnei da Silva >> Enfold Systems http://enfoldsystems.com >> Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gundlach at gmail.com Tue Aug 12 18:19:21 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Tue, 12 Aug 2008 12:19:21 -0400 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: References: <91882ea90808120026s70f51a35wa784dae81a53a37c@mail.gmail.com> Message-ID: Re: PyGame: I forgot that one in my list. Someone else tried it and said sound quality for MP3 playback was terrible (didn't verify myself though). Re: pyglet: thanks for the suggestion. Re: licensing: good point, and so I think that the best solution is... os.startfile('x.mp3'). Thank you, Brian, that's exactly what I needed -- a way to have the system use the default audio player! I do need to stop files, but including a tiny "silence.wav" with my project to "start" seems to do the trick handily :) Thank you all for your advice, and I hope this thread gets found by the next guy who asks this question! Michael PS: The project is a speech-controlled robot that scans a remote music collection, then plays bands/albums/songs on command ('musicbutler' package on pypi). So, while os.startfile() has the side effect of opening my default media player, I don't mind that as this app would be on a machine without a monitor... On Tue, Aug 12, 2008 at 11:45 AM, Brian Parma wrote: > If you don't need to control the playback with your program but just launch > it (in WMP), try os.startfile instead of os.system. > > On Tue, Aug 12, 2008 at 7:45 AM, Vernon Cole wrote: >> >> As always, remember that mp3 is proprietary, and the owner has shown >> willingness to be nasty about licensing it. Therefore, anything that is >> "easy to install" is possibly illegal and/or will open you to a lawsuit. If >> you are doing new work, better to use ogg. >> >> On Tue, Aug 12, 2008 at 5:53 AM, Sidnei da Silva >> wrote: >>> >>> On Tue, Aug 12, 2008 at 4:26 AM, Gerdus van Zyl >>> wrote: >>> > Try pyglet [pyglet.org]. It wraps avbin for mp3,ogg reading and plays >>> > using directsound, alsa, etc. Not sure if it could be made >>> > easy_installable. >>> >>> Maybe PyGame? Same issue re: being easy_install-able though. >>> >>> -- >>> Sidnei da Silva >>> Enfold Systems http://enfoldsystems.com >>> Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 >>> _______________________________________________ >>> python-win32 mailing list >>> python-win32 at python.org >>> http://mail.python.org/mailman/listinfo/python-win32 >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From mail at timgolden.me.uk Tue Aug 12 21:18:17 2008 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 12 Aug 2008 20:18:17 +0100 Subject: [python-win32] GetModuleFileName requires Process or Thread handle? In-Reply-To: References: Message-ID: <48A1E1F9.5020402@timgolden.me.uk> Walter Decker wrote: > Can someone help me diagnose why the following fails to retrieve the > 'exe' name KillByName? Do you mind if I sidestep your question altogether and point out that this is one of those things which WMI makes a fair bit easier? Obviously, if what you want is an insight into Win32 process handles and so on, then say so, and I'll try to oblige. But just in case you really want to kill a named process, try this: import os, sys import time import wmi c = wmi.WMI (find_classes=False) def kill_by_name (name): for process in c.Win32_Process (Caption=name): process.Terminate () def start_a_process (name): c.Win32_Process.Create (CommandLine=name) if __name__ == '__main__': start_a_process (sys.argv[1]) time.sleep (5) kill_by_name (sys.argv[1]) TJG From mc at mclaveau.com Tue Aug 12 21:38:20 2008 From: mc at mclaveau.com (Michel Claveau) Date: Tue, 12 Aug 2008 21:38:20 +0200 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: References: Message-ID: Hi! You can use MCI (include inWindows). Example: # -*- coding: utf-8 -*- import time from ctypes import windll, c_buffer class mci: def __init__(self): self.w32mci = windll.winmm.mciSendStringA self.w32mcierror = windll.winmm.mciGetErrorStringA def send(self,commande): buffer = c_buffer(255) errorcode = self.w32mci(str(commande),buffer,254,0) if errorcode: return errorcode, self.get_error(errorcode) else: return errorcode,buffer.value def get_error(self,error): error = int(error) buffer = c_buffer(255) self.w32mcierror(error,buffer,254) return buffer.value def directsend(self, txt): (err,buf)=self.send(txt) if err != 0: print'Erreur',str(err),'sur',txt,':',buf return (err,buf) mci=mci() mci.directsend('open "c:\\myMusicFile.mp3" alias toto') mci.directsend('set toto time format milliseconds') err,buf=mci.directsend('status toto length ') print 'Duree du fichier : ',buf,' millisecondes' err,buf=mci.directsend('play toto from 0 to '+str(buf)) time.sleep(int(buf)/1000) mci.directsend('close toto') @-salutations -- Michel Claveau From gundlach at gmail.com Tue Aug 12 22:59:15 2008 From: gundlach at gmail.com (Michael Gundlach) Date: Tue, 12 Aug 2008 16:59:15 -0400 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: References: Message-ID: Michel, This is perfect. Works like a charm, and I assume it's not due to my installing anything already besides Python itself. Thank you very much! I'll go put this into a simple "mp3play" module, and put a recipe in the Cookbook, to up the chance that people find this. Perhaps the module will grow to detect your OS and then Just Work for Linux/Mac/Windows. Thanks again :D Michael On Tue, Aug 12, 2008 at 3:38 PM, Michel Claveau wrote: > Hi! > > You can use MCI (include inWindows). > Example: > > > # -*- coding: utf-8 -*- > > import time > from ctypes import windll, c_buffer > > class mci: > def __init__(self): > self.w32mci = windll.winmm.mciSendStringA > self.w32mcierror = windll.winmm.mciGetErrorStringA > > def send(self,commande): > buffer = c_buffer(255) > errorcode = self.w32mci(str(commande),buffer,254,0) > if errorcode: > return errorcode, self.get_error(errorcode) > else: > return errorcode,buffer.value > > def get_error(self,error): > error = int(error) > buffer = c_buffer(255) > self.w32mcierror(error,buffer,254) > return buffer.value > > def directsend(self, txt): > (err,buf)=self.send(txt) > if err != 0: > print'Erreur',str(err),'sur',txt,':',buf > return (err,buf) > > mci=mci() > mci.directsend('open "c:\\myMusicFile.mp3" alias toto') > mci.directsend('set toto time format milliseconds') > err,buf=mci.directsend('status toto length ') > print 'Duree du fichier : ',buf,' millisecondes' > err,buf=mci.directsend('play toto from 0 to '+str(buf)) > time.sleep(int(buf)/1000) > mci.directsend('close toto') > > > > > > @-salutations > -- > Michel Claveau > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From mc at mclaveau.com Wed Aug 13 00:30:12 2008 From: mc at mclaveau.com (Michel Claveau) Date: Wed, 13 Aug 2008 00:30:12 +0200 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: References: Message-ID: <7C98C60C829B4FA9815DECFBB56E8202@MCI1330> Hi! > This is perfect. Works like a charm ... Thank you very much! Thanks for return. For info, MCI can, also, record from microphone, save file, give infos on sound files, play mp3, wma or mid, etc. It's an old techno of Windows. But... it's only on Windows. @-salutations -- Michel Claveau From mhammond at skippinet.com.au Wed Aug 13 00:36:55 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 13 Aug 2008 08:36:55 +1000 Subject: [python-win32] Create dll from python source code In-Reply-To: <1bdf59490808120749t76fe35f6y42cc6807a01d6c1a@mail.gmail.com> References: <1bdf59490808050502i2b4c3b9bj72db8a1394987db3@mail.gmail.com> <064401c8f705$bb75dd20$32619760$@com.au> <1bdf59490808120749t76fe35f6y42cc6807a01d6c1a@mail.gmail.com> Message-ID: <023e01c8fccb$efe56cd0$cfb04670$@com.au> Note there is a py2exe specific mailing list at https://lists.sourceforge.net/lists/listinfo/py2exe-users - but when asking questions like this, be sure to include the smallest sample that demonstrates your problem in total - ie, the .py file you are trying to freeze, the setup.py you are using to make it and the full error messages you see. Also, make sure you check out the py2exe samples - there are a number of examples which include pywin32 modules. Cheers, Mark From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of _ _ Sent: Wednesday, 13 August 2008 12:50 AM To: mhammond at skippinet.com.au; python-win32 at python.org Subject: Re: [python-win32] Create dll from python source code I try use pyrex to create dll from py source code. Works!, but I dont know how include win32 extension modules in my dll.... Can you help me please?... I need to include PyQt too... Thanks a lot!! 2008/8/5 Mark Hammond I'm not aware of a tool that will turn a python script into a DLL with arbitrary entry-points. py2exe will let you create DLLs with entry points suitable for COM objects or ISAPI extensions. HTH, Mark ---- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of _ _ Sent: Tuesday, 5 August 2008 10:03 PM To: python-win32 at python.org Subject: [python-win32] Create dll from python source code How create a dll from python source code?... py2exe? Thanks a lot... -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Wed Aug 13 16:56:29 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 13 Aug 2008 08:56:29 -0600 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: <7C98C60C829B4FA9815DECFBB56E8202@MCI1330> References: <7C98C60C829B4FA9815DECFBB56E8202@MCI1330> Message-ID: Where can one find documentation of MCI? On Tue, Aug 12, 2008 at 4:30 PM, Michel Claveau wrote: > Hi! > > This is perfect. Works like a charm ... Thank you very much! >> > > Thanks for return. > > For info, MCI can, also, record from microphone, save file, give infos on > sound files, play mp3, wma or mid, etc. > It's an old techno of Windows. > But... it's only on Windows. > > > @-salutations > -- > Michel Claveau > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From graemeglass at gmail.com Wed Aug 13 17:08:02 2008 From: graemeglass at gmail.com (Graeme Glass) Date: Wed, 13 Aug 2008 17:08:02 +0200 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: References: <7C98C60C829B4FA9815DECFBB56E8202@MCI1330> Message-ID: On Wed, Aug 13, 2008 at 4:56 PM, Vernon Cole wrote: > Where can one find documentation of MCI? > > On Tue, Aug 12, 2008 at 4:30 PM, Michel Claveau wrote: > >> Hi! >> >> This is perfect. Works like a charm ... Thank you very much! >>> >> >> Thanks for return. >> >> For info, MCI can, also, record from microphone, save file, give infos on >> sound files, play mp3, wma or mid, etc. >> It's an old techno of Windows. >> But... it's only on Windows. >> >> >> @-salutations >> -- >> Michel Claveau >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > http://en.wikipedia.org/wiki/Multimedia_Control_Interface http://msdn.microsoft.com/en-us/library/ms712587.aspx -------------- next part -------------- An HTML attachment was scrubbed... URL: From rwupole at msn.com Wed Aug 13 21:55:41 2008 From: rwupole at msn.com (Roger Upole) Date: Wed, 13 Aug 2008 15:55:41 -0400 Subject: [python-win32] Re: GetModuleFileName requires Process or Thread handle? Message-ID: GetModuleFileName retrieves module names for the current process only. You can use GetModuleFileNameEx for other processes. Pass 0 for the module handle to get the main executable. Roger From mbelzile at softimage.com Thu Aug 14 16:15:24 2008 From: mbelzile at softimage.com (=?iso-8859-1?Q?Marc-Andr=E9_Belzile?=) Date: Thu, 14 Aug 2008 10:15:24 -0400 Subject: [python-win32] PyCEdit issue Message-ID: <0BCB4AE868D8934A8B3DCE3A58126A890283F814@tewk-mbpf3> Hi, does anyone know why all the cr/lf characters are ignored by PyCEdit when used in a dialog ? There is no such problem with a static control though but I want to be able to select/copy text from the control. Here's my code snipet... folder = os.path.dirname(__file__) f = open(folder + '/' + 'help.txt','r') template.append(['EDIT', f.read(), self.IDC_EDIT_HELP, (10, 10, w-20, h-35), win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.ES_LEFT | win32con.ES_MULTILINE | win32con.WS_BORDER |win32con.ES_AUTOVSCROLL]) f.close() thanks -mab -------------- next part -------------- An HTML attachment was scrubbed... URL: From shahmed at sfwmd.gov Thu Aug 14 17:50:57 2008 From: shahmed at sfwmd.gov (Ahmed, Shakir) Date: Thu, 14 Aug 2008 11:50:57 -0400 Subject: [python-win32] help with parsing email Message-ID: Hi all, I do appreciate if any one can help me for my following problem: I need to grab/parse numeric numbers such as app number from incoming emails stored in Microsoft Outlook (Microsoft Exchange server) with specified subject line. Any help with the python script is highly appreciated. The email body is like this myregion ; tst ; 11-Aug-2008 http://my.xyz.com/dddd/content/ifs/apps/myDocFolder/NoticeOfapplication/ 080612-21_test_337683.pdf I need to extract 080612-21_ number from above line from incoming emails. Thanks sk -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Thu Aug 14 18:19:42 2008 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 14 Aug 2008 17:19:42 +0100 Subject: [python-win32] help with parsing email In-Reply-To: References: Message-ID: <48A45B1E.4080000@timgolden.me.uk> Ahmed, Shakir wrote: > I need to grab/parse numeric numbers such as app number from incoming > emails stored in Microsoft Outlook (Microsoft Exchange server) with > specified subject line. > The email body is like this > > > > myregion ; tst ; 11-Aug-2008 > > http://my.xyz.com/dddd/content/ifs/apps/myDocFolder/NoticeOfapplication/080612-21_test_337683.pdf > > I need to extract 080612-21 _ number from above line from incoming emails. > You're underspecifying this a bit. Are you asking for help with reading emails? Or with finding a number in a load of text? The answer to the first is: use COM to automate Outlook/CDO. The answer to the second is probably to use a simple regex. Unless the format is so simply specified that you can just use split () and string slicing. TJG From nytrokiss at gmail.com Thu Aug 14 18:25:30 2008 From: nytrokiss at gmail.com (James Matthews) Date: Thu, 14 Aug 2008 09:25:30 -0700 Subject: [python-win32] help with parsing email In-Reply-To: <48A45B1E.4080000@timgolden.me.uk> References: <48A45B1E.4080000@timgolden.me.uk> Message-ID: <8a6b8e350808140925r6ca3a76esf0638e459741c647@mail.gmail.com> It seems very simple split it and then rfind to the first slash and slice the rest. On Thu, Aug 14, 2008 at 9:19 AM, Tim Golden wrote: > Ahmed, Shakir wrote: > >> I need to grab/parse numeric numbers such as app number from incoming >> emails stored in Microsoft Outlook (Microsoft Exchange server) with >> specified subject line. >> > > The email body is like this >> >> >> myregion ; tst ; 11-Aug-2008 >> >> >> http://my.xyz.com/dddd/content/ifs/apps/myDocFolder/NoticeOfapplication/080612-21_test_337683.pdf >> > > >> I need to extract 080612-21 _ number from above line from incoming emails. >> >> > You're underspecifying this a bit. Are you asking for > help with reading emails? Or with finding a number in > a load of text? > > > The answer to the first is: use COM to automate Outlook/CDO. > > The answer to the second is probably to use a simple regex. > Unless the format is so simply specified that you can > just use split () and string slicing. > > TJG > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- http://www.goldwatches.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From fepeacock at bulldoghome.com Sat Aug 16 12:46:50 2008 From: fepeacock at bulldoghome.com (Frank Peacock) Date: Sat, 16 Aug 2008 11:46:50 +0100 Subject: [python-win32] Problem with compiled .pyd file Message-ID: <003901c8ff8d$6418d600$2c4a8200$@com> Hello I am using Python 2.5.2 on Windows and cygwin to build a python extension. I have built the pygrib2 package using cygwin on Windows and I am experiencing a hanging on the import of the g2lib.pyd module. I have tried using cygwin's jasper library as well as self-built files of the jasper library using -mno-cygwin switch with cygwin. These two different approaches merely create different sized g2lib.pyd files: 171kb for cygwin library and 420kb for self-built. When I run setup.py I used the following syntax: python setup.py build -c mingw32. Both times the build was successful with the sole creation of the g2lib.pyd file. If I rather try python setup.py -c cygwin I get linker errors. I tested the module after build and the problem is that when I try to import the g2lib module it hangs. I was wondering whether there is a g2lib.lib file missing? I am not fluent with the full details of python but noticed that pyd files in the python packages had allied lib files. Could you please help me? Thanks Frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From rwupole at msn.com Sat Aug 16 17:31:48 2008 From: rwupole at msn.com (Roger Upole) Date: Sat, 16 Aug 2008 11:31:48 -0400 Subject: [python-win32] Re: PyCEdit issue Message-ID: Try opening the file in binary mode. In text mode, all the cr/lf's get automatically translated to '\n'. Roger From gagsl-py2 at yahoo.com.ar Mon Aug 18 12:43:02 2008 From: gagsl-py2 at yahoo.com.ar (Gabriel Genellina) Date: Mon, 18 Aug 2008 07:43:02 -0300 Subject: [python-win32] help with parsing email References: Message-ID: En Thu, 14 Aug 2008 12:50:57 -0300, Ahmed, Shakir escribi?: > I need to grab/parse numeric numbers such as app number from incoming > emails stored in Microsoft Outlook (Microsoft Exchange server) with > specified subject line. > > The email body is like this > > myregion ; tst ; 11-Aug-2008 > > http://my.xyz.com/dddd/content/ifs/apps/myDocFolder/NoticeOfapplication/080612-21_test_337683.pdf > > I need to extract 080612-21_ number from above line from incoming > emails. I can't help with the part dealing with Outlook - but once you retrieved the email body, it's easy: import re re_number = re.compile(r"NoticeOfapplication/([0-9-_]+)") match = re_number.search(body) if match: print match.group(1) (this matches any numbers plus "-" and "_" after the words NoticeOfapplication written exactly that way) -- Gabriel Genellina From mbelzile at softimage.com Mon Aug 18 15:11:10 2008 From: mbelzile at softimage.com (=?iso-8859-1?Q?Marc-Andr=E9_Belzile?=) Date: Mon, 18 Aug 2008 09:11:10 -0400 Subject: [python-win32] PyCEdit issue In-Reply-To: References: Message-ID: <0BCB4AE868D8934A8B3DCE3A58126A890283FB42@tewk-mbpf3> Ok that works. Is it a limitation with the windows control or PyCEdit? Thanks -mab -----Original Message----- From: python-win32-bounces+mbelzile=softimage.com at python.org [mailto:python-win32-bounces+mbelzile=softimage.com at python.org] On Behalf Of Roger Upole Sent: Saturday, August 16, 2008 11:32 AM To: python-win32 at python.org Subject: [python-win32] Re: PyCEdit issue Try opening the file in binary mode. In text mode, all the cr/lf's get automatically translated to '\n'. Roger _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From shahmed at sfwmd.gov Mon Aug 18 17:24:07 2008 From: shahmed at sfwmd.gov (Ahmed, Shakir) Date: Mon, 18 Aug 2008 11:24:07 -0400 Subject: [python-win32] help with parsing email In-Reply-To: References: Message-ID: Thanks everyone who tried to help me to parse incoming email from an exchange server: Now, I am getting following error; I am not sure where I am doing wrong. I appreciate any help how to resolve this error and extract emails from an exchange server. First I tried: >>> mailserver = 'EXCHVS01.my.org' >>> mailuser = 'myname' >>> mailpasswd = 'mypass' >>> mailserver = poplib.POP3(mailserver) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\poplib.py", line 96, in __init__ raise socket.error, msg error: (10061, 'Connection refused') The other way: >>> mailserver = 'pop.EXCHVS01.ad.my.org' >>> mailuser = 'myname at my.org' >>> mailpasswd = 'mypass' >>> mailserver = poplib.POP3(mailserver) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\poplib.py", line 84, in __init__ for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): gaierror: (11001, 'getaddrinfo failed') I tried above ways but getting error Thanks sk -----Original Message----- From: python-list-bounces+shahmed=sfwmd.gov at python.org [mailto:python-list-bounces+shahmed=sfwmd.gov at python.org] On Behalf Of Gabriel Genellina Sent: Monday, August 18, 2008 6:43 AM To: python-list at python.org Cc: python-win32 at python.org Subject: Re: help with parsing email En Thu, 14 Aug 2008 12:50:57 -0300, Ahmed, Shakir escribi?: > I need to grab/parse numeric numbers such as app number from incoming > emails stored in Microsoft Outlook (Microsoft Exchange server) with > specified subject line. > > The email body is like this > > myregion ; tst ; 11-Aug-2008 > > http://my.xyz.com/dddd/content/ifs/apps/myDocFolder/NoticeOfapplication/080612-21_test_337683.pdf > > I need to extract 080612-21_ number from above line from incoming > emails. Help from Maric Michaud [maric at aristote.info] Three options here : - dealing directly with outlook mailboxes files, I used some open source code to parse .pst files in past, but you'll need some googling to match your requirements. Doesn't help if there is an instance of outlook running on the box. - use the outlook COM or even some windows MAPI interface via WIN32 API (pywin32), can't help with this one. - access emails directly on the Exchange server via standard python modules poplib or imaplib, my preferred choice if one of these protocols are supported by your environment. You won't need no extensions, just a standard python installation, and your code will work with most mail delivery agent and will run on all python supported platform. ========================== Help from Gabriel Genellina I can't help with the part dealing with Outlook - but once you retrieved the email body, it's easy: import re re_number = re.compile(r"NoticeOfapplication/([0-9-_]+)") match = re_number.search(body) if match: print match.group(1) (this matches any numbers plus "-" and "_" after the words NoticeOfapplication written exactly that way) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list From shahmed at sfwmd.gov Mon Aug 18 19:42:03 2008 From: shahmed at sfwmd.gov (Ahmed, Shakir) Date: Mon, 18 Aug 2008 13:42:03 -0400 Subject: [python-win32] help with parsing email In-Reply-To: References: Message-ID: -----Original Message----- From: python-list-bounces+shahmed=sfwmd.gov at python.org [mailto:python-list-bounces+shahmed=sfwmd.gov at python.org] On Behalf Of Werner F. Bruhin Sent: Monday, August 18, 2008 1:04 PM To: python-list at python.org Cc: python-win32 at python.org Subject: Re: help with parsing email Ahmed, Shakir wrote: > Thanks everyone who tried to help me to parse incoming email from an exchange server: > > Now, I am getting following error; I am not sure where I am doing wrong. I appreciate any help how to resolve this error and extract emails from an exchange server. > > > First I tried: >>>> mailserver = 'EXCHVS01.my.org' >>>> mailuser = 'myname' >>>> mailpasswd = 'mypass' >>>> mailserver = poplib.POP3(mailserver) > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\poplib.py", line 96, in __init__ > raise socket.error, msg > error: (10061, 'Connection refused') > > > > The other way: > >>>> mailserver = 'pop.EXCHVS01.ad.my.org' >>>> mailuser = 'myname at my.org' >>>> mailpasswd = 'mypass' >>>> mailserver = poplib.POP3(mailserver) > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\poplib.py", line 84, in __init__ > for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): > gaierror: (11001, 'getaddrinfo failed') Haven't used poplib myself, but was intrigued. Did you see this: http://www.python.org/doc/lib/pop3-example.html To me it looks like you are not setting the user/password. So, maybe something like: M = poplib.POP3(mailserver) M.user(mailuser) M.pass_(mailpasswd) .... Werner -- but I am getting error before that point and could not go to the user account or pass. M = poplib.POP3(mailserver) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\poplib.py", line 96, in __init__ raise socket.error, msg error: (10061, 'Connection refused') From timr at probo.com Mon Aug 18 21:15:00 2008 From: timr at probo.com (Tim Roberts) Date: Mon, 18 Aug 2008 12:15:00 -0700 Subject: [python-win32] Play MP3s from Windows, Just Works In-Reply-To: References: <91882ea90808120026s70f51a35wa784dae81a53a37c@mail.gmail.com> Message-ID: <48A9CA34.4050503@probo.com> Vernon Cole wrote: > As always, remember that mp3 is proprietary, and the owner has shown > willingness to be nasty about licensing it. Therefore, anything that > is "easy to install" is possibly illegal and/or will open you to a > lawsuit. If you are doing new work, better to use ogg. That statement is not technically correct. MP3 is not proprietary, and the format is not "owned" by any one organization or individual. It is an ISO standard. Several institutions do claim to own patents that cover MP3, just as with all of the MPEG standards. Many of the patent holders have already said they will not assert their patent rights on free and/or open source decoders and encoders. However, you are correct to point out that the legal situation is murky. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Mon Aug 18 21:20:12 2008 From: timr at probo.com (Tim Roberts) Date: Mon, 18 Aug 2008 12:20:12 -0700 Subject: [python-win32] GetModuleFileName requires Process or Thread handle? In-Reply-To: References: Message-ID: <48A9CB6C.5020406@probo.com> Walter Decker wrote: > Hello, > > Can someone help me diagnose why the following fails to retrieve the > 'exe' name KillByName? > ... > for pid in processList: > try: > print "KillByName pid: " + str(pid) > handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, > False, pid) > print "KillByName handle: " + str(handle) > exe = win32api.GetModuleFileName(handle) > ... > Is a handle a handle a handle? The win32api.CreateProcess that started > the process returns two (2) handles (hProcess and hThread) and the > OpenProcess > call above returns the second of those two handles (the hThread). Is > it that I need the 'other' handle as in: > "The result is a tuple of (hProcess, hThread, dwProcessId, dwThreadId)" > to send to win32api.GetModuleFileName(handle)? No, handles are not interchangable. Window handles, process handles, thread handles, file handles, event handles, registry handles, and module handles are all completely different spaces. GetModuleFileName requires an HMODULE -- a handle to a module. In fact, an HMODULE is actually just the virtual address where the module is loaded *within your own process*. (The module handle of your main executable is 0x00400000). You cannot call GetModuleFileName across processes. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Mon Aug 18 22:29:48 2008 From: timr at probo.com (Tim Roberts) Date: Mon, 18 Aug 2008 13:29:48 -0700 Subject: [python-win32] help with parsing email In-Reply-To: References: Message-ID: <48A9DBBC.2000200@probo.com> Ahmed, Shakir wrote: > Thanks everyone who tried to help me to parse incoming email from an exchange server: > > Now, I am getting following error; I am not sure where I am doing wrong. I appreciate any help how to resolve this error and extract emails from an exchange server. > > > First I tried: > >>>> mailserver = 'EXCHVS01.my.org' >>>> mailuser = 'myname' >>>> mailpasswd = 'mypass' >>>> mailserver = poplib.POP3(mailserver) >>>> > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\poplib.py", line 96, in __init__ > raise socket.error, msg > error: (10061, 'Connection refused') > Are you absolutely sure that your Exchange server includes the POP gateway? Remember that Outlook communicates with Exchange through a custom set of protocols. The POP gateway is optional, and many corporate environments turn it off. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Mon Aug 18 22:29:58 2008 From: timr at probo.com (Tim Roberts) Date: Mon, 18 Aug 2008 13:29:58 -0700 Subject: [python-win32] PyCEdit issue In-Reply-To: <0BCB4AE868D8934A8B3DCE3A58126A890283FB42@tewk-mbpf3> References: <0BCB4AE868D8934A8B3DCE3A58126A890283FB42@tewk-mbpf3> Message-ID: <48A9DBC6.2030506@probo.com> Marc-Andr? Belzile wrote: > Ok that works. Is it a limitation with the windows control or PyCEdit? > The Windows multi-line edit control requires \r\n between lines. If that's what PyCEdit uses, then that's where it comes from. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From gagsl-py2 at yahoo.com.ar Tue Aug 19 04:36:03 2008 From: gagsl-py2 at yahoo.com.ar (Gabriel Genellina) Date: Mon, 18 Aug 2008 23:36:03 -0300 Subject: [python-win32] help with parsing email References: Message-ID: En Mon, 18 Aug 2008 12:24:07 -0300, Ahmed, Shakir escribi?: > Thanks everyone who tried to help me to parse incoming email from an exchange server: > > Now, I am getting following error; I am not sure where I am doing wrong. I appreciate any help how to resolve this error and extract emails from an exchange server. > > > First I tried: >>>> mailserver = 'EXCHVS01.my.org' >>>> mailuser = 'myname' >>>> mailpasswd = 'mypass' >>>> mailserver = poplib.POP3(mailserver) > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\poplib.py", line 96, in __init__ > raise socket.error, msg > error: (10061, 'Connection refused') The code looks right - this isn't a Python problem. Ask your administrator, or look into your Outlook configuration and try to reproduce exactly those settings, including server name and port. >>>> mailserver = 'pop.EXCHVS01.ad.my.org' >>>> mailuser = 'myname at my.org' >>>> mailpasswd = 'mypass' >>>> mailserver = poplib.POP3(mailserver) > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\poplib.py", line 84, in __init__ > for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): > gaierror: (11001, 'getaddrinfo failed') Probably pop.EXCHVS01.ad.my.org doesn't exist. -- Gabriel Genellina From gagsl-py2 at yahoo.com.ar Tue Aug 19 04:36:03 2008 From: gagsl-py2 at yahoo.com.ar (Gabriel Genellina) Date: Mon, 18 Aug 2008 23:36:03 -0300 Subject: [python-win32] help with parsing email References: Message-ID: En Mon, 18 Aug 2008 12:24:07 -0300, Ahmed, Shakir escribi?: > Thanks everyone who tried to help me to parse incoming email from an exchange server: > > Now, I am getting following error; I am not sure where I am doing wrong. I appreciate any help how to resolve this error and extract emails from an exchange server. > > > First I tried: >>>> mailserver = 'EXCHVS01.my.org' >>>> mailuser = 'myname' >>>> mailpasswd = 'mypass' >>>> mailserver = poplib.POP3(mailserver) > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\poplib.py", line 96, in __init__ > raise socket.error, msg > error: (10061, 'Connection refused') The code looks right - this isn't a Python problem. Ask your administrator, or look into your Outlook configuration and try to reproduce exactly those settings, including server name and port. >>>> mailserver = 'pop.EXCHVS01.ad.my.org' >>>> mailuser = 'myname at my.org' >>>> mailpasswd = 'mypass' >>>> mailserver = poplib.POP3(mailserver) > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\poplib.py", line 84, in __init__ > for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): > gaierror: (11001, 'getaddrinfo failed') Probably pop.EXCHVS01.ad.my.org doesn't exist. -- Gabriel Genellina From mdriscoll at co.marshall.ia.us Tue Aug 19 16:24:39 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Tue, 19 Aug 2008 09:24:39 -0500 Subject: [python-win32] help with parsing email In-Reply-To: References: Message-ID: <48AAD7A7.3090808@co.marshall.ia.us> Ahmed, Shakir wrote: > -----Original Message----- > From: python-list-bounces+shahmed=wmd.gov at python.org > [mailto:python-list-bounces+shahmed=wmd.gov at python.org] On Behalf Of > Werner F. Bruhin > Sent: Monday, August 18, 2008 1:04 PM > To: python-list at python.org > Cc: python-win32 at python.org > Subject: Re: help with parsing email > > Ahmed, Shakir wrote: > >> Thanks everyone who tried to help me to parse incoming email from an >> > exchange server: > >> Now, I am getting following error; I am not sure where I am doing >> > wrong. I appreciate any help how to resolve this error and extract > emails from an exchange server. > >> First I tried: >> >>>>> mailserver =EXCHVS01.my.org' >>>>> mailuser =myname' >>>>> mailpasswd =mypass' >>>>> mailserver =oplib.POP3(mailserver) >>>>> >> Traceback (most recent call last): >> File "", line 1, in ? >> File "C:\Python24\lib\poplib.py", line 96, in __init__ >> raise socket.error, msg >> error: (10061, 'Connection refused') >> >> >> >> The other way: >> >> >>>>> mailserver =pop.EXCHVS01.ad.my.org' >>>>> mailuser =myname at my.org' >>>>> mailpasswd =mypass' >>>>> mailserver =oplib.POP3(mailserver) >>>>> >> Traceback (most recent call last): >> File "", line 1, in ? >> File "C:\Python24\lib\poplib.py", line 84, in __init__ >> for res in socket.getaddrinfo(self.host, self.port, 0, >> > socket.SOCK_STREAM): > >> gaierror: (11001, 'getaddrinfo failed') >> > Haven't used poplib myself, but was intrigued. > > Did you see this: > http://www.python.org/doc/lib/pop3-example.html > > To me it looks like you are not setting the user/password. > > So, maybe something like: > > M =oplib.POP3(mailserver) > M.user(mailuser) > M.pass_(mailpasswd) > .... > > Werner > > -- > > but I am getting error before that point and could not go to the user > account or pass. > > M =oplib.POP3(mailserver) > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\poplib.py", line 96, in __init__ > raise socket.error, msg > error: (10061, 'Connection refused') > > > Some POP3 servers require secure connections too. I've dealt with one that had TLS enabled, so I had to use an external TLS Python module to connect to it. I would check Outlook's settings and see if it has SSL or TLS enabled. For more information, see: http://www.python.org/doc/lib/module-poplib.html http://trevp.net/tlslite/ ------------------- Mike Driscoll Blog: http://blog.pythonlibrary.org Python Extension Building Network: http://www.pythonlibrary.org From bgailer at gmail.com Tue Aug 19 16:04:25 2008 From: bgailer at gmail.com (bob gailer) Date: Tue, 19 Aug 2008 10:04:25 -0400 Subject: [python-win32] Watch window Message-ID: <48AAD2E9.4000201@gmail.com> Is there a way to have the watch window either stay open or open each time I start debugging? As it is now I have to open it each time. I seem to recall in the dim past that it would open automatically. Build 212 Python 2.5 Win 2003 Server. ------------------------------------ Thanks so much for the pointers regarding running a script at startup and moving/sizing windows. I now have 8 windows magically appearing each time I start PyWin. -- Bob Gailer Chapel Hill NC 919-636-4239 I now When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and trainer I can assist you in learning this process. What is YOUR biggest relationship challenge? From timr at probo.com Tue Aug 19 18:55:50 2008 From: timr at probo.com (Tim Roberts) Date: Tue, 19 Aug 2008 09:55:50 -0700 Subject: [python-win32] help with parsing email In-Reply-To: <48AAD7A7.3090808@co.marshall.ia.us> References: <48AAD7A7.3090808@co.marshall.ia.us> Message-ID: <48AAFB16.5080706@probo.com> Mike Driscoll wrote: > Ahmed, Shakir wrote: >> but I am getting error before that point and could not go to the user >> account or pass. >> >> M =oplib.POP3(mailserver) >> Traceback (most recent call last): >> File "", line 1, in ? >> File "C:\Python24\lib\poplib.py", line 96, in __init__ >> raise socket.error, msg >> error: (10061, 'Connection refused') >> >> >> > > Some POP3 servers require secure connections too. I've dealt with one > that had TLS enabled, so I had to use an external TLS Python module to > connect to it. I would check Outlook's settings and see if it has SSL > or TLS enabled. I thought I wrote this to the list, but I don't see it. Outlook and Exchange communicate through a private set of protocols. They do not use POP. The POP gateway is an optional extension for Exchange, and in many corporate environments it is disabled. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From savtech138 at gmail.com Tue Aug 19 21:30:00 2008 From: savtech138 at gmail.com (Russell Smith) Date: Tue, 19 Aug 2008 12:30:00 -0700 Subject: [python-win32] Change account email option Message-ID: <1eafab090808191230m4467ea7dtcce194fe672261b7@mail.gmail.com> Is there anyway you could change the email for my account ( savtech138 at gmail.com) to spam24hours at yahoo.com? I am getting way too many of these python win32 e-mails and I would like them redirected to my alt e-mail address. -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Aug 19 21:43:10 2008 From: timr at probo.com (Tim Roberts) Date: Tue, 19 Aug 2008 12:43:10 -0700 Subject: [python-win32] Change account email option In-Reply-To: <1eafab090808191230m4467ea7dtcce194fe672261b7@mail.gmail.com> References: <1eafab090808191230m4467ea7dtcce194fe672261b7@mail.gmail.com> Message-ID: <48AB224E.7090106@probo.com> Russell Smith wrote: > Is there anyway you could change the email for my account > (savtech138 at gmail.com ) to > spam24hours at yahoo.com ? I am getting way > too many of these python win32 e-mails and I would like them > redirected to my alt e-mail address "Way too many"? We rarely get more than 10 messages a day. There have only been 73 for the whole month of August. Do you know that you have the option of getting a "digest", where it only sends you one message per day? Follow the link at the bottom of each message to get to a place where you can set this up. Mailman doesn't provide a way to do simple renaming, other than running a shell command on the server itself. The easiest way is to unsubscribe the old and resubscribe the new. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From eruskin at valvesoftware.com Wed Aug 20 02:17:51 2008 From: eruskin at valvesoftware.com (Elan Ruskin) Date: Tue, 19 Aug 2008 17:17:51 -0700 Subject: [python-win32] UnicodeDecodeError in WMI interface (Py 2.5; US English XP) Message-ID: Hello, I've run into some trouble with the pywin32 WMI interface that seems to be due to unicode translation. I'm trying to read system environment variables using Microsoft's own example here: http://www.microsoft.com/technet/scriptcenter/scripts/python/desktop/exp lorer/dmexpy03.mspx?mfr=true However, the example fails with a UnicodeDecodeError exception as soon as I try to access an attribute on the WMIService. The problem appears to be in the __getattr__() on and not inside the WMI service itself. For example, the following code crashes: >>> import win32com.client >>> objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator") >>> objWMIService.ConnectServer Traceback (most recent call last): File "", line 1, in dir(objWMIService.ConnectServer) File "U:\dev\l4dbranch\game\sdktools\python\2.5\lib\site-packages\win32com\cl ient\dynamic.py", line 467, in __getattr__ (...) File "U:\dev\l4dbranch\game\sdktools\python\2.5\lib\site-packages\win32com\cl ient\build.py", line 542, in return filter( lambda char: char in valid_identifier_chars, className) UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 52: ordinal not in range(128) Googling around for this problem revealed another thread ( http://tinyurl.com/597pfp ) on the same issue, but no resolution or workaround. Do I need to put my Python in some sort of Unicode Mode or something? I can't seem to find any other documentation of what's going on here. I'm running plain US English XP, no international features installed. I'm using the stable Python 2.5 from python.org. Alternatively, does anyone know another convenient way I can read and set persistent SYSTEM and USER environment variables through Python? Thanks, Elan From rwupole at msn.com Wed Aug 20 04:20:24 2008 From: rwupole at msn.com (Roger Upole) Date: Tue, 19 Aug 2008 22:20:24 -0400 Subject: [python-win32] Re: UnicodeDecodeError in WMI interface (Py 2.5; Message-ID: Elan Ruskin wrote: > Hello, I've run into some trouble with the pywin32 WMI interface that > seems to be due to unicode translation. > > I'm trying to read system environment variables using Microsoft's own > example here: > http://www.microsoft.com/technet/scriptcenter/scripts/python/desktop/exp > lorer/dmexpy03.mspx?mfr=true > > However, the example fails with a UnicodeDecodeError exception as soon > as I try to access an attribute on the WMIService. The problem appears > to be in the __getattr__() on and > not inside the WMI service itself. For example, the following code > crashes: > >>>> import win32com.client >>>> objWMIService = > win32com.client.Dispatch("WbemScripting.SWbemLocator") >>>> objWMIService.ConnectServer > Traceback (most recent call last): > File "", line 1, in > dir(objWMIService.ConnectServer) > File > "U:\dev\l4dbranch\game\sdktools\python\2.5\lib\site-packages\win32com\cl > ient\dynamic.py", line 467, in __getattr__ > (...) > File > "U:\dev\l4dbranch\game\sdktools\python\2.5\lib\site-packages\win32com\cl > ient\build.py", line 542, in > return filter( lambda char: char in valid_identifier_chars, > className) > UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 52: > ordinal not in range(128) > > > Googling around for this problem revealed another thread ( > http://tinyurl.com/597pfp ) on the same issue, but no resolution or > workaround. > > Do I need to put my Python in some sort of Unicode Mode or something? I > can't seem to find any other documentation of what's going on here. > > I'm running plain US English XP, no international features installed. > I'm using the stable Python 2.5 from python.org. > > Alternatively, does anyone know another convenient way I can read and > set persistent SYSTEM and USER environment variables through Python? > > Thanks, > Elan This looks to be the same issue as bug 2009780: http://sourceforge.net/tracker/index.php?func=detail&aid=2009780&group_id=78018&atid=551954 It's due to the way Idle sets the locale. This is fixed in build 212. Roger From mani.sabri at gmail.com Wed Aug 20 14:41:39 2008 From: mani.sabri at gmail.com (mani sabri) Date: Wed, 20 Aug 2008 16:11:39 +0330 Subject: [python-win32] Memory leak when importing in embedded python Message-ID: <48ac031c.0d135e0a.256f.66d3@mx.google.com> Hi Importing some modules[2] in embedded python between Py_NewInterpreter and Py_EndInterpreter[1] cause memory leak. Not all the modules cause leaks (ex sys module) but most of them do! And none of them cause any leak when they are not embedded! What cause this? Is it solveable? Best regards, Mani Sabri --------------------------------------------------------------------------- [1]-embedded python for(;;) { PyThreadState* pInterpreter= Py_NewInterpreter(); PyObject* a = PyImport_ImportModule("clientc"); Py_EndInterpreter(pInterpreter); } ---------------------------------------------------------------------------- [2]-some module: #clientc.py import pywintypes, winerror from win32file import CreateFile,ReadFile,WriteFile,GENERIC_READ,GENERIC_WRITE,OPEN_EXISTING from win32pipe import PIPE_READMODE_MESSAGE,SetNamedPipeHandleState,PeekNamedPipe import ctypes import cPickle #the above imports will cause leak in embedded application! From mdriscoll at co.marshall.ia.us Wed Aug 20 17:48:26 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Wed, 20 Aug 2008 10:48:26 -0500 Subject: [python-win32] Getting a printer's port Message-ID: <48AC3CCA.9030000@co.marshall.ia.us> Hi all, I am in need of a way to get a printer's port with Python. I can get the name of a printer and the comments field (I think) using win32print.EnumPrinters(), but that's as close as I can get. Most of the printers in my organization are networked through Linux CUPS. Any pointers are appreciated. We have Python 2.4 and the script will run on Windows XP machines. Thanks! Mike From rwupole at msn.com Wed Aug 20 22:22:58 2008 From: rwupole at msn.com (Roger Upole) Date: Wed, 20 Aug 2008 16:22:58 -0400 Subject: [python-win32] Re: Getting a printer's port Message-ID: Mike Driscoll wrote: > Hi all, > > I am in need of a way to get a printer's port with Python. I can get the > name of a printer and the comments field (I think) using > win32print.EnumPrinters(), but that's as close as I can get. Most of the > printers in my organization are networked through Linux CUPS. > > Any pointers are appreciated. We have Python 2.4 and the script will run > on Windows XP machines. > > Thanks! > > Mike You should be able to get the port using data level 2. win32print.EnumPrinters(win32print.PRINTER_ENUM_NAME, None, 2) Roger From rwupole at msn.com Wed Aug 20 22:38:52 2008 From: rwupole at msn.com (Roger Upole) Date: Wed, 20 Aug 2008 16:38:52 -0400 Subject: [python-win32] Re: Watch window Message-ID: bob gailer wrote: > Is there a way to have the watch window either stay open or open each > time I start debugging? As it is now I have to open it each time. I seem > to recall in the dim past that it would open automatically. Build 212 > Python 2.5 Win 2003 Server. > Whoops, I think I accidentally removed that capability with the fix for the thousands of 'Toolbar.....' registry entries. I'll take a look at how to make it work again when I get some time. Roger From mhammond at skippinet.com.au Thu Aug 21 02:51:05 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 21 Aug 2008 10:51:05 +1000 Subject: [python-win32] Memory leak when importing in embedded python In-Reply-To: <48ac031c.0d135e0a.256f.66d3@mx.google.com> References: <48ac031c.0d135e0a.256f.66d3@mx.google.com> Message-ID: <014001c90328$00c97e30$025c7a90$@com.au> > Hi > Importing some modules[2] in embedded python between Py_NewInterpreter > and > Py_EndInterpreter[1] cause memory leak. Not all the modules cause leaks > (ex > sys module) but most of them do! And none of them cause any leak when > they > are not embedded! What cause this? Is it solveable? Its probably not solvable. Py3k, IIUC, has some changes to make it solveable, but even then you will be relying on each module doing the right thing. Google will show you *lots* of references to this problem. The simple answer is to not init/finalize Python multiple times. Mark From ferdinandsousa at gmail.com Thu Aug 21 14:36:42 2008 From: ferdinandsousa at gmail.com (Ferdinand Sousa) Date: Thu, 21 Aug 2008 18:06:42 +0530 Subject: [python-win32] makepy.py usage and COM Message-ID: Hi I have python 2.5.1, pywin32 build 212 When using the makepy utility I noticed it used to crash out with the following traceback: Traceback (most recent call last): File "C:\Python25\Lib\site-packages\win32com\client\makepy.py", line 391, in rc = main() File "C:\Python25\Lib\site-packages\win32com\client\makepy.py", line 370, in main rc = selecttlb.SelectTlb() File "C:\Python25\Lib\site-packages\win32com\client\selecttlb.py", line 148, in SelectTlb i.major = int(i.major, 16) ValueError: invalid literal for int() with base 16: 'CS2' Most likely this (last line of traceback) refers to the version number of Adobe Photoshop Creative Suite 2. I put the offending code in a try block and used an except block to throw out the offending item. for i in items: try: i.major = int(i.major, 16) i.minor = int(i.minor, 16) except: print "the Object is",i print i.major print i.minor This works fine since what I actually wanted was the Word type library. I just wanted to point out this so that it can be corrected (if it is indeed a bug) to accommodate non numeric version numbers in future builds. I just wanted pointers on how to see the methods/objects/constants available in the Word COM object. Any links, PDFs on COM in Python will also be useful. Many thanks and regards, Ferdi From mdriscoll at co.marshall.ia.us Thu Aug 21 15:15:53 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Thu, 21 Aug 2008 08:15:53 -0500 Subject: [python-win32] Getting a printer's port In-Reply-To: References: Message-ID: <48AD6A89.7080205@co.marshall.ia.us> Roger Upole wrote: >> Hi all, >> >> I am in need of a way to get a printer's port with Python. I can get >> the name of a printer and the comments field (I think) using >> win32print.EnumPrinters(), but that's as close as I can get. Most of >> the printers in my organization are networked through Linux CUPS. >> >> Any pointers are appreciated. We have Python 2.4 and the script will >> run on Windows XP machines. >> >> Thanks! >> >> Mike > > You should be able to get the port using data level 2. > > win32print.EnumPrinters(win32print.PRINTER_ENUM_NAME, None, 2) > > Roger > > Roger, Thanks for the quick response. This does work! I was doing almost exactly the same thing, but I wasn't passing the "PRINTER_ENUM_NAME" flag. I guess that's what adds the additional information. Thanks again, Mike From patrick at raptr.com Thu Aug 21 20:50:27 2008 From: patrick at raptr.com (Patrick Li) Date: Thu, 21 Aug 2008 11:50:27 -0700 Subject: [python-win32] Detect if user has a window opened in full screen mode? Message-ID: <2b5a48740808211150m2df84778h1faf5c9923c784cf@mail.gmail.com> Hi, Is there a way I can detect whether or not the user has any window that is running in full screen mode? (Playing a game that takes up the entire screen, or having the browser maximized, etc) Thanks, Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinaya at adobe.com Thu Aug 21 22:08:12 2008 From: vinaya at adobe.com (Vinay Anantharaman) Date: Thu, 21 Aug 2008 13:08:12 -0700 Subject: [python-win32] win32Com.gencache.EnsureDispatch Problems Message-ID: <0DAF2B31FBCEB6439F63FA7F91601F740357E90E@namail3.corp.adobe.com> Hi, I executed the following code on a Windows Vista 64 bit machine with Python 2.4.2 and the latest win32com: from win32com.client import gencache try: outlook = gencache.EnsureDispatch("Outlook.Application") except TypeError: print "uh-oh" Result: Traceback (most recent call last): File "", line 4, in ? File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 537, in EnsureDispatch GetModuleForCLSID(disp_clsid) File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 240, in GetModuleForCLSID makepy.GenerateChildFromTypeLibSpec(sub_mod, info) File "C:\Python24\Lib\site-packages\win32com\client\makepy.py", line 325, in GenerateChildFromTypeLibSpec __import__("win32com.gen_py." + dir_name + "." + child) File "C:\Users\vinaya\AppData\Local\Temp\gen_py\2.4\00062FFF-0000-0000-C000-0 00000000046x0x9x3\_Application.py", line 78 ret = Dispatch(ret, u'CreateItemFromTemplate', None, UnicodeToString=0)^M return ret SyntaxError: invalid syntax I can makepy on the Outlook Com library manually however, I'd prefer to use the EnsureDispatch function. Thank you, Vinay Anantharaman -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Aug 21 22:49:54 2008 From: timr at probo.com (Tim Roberts) Date: Thu, 21 Aug 2008 13:49:54 -0700 Subject: [python-win32] Detect if user has a window opened in full screen mode? In-Reply-To: <2b5a48740808211150m2df84778h1faf5c9923c784cf@mail.gmail.com> References: <2b5a48740808211150m2df84778h1faf5c9923c784cf@mail.gmail.com> Message-ID: <48ADD4F2.6070503@probo.com> Patrick Li wrote: > > Is there a way I can detect whether or not the user has any window > that is running in full screen mode? (Playing a game that takes up the > entire screen, or having the browser maximized, etc) Why on earth would you care? I don't know of any API that can answer this question. Note that DirectX games use a very different method of going fullscreen than maximized applications. For maximized applications, you could enumerate through all of the top-level windows and find their window rectangles. For DirectX games, that wouldn't work. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mhammond at skippinet.com.au Fri Aug 22 01:08:28 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 22 Aug 2008 09:08:28 +1000 Subject: [python-win32] win32Com.gencache.EnsureDispatch Problems In-Reply-To: <0DAF2B31FBCEB6439F63FA7F91601F740357E90E@namail3.corp.adobe.com> References: <0DAF2B31FBCEB6439F63FA7F91601F740357E90E@namail3.corp.adobe.com> Message-ID: <022a01c903e2$d5a54480$80efcd80$@com.au> Strange - I can't repro this on my outlook box (my Vista 64 box doesn't have Outlook). It looks like a ^M character ended up in the file in place or the line ending we expect. Do you have any idea what could cause this? Could you please open the generated file in a text editor and see if it is only the one line with the strange line endings, or is there something else causing the error? Thanks Mark From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of Vinay Anantharaman Sent: Friday, 22 August 2008 6:08 AM To: python-win32 at python.org Subject: [python-win32] win32Com.gencache.EnsureDispatch Problems Hi, I executed the following code on a Windows Vista 64 bit machine with Python 2.4.2 and the latest win32com: from win32com.client import gencache try: outlook = gencache.EnsureDispatch("Outlook.Application") except TypeError: print "uh-oh" Result: Traceback (most recent call last): File "", line 4, in ? File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 537, in EnsureDispatch GetModuleForCLSID(disp_clsid) File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 240, in GetModuleForCLSID makepy.GenerateChildFromTypeLibSpec(sub_mod, info) File "C:\Python24\Lib\site-packages\win32com\client\makepy.py", line 325, in GenerateChildFromTypeLibSpec __import__("win32com.gen_py." + dir_name + "." + child) File "C:\Users\vinaya\AppData\Local\Temp\gen_py\2.4\00062FFF-0000-0000-C000-00000 0000046x0x9x3\_Application.py", line 78 ret = Dispatch(ret, u'CreateItemFromTemplate', None, UnicodeToString=0)^M return ret SyntaxError: invalid syntax I can makepy on the Outlook Com library manually however, I'd prefer to use the EnsureDispatch function. Thank you, Vinay Anantharaman -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Fri Aug 22 01:08:28 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 22 Aug 2008 09:08:28 +1000 Subject: [python-win32] makepy.py usage and COM In-Reply-To: References: Message-ID: <023801c903e2$d8327f10$88977d30$@com.au> > I have python 2.5.1, pywin32 build 212 > > When using the makepy utility I noticed it used to crash out with the > following traceback: Ouch - that is a bug in the typelib dialog - I've opened an issue at http://sourceforge.net/tracker/index.php?func=detail&aid=2065850&group_id=78 018&atid=551954 > I just wanted pointers on how to see the methods/objects/constants > available in the Word COM object. > Any links, PDFs on COM in Python will also be useful. The best docs around for the Word object model will not mention Python at all, but especially if you are armed with the makepy generated file, it should be easy to "port" things to Python. Hopefully others on this list will have more concrete advice... Cheers, Mark From vinaya at adobe.com Fri Aug 22 01:33:19 2008 From: vinaya at adobe.com (Vinay Anantharaman) Date: Thu, 21 Aug 2008 16:33:19 -0700 Subject: [python-win32] win32Com.gencache.EnsureDispatch Problems In-Reply-To: <022a01c903e2$d5a54480$80efcd80$@com.au> References: <0DAF2B31FBCEB6439F63FA7F91601F740357E90E@namail3.corp.adobe.com> <022a01c903e2$d5a54480$80efcd80$@com.au> Message-ID: <0DAF2B31FBCEB6439F63FA7F91601F740357E9BF@namail3.corp.adobe.com> Hi, I was using xemacs as my editor and the internal shell to run the commands. I manually entered ^M into my last post to illustrate the error as I saw in XEmacs. I retried and used cmd.exe to run it and I receive the same error but the "^M" character does not show. I have opened it in another editor and I don't see the improper line ending. I'm honestly not sure what to do. I have zipped up the generated code and placed it here http://briefcase.yahoo.com/vinayan3 , go to the Public folders and it is called Python Problems. Vinay From: Mark Hammond [mailto:skippy.hammond at gmail.com] On Behalf Of Mark Hammond Sent: Thursday, August 21, 2008 16:08 To: Vinay Anantharaman; python-win32 at python.org Subject: RE: [python-win32] win32Com.gencache.EnsureDispatch Problems Strange - I can't repro this on my outlook box (my Vista 64 box doesn't have Outlook). It looks like a ^M character ended up in the file in place or the line ending we expect. Do you have any idea what could cause this? Could you please open the generated file in a text editor and see if it is only the one line with the strange line endings, or is there something else causing the error? Thanks Mark From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of Vinay Anantharaman Sent: Friday, 22 August 2008 6:08 AM To: python-win32 at python.org Subject: [python-win32] win32Com.gencache.EnsureDispatch Problems Hi, I executed the following code on a Windows Vista 64 bit machine with Python 2.4.2 and the latest win32com: from win32com.client import gencache try: outlook = gencache.EnsureDispatch("Outlook.Application") except TypeError: print "uh-oh" Result: Traceback (most recent call last): File "", line 4, in ? File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 537, in EnsureDispatch GetModuleForCLSID(disp_clsid) File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 240, in GetModuleForCLSID makepy.GenerateChildFromTypeLibSpec(sub_mod, info) File "C:\Python24\Lib\site-packages\win32com\client\makepy.py", line 325, in GenerateChildFromTypeLibSpec __import__("win32com.gen_py." + dir_name + "." + child) File "C:\Users\vinaya\AppData\Local\Temp\gen_py\2.4\00062FFF-0000-0000-C000-0 00000000046x0x9x3\_Application.py", line 78 ret = Dispatch(ret, u'CreateItemFromTemplate', None, UnicodeToString=0)^M return ret SyntaxError: invalid syntax I can makepy on the Outlook Com library manually however, I'd prefer to use the EnsureDispatch function. Thank you, Vinay Anantharaman -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Fri Aug 22 01:49:10 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 22 Aug 2008 09:49:10 +1000 Subject: [python-win32] win32Com.gencache.EnsureDispatch Problems In-Reply-To: <0DAF2B31FBCEB6439F63FA7F91601F740357E9BF@namail3.corp.adobe.com> References: <0DAF2B31FBCEB6439F63FA7F91601F740357E90E@namail3.corp.adobe.com> <022a01c903e2$d5a54480$80efcd80$@com.au> <0DAF2B31FBCEB6439F63FA7F91601F740357E9BF@namail3.corp.adobe.com> Message-ID: <027901c903e8$84c5a090$8e50e1b0$@com.au> I get an error from yahoo: No shared folders are available. Sorry, the owner has not enabled any shared folders in their account. Mark ---- From: python-win32-bounces+skippy.hammond=gmail.com at python.org [mailto:python-win32-bounces+skippy.hammond=gmail.com at python.org] On Behalf Of Vinay Anantharaman Sent: Friday, 22 August 2008 9:33 AM To: mhammond at skippinet.com.au; python-win32 at python.org Subject: Re: [python-win32] win32Com.gencache.EnsureDispatch Problems Hi, I was using xemacs as my editor and the internal shell to run the commands. I manually entered ^M into my last post to illustrate the error as I saw in XEmacs. ?I retried and used cmd.exe to run it and I receive the same error but the ?^M? character does not show. I have opened it in another editor and I don?t see the improper line ending. I?m honestly not sure what to do. I have zipped up the generated code and placed it here http://briefcase.yahoo.com/vinayan3 , go to the Public folders and it is called Python Problems. Vinay From: Mark Hammond [mailto:skippy.hammond at gmail.com] On Behalf Of Mark Hammond Sent: Thursday, August 21, 2008 16:08 To: Vinay Anantharaman; python-win32 at python.org Subject: RE: [python-win32] win32Com.gencache.EnsureDispatch Problems Strange - I can't repro this on my outlook box (my Vista 64 box doesn't have Outlook).? It looks like a ^M character ended up in the file in place or the line ending we expect.? Do you have any idea what could cause this?? Could you please open the generated file in a text editor and see if it is only the one line with the strange line ?endings, or is there something else causing the error? Thanks Mark From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of Vinay Anantharaman Sent: Friday, 22 August 2008 6:08 AM To: python-win32 at python.org Subject: [python-win32] win32Com.gencache.EnsureDispatch Problems Hi, I executed the following code on a Windows Vista 64 bit machine with Python 2.4.2 and the latest win32com: ??????????? from win32com.client import gencache try: ??? outlook = gencache.EnsureDispatch("Outlook.Application") except TypeError: ??? print "uh-oh" Result: Traceback (most recent call last): ? File "", line 4, in ? ? File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 537, in EnsureDispatch ??? GetModuleForCLSID(disp_clsid) ? File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 240, in GetModuleForCLSID ??? makepy.GenerateChildFromTypeLibSpec(sub_mod, info) ? File "C:\Python24\Lib\site-packages\win32com\client\makepy.py", line 325, in GenerateChildFromTypeLibSpec ??? __import__("win32com.gen_py." + dir_name + "." + child) ? File "C:\Users\vinaya\AppData\Local\Temp\gen_py\2.4\00062FFF-0000-0000-C000-00000 0000046x0x9x3\_Application.py", line 78 ??? ret = Dispatch(ret, u'CreateItemFromTemplate', None, UnicodeToString=0)^M?????????????? return ret ????????????????????????????????????? ????????????????????????????????????? SyntaxError: invalid syntax I can makepy on the Outlook Com library manually however, I?d prefer to use the EnsureDispatch function. Thank you, Vinay Anantharaman From vinaya at adobe.com Fri Aug 22 01:52:13 2008 From: vinaya at adobe.com (Vinay Anantharaman) Date: Thu, 21 Aug 2008 16:52:13 -0700 Subject: [python-win32] win32Com.gencache.EnsureDispatch Problems In-Reply-To: <027901c903e8$84c5a090$8e50e1b0$@com.au> References: <0DAF2B31FBCEB6439F63FA7F91601F740357E90E@namail3.corp.adobe.com> <022a01c903e2$d5a54480$80efcd80$@com.au> <0DAF2B31FBCEB6439F63FA7F91601F740357E9BF@namail3.corp.adobe.com> <027901c903e8$84c5a090$8e50e1b0$@com.au> Message-ID: <0DAF2B31FBCEB6439F63FA7F91601F740357E9CF@namail3.corp.adobe.com> Yahoo does not allow my folder to be public. I'm at a loss to make it available to everyone. Mark I will send it to you personally(Really appericated). -----Original Message----- From: Mark Hammond [mailto:skippy.hammond at gmail.com] On Behalf Of Mark Hammond Sent: Thursday, August 21, 2008 16:49 To: Vinay Anantharaman; python-win32 at python.org Subject: RE: [python-win32] win32Com.gencache.EnsureDispatch Problems I get an error from yahoo: No shared folders are available. Sorry, the owner has not enabled any shared folders in their account. Mark ---- From: python-win32-bounces+skippy.hammond=gmail.com at python.org [mailto:python-win32-bounces+skippy.hammond=gmail.com at python.org] On Behalf Of Vinay Anantharaman Sent: Friday, 22 August 2008 9:33 AM To: mhammond at skippinet.com.au; python-win32 at python.org Subject: Re: [python-win32] win32Com.gencache.EnsureDispatch Problems Hi, I was using xemacs as my editor and the internal shell to run the commands. I manually entered ^M into my last post to illustrate the error as I saw in XEmacs. ?I retried and used cmd.exe to run it and I receive the same error but the "^M" character does not show. I have opened it in another editor and I don't see the improper line ending. I'm honestly not sure what to do. I have zipped up the generated code and placed it here http://briefcase.yahoo.com/vinayan3 , go to the Public folders and it is called Python Problems. Vinay From: Mark Hammond [mailto:skippy.hammond at gmail.com] On Behalf Of Mark Hammond Sent: Thursday, August 21, 2008 16:08 To: Vinay Anantharaman; python-win32 at python.org Subject: RE: [python-win32] win32Com.gencache.EnsureDispatch Problems Strange - I can't repro this on my outlook box (my Vista 64 box doesn't have Outlook).? It looks like a ^M character ended up in the file in place or the line ending we expect.? Do you have any idea what could cause this?? Could you please open the generated file in a text editor and see if it is only the one line with the strange line ?endings, or is there something else causing the error? Thanks Mark From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of Vinay Anantharaman Sent: Friday, 22 August 2008 6:08 AM To: python-win32 at python.org Subject: [python-win32] win32Com.gencache.EnsureDispatch Problems Hi, I executed the following code on a Windows Vista 64 bit machine with Python 2.4.2 and the latest win32com: ??????????? from win32com.client import gencache try: ??? outlook = gencache.EnsureDispatch("Outlook.Application") except TypeError: ??? print "uh-oh" Result: Traceback (most recent call last): ? File "", line 4, in ? ? File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 537, in EnsureDispatch ??? GetModuleForCLSID(disp_clsid) ? File "C:\Python24\Lib\site-packages\win32com\client\gencache.py", line 240, in GetModuleForCLSID ??? makepy.GenerateChildFromTypeLibSpec(sub_mod, info) ? File "C:\Python24\Lib\site-packages\win32com\client\makepy.py", line 325, in GenerateChildFromTypeLibSpec ??? __import__("win32com.gen_py." + dir_name + "." + child) ? File "C:\Users\vinaya\AppData\Local\Temp\gen_py\2.4\00062FFF-0000-0000-C000-00000 0000046x0x9x3\_Application.py", line 78 ??? ret = Dispatch(ret, u'CreateItemFromTemplate', None, UnicodeToString=0)^M?????????????? return ret ????????????????????????????????????? ????????????????????????????????????? SyntaxError: invalid syntax I can makepy on the Outlook Com library manually however, I'd prefer to use the EnsureDispatch function. Thank you, Vinay Anantharaman From drorco at gmail.com Sat Aug 23 18:03:19 2008 From: drorco at gmail.com (Dror Cohen) Date: Sat, 23 Aug 2008 19:03:19 +0300 Subject: [python-win32] How can I use GetKeyboardLayout in python? Message-ID: <884670ce0808230903m512b5812t50cccd77b0b72aaf@mail.gmail.com> Hi everybody, for a long time I'm trying to get my current typing language in windows. At the moment I'm thinking about using either GetKeyboardLayout or ITfInputProcessorProfiles that holds the *GetCurrentLanguagefunction. It seems that using GetKeyboardLayout will be a lot easier but I just can't find this function in the win32api functions list. The most similar function I can use in PythonWin when importing win32api is GetKeyboardLayoutList which gets me the list of installed languages on Windows but not the current language. You've got no Idea how glad I will be if you guys could help me. Thanks!* -------------- next part -------------- An HTML attachment was scrubbed... URL: From siddhartha.veedaluru at gmail.com Sun Aug 24 14:53:17 2008 From: siddhartha.veedaluru at gmail.com (siddhartha veedaluru) Date: Sun, 24 Aug 2008 18:23:17 +0530 Subject: [python-win32] Created Map NetWork Drive is not visible in "My Computer" window Message-ID: <424b71ec0808240553j502bed57pef5b4b69d9a1f533@mail.gmail.com> Hi, i have used the following code to create Map NetWork Drive. But it is not visble when i open "My Computer" window. --------------------------------------------------------------------------- import win32net,time data = {} data['remote'] = r'\\fredo\Project' data['local'] = 'K:' data['user'] = 'builder' data['password'] = 'builder' data['asg_type'] = 0 data['status'] = 1 data['domainname'] = 'conindia' win32net.NetUseAdd(None,1,data) ----------------------------------------------------------------------- Help me in making it visible. Regards, Siddhartha -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdriscoll at co.marshall.ia.us Mon Aug 25 16:01:12 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 25 Aug 2008 09:01:12 -0500 Subject: [python-win32] Created Map NetWork Drive is not visible in "My Computer" window In-Reply-To: <424b71ec0808240553j502bed57pef5b4b69d9a1f533@mail.gmail.com> References: <424b71ec0808240553j502bed57pef5b4b69d9a1f533@mail.gmail.com> Message-ID: <48B2BB28.3000002@co.marshall.ia.us> siddhartha veedaluru wrote: > Hi, > > i have used the following code to create Map NetWork Drive. > But it is not visble when i open "My Computer" window. > > --------------------------------------------------------------------------- > import win32net,time > data = {} > data['remote'] = r'\\fredo\Project' > data['local'] = 'K:' > data['user'] = 'builder' > data['password'] = 'builder' > data['asg_type'] = 0 > data['status'] = 1 > data['domainname'] = 'conindia' > win32net.NetUseAdd(None,1,data) > ----------------------------------------------------------------------- > > Help me in making it visible. > > Regards, > Siddhartha I recommend this method instead: import win32wnet from win32netcon import RESOURCETYPE_DISK as DISK drive_letter = "K:" path = "\\fredo\Project" win32wnet.WNetAddConnection2(DISK, drive_letter, path) We use this method at my place of employment as part of our login script. Mike From mkesper at fsfe.org Mon Aug 25 16:30:47 2008 From: mkesper at fsfe.org (Michael Kesper) Date: Mon, 25 Aug 2008 16:30:47 +0200 Subject: [python-win32] Accessing properties of share on DFS Message-ID: <20080825143047.GD13124@localhost> Hi, Until now I'm using win32net.NetSessionEnum to list sessions users have open. Now homes will be migrated to Distributed Filesystem (DFS). As far as I understood msdn I should access that via win32wnet. But now, I have some troubles to figure out how this really works. The following script gives me an error 87, "wrong parameter" at the call of WNetOpenEnum: import win32wnet import winnetwk res = win32wnet.NETRESOURCE() res.lpRemoteName = r'\\USERS.MYCOMPANY.NET\HOME\USERNAME' res.lpProvider = 'Microsoft Windows Network' handle = win32wnet.WNetOpenEnum(winnetwk.RESOURCE_GLOBALNET, winnetwk.RESOURCETYPE_ANY, 0, res) while True: home = win32wnet.WnetEnumResource(handle, 1) print home.lpRemoteName How can I correct this? And is there a way to list sessions of such a share? Until now I found only a mention of net32api which seems not to be covered by pythonwin. Best wishes Michael -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: Digital signature URL: From mdriscoll at co.marshall.ia.us Mon Aug 25 16:39:04 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 25 Aug 2008 09:39:04 -0500 Subject: [python-win32] Created Map NetWork Drive is not visible in "My Computer" window In-Reply-To: <424b71ec0808250718t57ccb7e8ve560b80e2eb5878f@mail.gmail.com> References: <424b71ec0808240553j502bed57pef5b4b69d9a1f533@mail.gmail.com> <48B2BB28.3000002@co.marshall.ia.us> <424b71ec0808250718t57ccb7e8ve560b80e2eb5878f@mail.gmail.com> Message-ID: <48B2C408.4050209@co.marshall.ia.us> siddhartha veedaluru wrote: > That worked. > > Thanks very much Mike > > Sid One thing I forgot to mention. You might want to check if that drive is already mapped or you'll get an error. We force our drive letters by using the WNetCancelConnection2() method of win32wnet to un-map the drive letter if it's already mapped before we map the drives. We do this because some of users stick USB drives or other devices into their PCs before they login and the USB drive will grab the drive letter. Mike > > On Mon, Aug 25, 2008 at 7:31 PM, Mike Driscoll > > wrote: > > siddhartha veedaluru wrote: > > Hi, > i have used the following code to create Map NetWork Drive. > But it is not visble when i open "My Computer" window. > --------------------------------------------------------------------------- > import win32net,time > data = {} > data['remote'] = r'\\fredo\Project' > data['local'] = 'K:' > data['user'] = 'builder' > data['password'] = 'builder' > data['asg_type'] = 0 > data['status'] = 1 > data['domainname'] = 'conindia' > win32net.NetUseAdd(None,1,data) > ----------------------------------------------------------------------- > Help me in making it visible. > Regards, > Siddhartha > > > I recommend this method instead: > > > import win32wnet > from win32netcon import RESOURCETYPE_DISK as DISK > > drive_letter = "K:" > path = "\\fredo\Project" > win32wnet.WNetAddConnection2(DISK, drive_letter, path) > > > > We use this method at my place of employment as part of our login > script. > > Mike > > From ing_emanuels at hotmail.com Tue Aug 26 18:26:49 2008 From: ing_emanuels at hotmail.com (Emanuel Sotelo) Date: Tue, 26 Aug 2008 11:26:49 -0500 Subject: [python-win32] interprocess communication python and visual basic can it be done? Message-ID: hello. well i have a question i dont now if it it's possible to make a interprocess communication between python and visual basic. someone tell that it can be done but i havent fond nothing about this subject if it is possible can some one give me some guide points of where to look or what to investigate because i just began lerning python and i have to do a proyect a bout this but i will like to get some info of how before i start develop the programan I would appreciate any help that anyone can provide _________________________________________________________________ P.D. Checa las nuevas fotos de mi Space http://home.services.spaces.live.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Tue Aug 26 19:07:56 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 26 Aug 2008 11:07:56 -0600 Subject: [python-win32] interprocess communication python and visual basic can it be done? In-Reply-To: References: Message-ID: Emanuel: Best answer: Find a copy of *Python Programming On Win32* by Mark Hammond and Andy Robinson and read chapter 7. Unfortunately, copies of the book are getting quite hard to get. -- VC Mark: New edition??? Please!!! -- VC On Tue, Aug 26, 2008 at 10:26 AM, Emanuel Sotelo wrote: > > hello. > well i have a question i dont now if it it's possible to make a > interprocess communication between python and visual basic. > someone tell that it can be done but i havent fond nothing about this subject > if it is possible can some one give me some guide points of where to > look or what to investigate because i just began lerning python and i have > to do a proyect a bout this but i will like to get some info of how before i > start develop the programan > I would appreciate any help that anyone can provide > > ________________________________ > Si no te acuerdas qui?n qued? en traer los hielos, te urge usar Skydrive > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ing_emanuels at hotmail.com Tue Aug 26 19:32:56 2008 From: ing_emanuels at hotmail.com (Emanuel Sotelo) Date: Tue, 26 Aug 2008 12:32:56 -0500 Subject: [python-win32] interprocess communication python and visual Message-ID: well a have already read this book but it just explains how to comunicate to microsoft office, and the part tha explains VB I could not do the examples i read and try but without any success, i even donwload the examples from the web page and have the same result, i wasn't able to recreat the examples. and i do soport you it wont be a bad idea of a new edition of this book, it thit help me a little bit, but this book is gettin kind of old and it doesn't exist another book about pywin32 _________________________________________________________________ Plug&Play te trae en exclusiva los mejores conciertos de la red http://club.prodigymsn.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin.horn at gmail.com Tue Aug 26 20:42:22 2008 From: kevin.horn at gmail.com (Kevin Horn) Date: Tue, 26 Aug 2008 13:42:22 -0500 Subject: [python-win32] interprocess communication python and visual basic can it be done? In-Reply-To: References: Message-ID: <562bcc10808261142w728cb212hf8beca4fcca2f153@mail.gmail.com> Look into either: COM or Named Pipes You could also try having a socket in each process and communicate over a "network", but I don't know how difficult socket programming is in VB Kevin Horn On Tue, Aug 26, 2008 at 12:07 PM, Vernon Cole wrote: > Emanuel: > Best answer: Find a copy of *Python Programming On Win32* by Mark > Hammond and Andy Robinson and read chapter 7. Unfortunately, copies of the > book are getting quite hard to get. > -- > VC > > Mark: > New edition??? > Please!!! > -- > VC > > > On Tue, Aug 26, 2008 at 10:26 AM, Emanuel Sotelo > wrote: > > > > hello. > > well i have a question i dont now if it it's possible to make a > > interprocess communication between python and visual basic. > > someone tell that it can be done but i havent fond nothing about this > subject > > if it is possible can some one give me some guide points of where to > > look or what to investigate because i just began lerning python and i > have > > to do a proyect a bout this but i will like to get some info of how > before i > > start develop the programan > > I would appreciate any help that anyone can provide > > > > ________________________________ > > Si no te acuerdas qui?n qued? en traer los hielos, te urge usar Skydrive > > _______________________________________________ > > python-win32 mailing list > > python-win32 at python.org > > http://mail.python.org/mailman/listinfo/python-win32 > > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nytrokiss at gmail.com Tue Aug 26 20:57:14 2008 From: nytrokiss at gmail.com (James Matthews) Date: Tue, 26 Aug 2008 11:57:14 -0700 Subject: [python-win32] Fwd: Renaming Excel Spreadsheets In-Reply-To: References: Message-ID: <8a6b8e350808261157u1fd2b631j8732ef253e4dd1f1@mail.gmail.com> ---------- Forwarded message ---------- From: Greg Lindstrom Date: Tue, Aug 26, 2008 at 11:54 AM Subject: Renaming Excel Spreadsheets To: python-list at python.org Hello, I am working with Python to create Excel spreadsheets and have run into a couple of problems I hope you can help me with. First...are there any bindings/libraries into Open Office? Now, back to Excel. --> Does anyone know a way to create N worksheets? By default, 3 are created, but I would like more. --> Is it possible to rename a worksheet inside of the workbook (change "Sheet1" to "July 08", for example). I've been working with Mark Hammond's book on Windows programming with Python, but these have me stumped. Better yet, an Open Source reporting system (ala Crystal Reports) would keep me from having to write this. I've looked at Jasper and DataVision; Thanks, --greg -- http://mail.python.org/mailman/listinfo/python-list -- http://www.goldwatches.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From waldemar.osuch at gmail.com Wed Aug 27 04:59:30 2008 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Tue, 26 Aug 2008 20:59:30 -0600 Subject: [python-win32] Fwd: Renaming Excel Spreadsheets In-Reply-To: <8a6b8e350808261157u1fd2b631j8732ef253e4dd1f1@mail.gmail.com> References: <8a6b8e350808261157u1fd2b631j8732ef253e4dd1f1@mail.gmail.com> Message-ID: <6fae95540808261959q30f17f5ekac37be413cc0a425@mail.gmail.com> On Tue, Aug 26, 2008 at 12:57 PM, James Matthews wrote: > > > ---------- Forwarded message ---------- > From: Greg Lindstrom > Date: Tue, Aug 26, 2008 at 11:54 AM > Subject: Renaming Excel Spreadsheets > To: python-list at python.org > > > Hello, > > I am working with Python to create Excel spreadsheets and have run into a > couple of problems I hope you can help me with. > > First...are there any bindings/libraries into Open Office? > > Now, back to Excel. > > --> Does anyone know a way to create N worksheets? By default, 3 are > created, but I would like more. > > --> Is it possible to rename a worksheet inside of the workbook (change > "Sheet1" to "July 08", for example). > > I've been working with Mark Hammond's book on Windows programming with > Python, but these have me stumped. > > Better yet, an Open Source reporting system (ala Crystal Reports) would keep > me from having to write this. I've looked at Jasper and DataVision; > > Thanks, > --greg > That should get you started >>> from win32com.client import Dispatch >>> app = Dispatch('Excel.Application') >>> app.Visible = True >>> wrk = app.Workbooks.Add() >>> wrk.Sheets.Count 3 >>> sh = wrk.Sheets.Add() >>> wrk.Sheets.Count 4 >>> sh.Name u'Sheet4' >>> sh.Name = 'New Name 4' >>> wrk.Sheets[0].Name u'New Name 4' >>> wrk.Sheets[2].Name u'Sheet2' >>> wrk.Sheets[2].Name = 'Hello' >>> wrk.Save() >>> wrk.Close(0) >>> app.Quit() >>> But I would recommend using xlwt (friendly fork of pyExcelerator) for Excel generation. It lets you bypass having to install Microsoft Office. https://secure.simplistix.co.uk/svn/xlwt/trunk/README.html The OpenOffice comes with its own version of python that can be used for automation. http://wiki.services.openoffice.org/wiki/Python Another option is to manipulate the OpenOffice documents directly. http://openoffice-python.origo.ethz.ch/ Or create OpenOffice document as a template with all the formatting you desire and generate new document by judicious modification of the template's XML. The OpenOffice documents are just a bunch of XML files zipped together. Change the extension to *.zip and use your favorite unzipping program to see for yourself. Waldemar From cappy2112 at gmail.com Wed Aug 27 07:00:35 2008 From: cappy2112 at gmail.com (Tony Cappellini) Date: Tue, 26 Aug 2008 22:00:35 -0700 Subject: [python-win32] interprocess communication python and visual basic can it be done? Message-ID: <8249c4ac0808262200n620180cbr7e1ff5d1a8e290d5@mail.gmail.com> > > Message: 2 > Date: Tue, 26 Aug 2008 11:07:56 -0600 > From: "Vernon Cole" > Subject: Re: [python-win32] interprocess communication python and > visual basic can it be done? > To: "Emanuel Sotelo" > Cc: python-win32 at python.org > Message-ID: > > Content-Type: text/plain; charset="iso-8859-1" > > Emanuel: > Best answer: Find a copy of *Python Programming On Win32* by Mark Hammond > and Andy Robinson and read chapter 7. Unfortunately, copies of the book are > getting quite hard to get. > > Why? It's still being published http://oreilly.com/catalog/9781565926219/index.html Amazon still has them in stock too http://www.amazon.com/Python-Programming-Win32-Windows-Programmers/dp/1565926218/ref=sr_1_2?ie=UTF8&s=books&qid=1219813190&sr=8-2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Wed Aug 27 15:35:37 2008 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 27 Aug 2008 14:35:37 +0100 Subject: [python-win32] Accessing properties of share on DFS In-Reply-To: <20080825143047.GD13124@localhost> References: <20080825143047.GD13124@localhost> Message-ID: <48B55829.5020205@timgolden.me.uk> Michael Kesper wrote: > Until now I'm using win32net.NetSessionEnum to list sessions users have > open. Now homes will be migrated to Distributed Filesystem (DFS). > As far as I understood msdn I should access that via win32wnet. > But now, I have some troubles to figure out how this really works. > The following script gives me an error 87, "wrong parameter" at the call > of WNetOpenEnum: You might be able to get there with WMI. The following works on my own machine, but I'm not sure what machine you'd need to access to list the DFS shares. I'll see if I can persuade a friendly admin here to let me try things out: import wmi c = wmi.WMI () for share in c.Win32_Share (Type=0): print share.Caption, share.Path for session in share.associators ( wmi_result_class="Win32_ServerConnection" ): print " ", session.UserName, session.ActiveTime or you could come from the other end and enumerate the Win32_ServerConnection collection to start with. As I say, I'll try to get one of our admins let me have a go with a DFS share to see if I can get something working. TJG From mdriscoll at co.marshall.ia.us Wed Aug 27 15:36:01 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Wed, 27 Aug 2008 08:36:01 -0500 Subject: [python-win32] Fwd: Renaming Excel Spreadsheets In-Reply-To: <8a6b8e350808261157u1fd2b631j8732ef253e4dd1f1@mail.gmail.com> References: <8a6b8e350808261157u1fd2b631j8732ef253e4dd1f1@mail.gmail.com> Message-ID: <48B55841.4020403@co.marshall.ia.us> James Matthews wrote: > > > ---------- Forwarded message ---------- > From: *Greg Lindstrom* > > Date: Tue, Aug 26, 2008 at 11:54 AM > Subject: Renaming Excel Spreadsheets > To: python-list at python.org > > > Hello, > > I am working with Python to create Excel spreadsheets and have run > into a couple of problems I hope you can help me with. > > First...are there any bindings/libraries into Open Office? > > Now, back to Excel. > > --> Does anyone know a way to create N worksheets? By default, 3 are > created, but I would like more. > > --> Is it possible to rename a worksheet inside of the workbook > (change "Sheet1" to "July 08", for example). > > I've been working with Mark Hammond's book on Windows programming with > Python, but these have me stumped. > > Better yet, an Open Source reporting system (ala Crystal Reports) > would keep me from having to write this. I've looked at Jasper and > DataVision; > > Thanks, > --greg > > -- > http://mail.python.org/mailman/listinfo/python-list > You might also look at Dabo, which has a Report Designer that's similar to Crystal Reports, but written in Python. There are a couple of screencasts here: http://dabodev.com/documentation Mike From mail at timgolden.me.uk Wed Aug 27 15:40:54 2008 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 27 Aug 2008 14:40:54 +0100 Subject: [python-win32] How can I use GetKeyboardLayout in python? In-Reply-To: <884670ce0808230903m512b5812t50cccd77b0b72aaf@mail.gmail.com> References: <884670ce0808230903m512b5812t50cccd77b0b72aaf@mail.gmail.com> Message-ID: <48B55966.3070608@timgolden.me.uk> Dror Cohen wrote: > Hi everybody, for a long time I'm trying to get my current typing > language in windows. > At the moment I'm thinking about using either GetKeyboardLayout or > ITfInputProcessorProfiles that holds the **GetCurrentLanguage* > function. > It seems that using GetKeyboardLayout will be a lot easier but I just > can't find this function in the win32api functions list. I freely admit I know next to nothing about this aspect of Windows, but to help you along, it's nearly trivial to access this function via ctypes: import ctypes print ctypes.windll.user32.GetKeyboardLayout (0) You then have the issue of what to do with the result, but I'm sure you're up to that challenge. TJG From vernondcole at gmail.com Wed Aug 27 20:42:04 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 27 Aug 2008 12:42:04 -0600 Subject: [python-win32] interprocess communication python and visual basic can it be done? In-Reply-To: <8249c4ac0808262200n620180cbr7e1ff5d1a8e290d5@mail.gmail.com> References: <8249c4ac0808262200n620180cbr7e1ff5d1a8e290d5@mail.gmail.com> Message-ID: On Tue, Aug 26, 2008 at 11:00 PM, Tony Cappellini wrote: > > Unfortunately, copies of the book are >> getting quite hard to get. >> >> > Why? It's still being published > http://oreilly.com/catalog/9781565926219/index.html > > Amazon still has them in stock too > > http://www.amazon.com/Python-Programming-Win32-Windows-Programmers/dp/1565926218/ref=sr_1_2?ie=UTF8&s=books&qid=1219813190&sr=8-2 > > Amazon's price is $159 for a new copy. My copy has $34.95 printed on the cover as the price. On MY budget, $159 is "hard to get" for book which is eight years out of date. (But still the best published source on the subject.) -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112 at gmail.com Wed Aug 27 20:52:53 2008 From: cappy2112 at gmail.com (Tony Cappellini) Date: Wed, 27 Aug 2008 11:52:53 -0700 Subject: [python-win32] interprocess communication python and visual basic can it be done? In-Reply-To: References: <8249c4ac0808262200n620180cbr7e1ff5d1a8e290d5@mail.gmail.com> Message-ID: <8249c4ac0808271152l55b29be8g26c15948e0911961@mail.gmail.com> I see many prices less than $50 on Amazon, and the publisher is still selling it for $34.95. There are 100's of used book services available as well. On Wed, Aug 27, 2008 at 11:42 AM, Vernon Cole wrote: > > > Why? It's still being published >> http://oreilly.com/catalog/9781565926219/index.html >> > >> Amazon still has them in stock too >> >> http://www.amazon.com/Python-Programming-Win32-Windows-Programmers/dp/1565926218/ref=sr_1_2?ie=UTF8&s=books&qid=1219813190&sr=8-2 >> >> Amazon's price is $159 for a new copy. My copy has $34.95 printed on the > cover as the price. On MY budget, $159 is "hard to get" for book which is > eight years out of date. (But still the best published source on the > subject.) > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alecmunro at gmail.com Thu Aug 28 15:32:10 2008 From: alecmunro at gmail.com (Alec Munro) Date: Thu, 28 Aug 2008 10:32:10 -0300 Subject: [python-win32] Accessing other interfaces of a Dispatch created COM object In-Reply-To: <9819d58b0808280556g46cbd1cbj85f32cc82987615a@mail.gmail.com> References: <9819d58b0808280556g46cbd1cbj85f32cc82987615a@mail.gmail.com> Message-ID: <9819d58b0808280632x2b139645x278d5f0675dd46c7@mail.gmail.com> Hi List, Hopefully I have my terminology right, I'm pretty new to COM and C++. My problem is that I have a COM DLL written in C++, that I would like to call from Python. This DLL implements 3 important interfaces, each of which is also an IDispatch implementation, like the following: IDispatchImpl IDispatchImpl IDispatchImpl However, when I do: >>> obj = win32com.client.Dispatch("a.b.c") >>> obj The object I get only has methods available for the first of the interfaces. From my reading, this is simply the functionality of IDispatch, and if I wanted to get those additional methods through IDispatch, I would have to update the DLL, and restructure my interfaces. I'm not confident enough in my C++ to do this, or at least it's not my first choice. >From what I've read, there are two ways that seem to be possibilities for being able to call the methods from the other interfaces. The simplest one I found was the suggestion to use MakePy on the type library containing Interface_2 and Interface_3. I did this, and copied the generated file to my working directory, then did: >>> from interfaces import Interface_2 >>> obj_i2 = Interface_2(obj) >>> obj_i2 Unfortunately when I try: >>> obj_i2.secondaryMethod() Traceback (most recent call last): ... File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 449, in _ApplyTypes_ dispid, 0, wFlags, retType, argTypes, *args), com_error: (-2147319779, 'Library not registered.', None, None) The other suggestion I came across was to use QueryInterface. I wasn't sure what argument to pass to QueryInterface, so I tried using the CLSID of the interface I wanted. >>> obj._oleobj_.QueryInterface(Interface_2.CLSID) Traceback (most recent call last): File "", line 1, in TypeError: There is no interface object registered that supports this IID >From these error messages, it seems like perhaps there's a problem with the registration of the type library that contains the interfaces. I'm not really sure how to fix that, or if that is even the problem. Any ideas? Thanks, Alec Munro From alecmunro at gmail.com Thu Aug 28 15:33:25 2008 From: alecmunro at gmail.com (Alec Munro) Date: Thu, 28 Aug 2008 10:33:25 -0300 Subject: [python-win32] Accessing other interfaces of a Dispatch created COM object In-Reply-To: <9819d58b0808280632x2b139645x278d5f0675dd46c7@mail.gmail.com> References: <9819d58b0808280556g46cbd1cbj85f32cc82987615a@mail.gmail.com> <9819d58b0808280632x2b139645x278d5f0675dd46c7@mail.gmail.com> Message-ID: <9819d58b0808280633t13d89b77u433d55924cbb73a1@mail.gmail.com> Oh, and on re-reading, I do realize that the DLL itself doesn't implement those interfaces. There's a class within the DLL that does that. :) On Thu, Aug 28, 2008 at 10:32 AM, Alec Munro wrote: > Hi List, > > Hopefully I have my terminology right, I'm pretty new to COM and C++. > > My problem is that I have a COM DLL written in C++, that I would like > to call from Python. This DLL implements 3 important interfaces, each > of which is also an IDispatch implementation, like the following: > > IDispatchImpl > IDispatchImpl > IDispatchImpl > > However, when I do: >>>> obj = win32com.client.Dispatch("a.b.c") >>>> obj > > > The object I get only has methods available for the first of the > interfaces. From my reading, this is simply the functionality of > IDispatch, and if I wanted to get those additional methods through > IDispatch, I would have to update the DLL, and restructure my > interfaces. I'm not confident enough in my C++ to do this, or at least > it's not my first choice. > > From what I've read, there are two ways that seem to be possibilities > for being able to call the methods from the other interfaces. > > The simplest one I found was the suggestion to use MakePy on the type > library containing Interface_2 and Interface_3. I did this, and copied > the generated file to my working directory, then did: > >>>> from interfaces import Interface_2 >>>> obj_i2 = Interface_2(obj) >>>> obj_i2 > 0x17459602> > > Unfortunately when I try: > >>>> obj_i2.secondaryMethod() > Traceback (most recent call last): > ... > File "C:\Python25\lib\site-packages\win32com\client\__init__.py", > line 449, in _ApplyTypes_ > dispid, 0, wFlags, retType, argTypes, *args), > com_error: (-2147319779, 'Library not registered.', None, None) > > The other suggestion I came across was to use QueryInterface. I wasn't > sure what argument to pass to QueryInterface, so I tried using the > CLSID of the interface I wanted. > >>>> obj._oleobj_.QueryInterface(Interface_2.CLSID) > Traceback (most recent call last): > File "", line 1, in > TypeError: There is no interface object registered that supports this IID > > From these error messages, it seems like perhaps there's a problem > with the registration of the type library that contains the > interfaces. I'm not really sure how to fix that, or if that is even > the problem. > > Any ideas? > > Thanks, > Alec Munro > From alecmunro at gmail.com Thu Aug 28 16:34:18 2008 From: alecmunro at gmail.com (Alec Munro) Date: Thu, 28 Aug 2008 11:34:18 -0300 Subject: [python-win32] Accessing other interfaces of a Dispatch created COM object In-Reply-To: <9819d58b0808280633t13d89b77u433d55924cbb73a1@mail.gmail.com> References: <9819d58b0808280556g46cbd1cbj85f32cc82987615a@mail.gmail.com> <9819d58b0808280632x2b139645x278d5f0675dd46c7@mail.gmail.com> <9819d58b0808280633t13d89b77u433d55924cbb73a1@mail.gmail.com> Message-ID: <9819d58b0808280734o33af5721y741ca9b079d074af@mail.gmail.com> I just discovered a third possibility, and subsequent failure: >>> obj_i2 = Dispatch(obj, None, Interface_2.CLSID) >>> obj_i2.secondaryMethod() Traceback (most recent call last): ... File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 449, in _ApplyTypes_ dispid, 0, wFlags, retType, argTypes, *args), com_error: (-2147352573, 'Member not found.', None, None) Alec On Thu, Aug 28, 2008 at 10:33 AM, Alec Munro wrote: > Oh, and on re-reading, I do realize that the DLL itself doesn't > implement those interfaces. There's a class within the DLL that does > that. :) > > On Thu, Aug 28, 2008 at 10:32 AM, Alec Munro wrote: >> Hi List, >> >> Hopefully I have my terminology right, I'm pretty new to COM and C++. >> >> My problem is that I have a COM DLL written in C++, that I would like >> to call from Python. This DLL implements 3 important interfaces, each >> of which is also an IDispatch implementation, like the following: >> >> IDispatchImpl >> IDispatchImpl >> IDispatchImpl >> >> However, when I do: >>>>> obj = win32com.client.Dispatch("a.b.c") >>>>> obj >> >> >> The object I get only has methods available for the first of the >> interfaces. From my reading, this is simply the functionality of >> IDispatch, and if I wanted to get those additional methods through >> IDispatch, I would have to update the DLL, and restructure my >> interfaces. I'm not confident enough in my C++ to do this, or at least >> it's not my first choice. >> >> From what I've read, there are two ways that seem to be possibilities >> for being able to call the methods from the other interfaces. >> >> The simplest one I found was the suggestion to use MakePy on the type >> library containing Interface_2 and Interface_3. I did this, and copied >> the generated file to my working directory, then did: >> >>>>> from interfaces import Interface_2 >>>>> obj_i2 = Interface_2(obj) >>>>> obj_i2 >> > 0x17459602> >> >> Unfortunately when I try: >> >>>>> obj_i2.secondaryMethod() >> Traceback (most recent call last): >> ... >> File "C:\Python25\lib\site-packages\win32com\client\__init__.py", >> line 449, in _ApplyTypes_ >> dispid, 0, wFlags, retType, argTypes, *args), >> com_error: (-2147319779, 'Library not registered.', None, None) >> >> The other suggestion I came across was to use QueryInterface. I wasn't >> sure what argument to pass to QueryInterface, so I tried using the >> CLSID of the interface I wanted. >> >>>>> obj._oleobj_.QueryInterface(Interface_2.CLSID) >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: There is no interface object registered that supports this IID >> >> From these error messages, it seems like perhaps there's a problem >> with the registration of the type library that contains the >> interfaces. I'm not really sure how to fix that, or if that is even >> the problem. >> >> Any ideas? >> >> Thanks, >> Alec Munro >> > From mhammond at skippinet.com.au Fri Aug 29 08:01:40 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 29 Aug 2008 16:01:40 +1000 Subject: [python-win32] Accessing other interfaces of a Dispatch created COM object In-Reply-To: <9819d58b0808280734o33af5721y741ca9b079d074af@mail.gmail.com> References: <9819d58b0808280556g46cbd1cbj85f32cc82987615a@mail.gmail.com> <9819d58b0808280632x2b139645x278d5f0675dd46c7@mail.gmail.com> <9819d58b0808280633t13d89b77u433d55924cbb73a1@mail.gmail.com> <9819d58b0808280734o33af5721y741ca9b079d074af@mail.gmail.com> Message-ID: <00de01c9099c$b77731c0$26659540$@com.au> Look at the docstring for win32com.client.CastTo (and googling for that will probably help too) Cheers, Mark > I just discovered a third possibility, and subsequent failure: > > >>> obj_i2 = Dispatch(obj, None, Interface_2.CLSID) > >>> obj_i2.secondaryMethod() > Traceback (most recent call last): > ... > File "C:\Python25\lib\site-packages\win32com\client\__init__.py", > line 449, in _ApplyTypes_ > dispid, 0, wFlags, retType, argTypes, *args), > com_error: (-2147352573, 'Member not found.', None, None) > > Alec > > On Thu, Aug 28, 2008 at 10:33 AM, Alec Munro > wrote: > > Oh, and on re-reading, I do realize that the DLL itself doesn't > > implement those interfaces. There's a class within the DLL that does > > that. :) > > > > On Thu, Aug 28, 2008 at 10:32 AM, Alec Munro > wrote: > >> Hi List, > >> > >> Hopefully I have my terminology right, I'm pretty new to COM and > C++. > >> > >> My problem is that I have a COM DLL written in C++, that I would > like > >> to call from Python. This DLL implements 3 important interfaces, > each > >> of which is also an IDispatch implementation, like the following: > >> > >> IDispatchImpl &LIBID_Interface_1, 1, 0> > >> IDispatchImpl &LIBID_Interface_2, 1, 0> > >> IDispatchImpl &LIBID_Interface_3 1, 0> > >> > >> However, when I do: > >>>>> obj = win32com.client.Dispatch("a.b.c") > >>>>> obj > >> > >> > >> The object I get only has methods available for the first of the > >> interfaces. From my reading, this is simply the functionality of > >> IDispatch, and if I wanted to get those additional methods through > >> IDispatch, I would have to update the DLL, and restructure my > >> interfaces. I'm not confident enough in my C++ to do this, or at > least > >> it's not my first choice. > >> > >> From what I've read, there are two ways that seem to be > possibilities > >> for being able to call the methods from the other interfaces. > >> > >> The simplest one I found was the suggestion to use MakePy on the > type > >> library containing Interface_2 and Interface_3. I did this, and > copied > >> the generated file to my working directory, then did: > >> > >>>>> from interfaces import Interface_2 > >>>>> obj_i2 = Interface_2(obj) > >>>>> obj_i2 > >> at > >> 0x17459602> > >> > >> Unfortunately when I try: > >> > >>>>> obj_i2.secondaryMethod() > >> Traceback (most recent call last): > >> ... > >> File "C:\Python25\lib\site-packages\win32com\client\__init__.py", > >> line 449, in _ApplyTypes_ > >> dispid, 0, wFlags, retType, argTypes, *args), > >> com_error: (-2147319779, 'Library not registered.', None, None) > >> > >> The other suggestion I came across was to use QueryInterface. I > wasn't > >> sure what argument to pass to QueryInterface, so I tried using the > >> CLSID of the interface I wanted. > >> > >>>>> obj._oleobj_.QueryInterface(Interface_2.CLSID) > >> Traceback (most recent call last): > >> File "", line 1, in > >> TypeError: There is no interface object registered that supports > this IID > >> > >> From these error messages, it seems like perhaps there's a problem > >> with the registration of the type library that contains the > >> interfaces. I'm not really sure how to fix that, or if that is even > >> the problem. > >> > >> Any ideas? > >> > >> Thanks, > >> Alec Munro > >> > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From vernondcole at gmail.com Fri Aug 29 17:40:09 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Fri, 29 Aug 2008 09:40:09 -0600 Subject: [python-win32] adodbapi version 2.2 ready and in cvs. Message-ID: Dear Pythonoholics: I have just released adodbapi version 2.2. This version adds support for Iron Python, which is not important to this group, but it did make me clean up the code. All classes are now new-style classes, and string exceptions are gone. I found out why .rowcount was so useless (you have to look in two places, and I was ignoring the more important one) so it works much better now. I have added a .cvtString method so it is now easy to get the package to deliver your numeric fields as strings (if you prefer) rather than the default decimal.Decimal. The unit test (used as a code sample) for user-defined type convertion was wrong. It happened to test correctly in CPython, but broke in Iron, so I finally figured out how it was supposed to work. (You pass it the type_code as found in .description[i][1], and the convertion function.) The test/sample is now correct. There are two user-submitted bug fixes (as in version 2.1.2) so multiple result sets from cursor.nextset() work even when some are empty. -- For those who have no idea what I am talking about... adodbapi is a fully dbapi 2.0 compliant package for accessing SQL data, written in pure python. It runs in either C python or Iron Python (Windows only - it depends on COM). All data is read and/or written using appropriate native python data types such as datetime.datetime (for dates) and decimal.Decimal (for currency and numeric). You may change the type conversions if you wish. Everything works -- commit/rollback, stored procedures, multiple dataset return, etc, etc. Tested with Jet (MS Access), MS SQL server, and mySQL engines. Probably works with any other suitable ADO DB source. If you don't use cvs, you can also get the new version at http://sourceforge.net/projects/adodbapi . Put the unzipped folder in your /lib/site-packages directory. -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From alecmunro at gmail.com Fri Aug 29 19:47:49 2008 From: alecmunro at gmail.com (Alec Munro) Date: Fri, 29 Aug 2008 14:47:49 -0300 Subject: [python-win32] Accessing other interfaces of a Dispatch created COM object In-Reply-To: <00de01c9099c$b77731c0$26659540$@com.au> References: <9819d58b0808280556g46cbd1cbj85f32cc82987615a@mail.gmail.com> <9819d58b0808280632x2b139645x278d5f0675dd46c7@mail.gmail.com> <9819d58b0808280633t13d89b77u433d55924cbb73a1@mail.gmail.com> <9819d58b0808280734o33af5721y741ca9b079d074af@mail.gmail.com> <00de01c9099c$b77731c0$26659540$@com.au> Message-ID: <9819d58b0808291047j3de5e9d8u7647b05e49a53f97@mail.gmail.com> Thanks Mark. After a couple of misfires, I think I figured out how to get CastTo to work (the docstring is practically non-existent in the version I have, perhaps it's been updated?). However, that puts me back at the same place I was with some of the other attempts: >>> obj_i2 = CastTo(obj, "Interface_2") >>> obj_i2.secondaryMethod() Traceback (most recent call last): ... File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 449, in _ApplyTypes_ dispid, 0, wFlags, retType, argTypes, *args), com_error: (-2147319779, 'Library not registered.', None, None) However, one interesting note is that the object generated by CastTo is of a different version of the Type Library than the object generated by Interface_2(obj). I don't know if that's useful information, however. They have the same CLSID, but different coclass_clsids. Thanks again, Alec On Fri, Aug 29, 2008 at 3:01 AM, Mark Hammond wrote: > Look at the docstring for win32com.client.CastTo (and googling for that will > probably help too) > > Cheers, > > Mark > >> I just discovered a third possibility, and subsequent failure: >> >> >>> obj_i2 = Dispatch(obj, None, Interface_2.CLSID) >> >>> obj_i2.secondaryMethod() >> Traceback (most recent call last): >> ... >> File "C:\Python25\lib\site-packages\win32com\client\__init__.py", >> line 449, in _ApplyTypes_ >> dispid, 0, wFlags, retType, argTypes, *args), >> com_error: (-2147352573, 'Member not found.', None, None) >> >> Alec >> >> On Thu, Aug 28, 2008 at 10:33 AM, Alec Munro >> wrote: >> > Oh, and on re-reading, I do realize that the DLL itself doesn't >> > implement those interfaces. There's a class within the DLL that does >> > that. :) >> > >> > On Thu, Aug 28, 2008 at 10:32 AM, Alec Munro >> wrote: >> >> Hi List, >> >> >> >> Hopefully I have my terminology right, I'm pretty new to COM and >> C++. >> >> >> >> My problem is that I have a COM DLL written in C++, that I would >> like >> >> to call from Python. This DLL implements 3 important interfaces, >> each >> >> of which is also an IDispatch implementation, like the following: >> >> >> >> IDispatchImpl> &LIBID_Interface_1, 1, 0> >> >> IDispatchImpl> &LIBID_Interface_2, 1, 0> >> >> IDispatchImpl> &LIBID_Interface_3 1, 0> >> >> >> >> However, when I do: >> >>>>> obj = win32com.client.Dispatch("a.b.c") >> >>>>> obj >> >> >> >> >> >> The object I get only has methods available for the first of the >> >> interfaces. From my reading, this is simply the functionality of >> >> IDispatch, and if I wanted to get those additional methods through >> >> IDispatch, I would have to update the DLL, and restructure my >> >> interfaces. I'm not confident enough in my C++ to do this, or at >> least >> >> it's not my first choice. >> >> >> >> From what I've read, there are two ways that seem to be >> possibilities >> >> for being able to call the methods from the other interfaces. >> >> >> >> The simplest one I found was the suggestion to use MakePy on the >> type >> >> library containing Interface_2 and Interface_3. I did this, and >> copied >> >> the generated file to my working directory, then did: >> >> >> >>>>> from interfaces import Interface_2 >> >>>>> obj_i2 = Interface_2(obj) >> >>>>> obj_i2 >> >> > at >> >> 0x17459602> >> >> >> >> Unfortunately when I try: >> >> >> >>>>> obj_i2.secondaryMethod() >> >> Traceback (most recent call last): >> >> ... >> >> File "C:\Python25\lib\site-packages\win32com\client\__init__.py", >> >> line 449, in _ApplyTypes_ >> >> dispid, 0, wFlags, retType, argTypes, *args), >> >> com_error: (-2147319779, 'Library not registered.', None, None) >> >> >> >> The other suggestion I came across was to use QueryInterface. I >> wasn't >> >> sure what argument to pass to QueryInterface, so I tried using the >> >> CLSID of the interface I wanted. >> >> >> >>>>> obj._oleobj_.QueryInterface(Interface_2.CLSID) >> >> Traceback (most recent call last): >> >> File "", line 1, in >> >> TypeError: There is no interface object registered that supports >> this IID >> >> >> >> From these error messages, it seems like perhaps there's a problem >> >> with the registration of the type library that contains the >> >> interfaces. I'm not really sure how to fix that, or if that is even >> >> the problem. >> >> >> >> Any ideas? >> >> >> >> Thanks, >> >> Alec Munro >> >> >> > >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 > > From imageguy1206 at gmail.com Fri Aug 29 21:15:52 2008 From: imageguy1206 at gmail.com (geoff) Date: Fri, 29 Aug 2008 15:15:52 -0400 Subject: [python-win32] os.startwith issue dealing with .tif (winxp) Message-ID: <3ee0b280808291215p3304d7c9iaca02e180c928f06@mail.gmail.com> Hi Folks; I have an application that stores images in a database. When the images are extracted, we use the files extension and os.startwith("filename") to allows the OS to select the users desingated program to open the file. Sometimes ... this goes astray. For some mysterious reason, WinXP's file type associates get removed, atleast for TIF files. what I would like to do is that if os.startwith fails, try to open the file with a specific program. In the case of image files, the Ms Picture and Fax Viewer. How do I find the default path to an installed program ? Do I need the GUID and then look for the registry key ?? Any help would be appreciated. g. From timr at probo.com Fri Aug 29 21:53:10 2008 From: timr at probo.com (Tim Roberts) Date: Fri, 29 Aug 2008 12:53:10 -0700 Subject: [python-win32] os.startwith issue dealing with .tif (winxp) In-Reply-To: <3ee0b280808291215p3304d7c9iaca02e180c928f06@mail.gmail.com> References: <3ee0b280808291215p3304d7c9iaca02e180c928f06@mail.gmail.com> Message-ID: <48B853A6.80409@probo.com> geoff wrote: > Hi Folks; > > I have an application that stores images in a database. > When the images are extracted, we use the files extension and > os.startwith("filename") to allows the OS to select the users > desingated program to open the file. > > Sometimes ... this goes astray. For some mysterious reason, WinXP's > file type associates get removed, atleast for TIF files. > TIFF files are not normally associated with a program on Windows XP. > what I would like to do is that if os.startwith fails, try to open the > file with a specific program. In the case of image files, the Ms > Picture and Fax Viewer. > > How do I find the default path to an installed program ? > Do I need the GUID and then look for the registry key ?? > No, that doesn't work for applications, only for COM objects. However, in this specific case, you are in luck. The "Microsoft Picture and FAX Viewer" happens to live inside of a system DLL, and that DLL always lives in the Windows "system32" directory. So, you can do this: rundll32.exe shimgvw.dll,ImageView_Fullscreen path\to\image\file.tiff Whitespace is important; don't put any before or after that "comma". -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From imageguy1206 at gmail.com Sat Aug 30 04:11:27 2008 From: imageguy1206 at gmail.com (geoff) Date: Fri, 29 Aug 2008 23:11:27 -0300 Subject: [python-win32] os.startwith issue dealing with .tif (winxp) In-Reply-To: <48B853A6.80409@probo.com> References: <3ee0b280808291215p3304d7c9iaca02e180c928f06@mail.gmail.com> <48B853A6.80409@probo.com> Message-ID: <3ee0b280808291911x784d5140x891bb1c09cae8eb9@mail.gmail.com> On Fri, Aug 29, 2008 at 4:53 PM, Tim Roberts wrote: > geoff wrote: >> Hi Folks; >> >> I have an application that stores images in a database. >> When the images are extracted, we use the files extension and >> os.startwith("filename") to allows the OS to select the users >> desingated program to open the file. >> >> Sometimes ... this goes astray. For some mysterious reason, WinXP's >> file type associates get removed, atleast for TIF files. >> > > TIFF files are not normally associated with a program on Windows XP. > >> what I would like to do is that if os.startwith fails, try to open the >> file with a specific program. In the case of image files, the Ms >> Picture and Fax Viewer. >> >> How do I find the default path to an installed program ? >> Do I need the GUID and then look for the registry key ?? >> > > No, that doesn't work for applications, only for COM objects. > > However, in this specific case, you are in luck. The "Microsoft Picture > and FAX Viewer" happens to live inside of a system DLL, and that DLL > always lives in the Windows "system32" directory. So, you can do this: > rundll32.exe shimgvw.dll,ImageView_Fullscreen path\to\image\file.tiff > > Whitespace is important; don't put any before or after that "comma". > Thanks for that tip Tim. Can you point me in the right direction as to how to associate the MS Picture and FAX Viewer" as the associated program for TIFs ? g. BTW: it is os.startfile("path to file name") NOT os.startwith -- the mistake was mine, but thanks for understanding the meaning. From mc at mclaveau.com Sat Aug 30 18:52:21 2008 From: mc at mclaveau.com (Michel Claveau) Date: Sat, 30 Aug 2008 18:52:21 +0200 Subject: [python-win32] Pb IE8-b2 + Python like ActiveScripting language Message-ID: <0CF37A7FCD3A4621BB844DF4008C17F9@MCI1330> Hi! Impossible, for me, to use Python like ActiveScripting language, in a HTA, since IE-8 beta-2 installed. Run OK with IE5, IE6, IE7. But IE8 does not recognize Python (I however recorded several times python like language of ActiveScripting) Any idea or solution? -- Michel Claveau From timr at probo.com Sun Aug 31 06:29:53 2008 From: timr at probo.com (timr at probo.com) Date: Sat, 30 Aug 2008 21:29:53 -0700 Subject: [python-win32] os.startwith issue dealing with .tif (winxp) In-Reply-To: <3ee0b280808291911x784d5140x891bb1c09cae8eb9@mail.gmail.com>; from geoff on Fri, Aug 29, 2008 at 11:11:27PM -0300 References: <3ee0b280808291215p3304d7c9iaca02e180c928f06@mail.gmail.com> <48B853A6.80409@probo.com> <3ee0b280808291911x784d5140x891bb1c09cae8eb9@mail.gmail.com> Message-ID: <20080830212953.A5022@probo.com> On Fri, Aug 29, 2008 at 11:11:27PM -0300, geoff wrote: > > Thanks for that tip Tim. > Can you point me in the right direction as to how to associate the MS > Picture and FAX Viewer" as the associated program for TIFs ? On my system, shdocvw32 is already associated with EMF files. If that's true for you, then it's easy. From a command shell: C:\Etc>assoc .emf .emf=emffile C:\Etc>ftype emffile emffile=rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1 If yours looks like that, then you can just type this: assoc .tif=emffile assoc .tiff=emffile -- Tim Roberts, timr at probo.com Providenza & Boeklheide, Inc. From arunkakorp at gmail.com Sun Aug 31 20:27:54 2008 From: arunkakorp at gmail.com (Arun Kumar) Date: Sun, 31 Aug 2008 23:57:54 +0530 Subject: [python-win32] cannot create 'NoneType' instances Message-ID: <48BAE2AA.9090405@gmail.com> hi, I'm new to python as well as pywin. I'm having trouble with the following code: _ListenerBase = win32com.client.getevents("SAPI.SpSharedRecoContext") class _ListenerCallback(_ListenerBase): """Created to fire events upon speech recognition. Instances of this class automatically die when their listener loses a reference to its grammar. TODO: we may need to call self.close() to release the COM object, and we should probably make goaway() a method of self instead of letting people do it for us. """ def __init__(self, oobj, listener, callback): _ListenerBase.__init__(self, oobj) self._listener = listener self._callback = callback def OnRecognition(self, _1, _2, _3, Result): # When our listener stops listening, it's supposed to kill this # object. But COM can be funky, and we may have to call close() # before the object will die. if self._listener and not self._listener.islistening(): self.close() self._listener = None if self._callback and self._listener: newResult = win32com.client.Dispatch(Result) phrase = newResult.PhraseInfo.GetText() self._callback(phrase, self._listener) The error I get is: class _ListenerCallback(_ListenerBase): TypeError: Error when calling the metaclass bases cannot create 'NoneType' instances I went through the list archives and found a couple of messages regarding this, so I tried the following in an interactive shell: >>> lb = win32com.client.getevents("SAPI.SpSharedRecoContext") >>> type(lb) Can anyone point me in the right direction? Why is getevents returning a NoneType? How can I fix it? Thanks, Arun From larry.bates at websafe.com Sun Aug 31 21:01:16 2008 From: larry.bates at websafe.com (Larry Bates) Date: Sun, 31 Aug 2008 14:01:16 -0500 Subject: [python-win32] cannot create 'NoneType' instances In-Reply-To: <48BAE2AA.9090405@gmail.com> References: <48BAE2AA.9090405@gmail.com> Message-ID: Arun Kumar wrote: > hi, > I'm new to python as well as pywin. I'm having trouble with the > following code: > > _ListenerBase = win32com.client.getevents("SAPI.SpSharedRecoContext") > class _ListenerCallback(_ListenerBase): > > """Created to fire events upon speech recognition. Instances of this > class automatically die when their listener loses a reference to > its grammar. TODO: we may need to call self.close() to release the > COM object, and we should probably make goaway() a method of self > instead of letting people do it for us. > """ > > def __init__(self, oobj, listener, callback): > _ListenerBase.__init__(self, oobj) > self._listener = listener > self._callback = callback > > def OnRecognition(self, _1, _2, _3, Result): > # When our listener stops listening, it's supposed to kill this > # object. But COM can be funky, and we may have to call close() > # before the object will die. > if self._listener and not self._listener.islistening(): > self.close() > self._listener = None > > if self._callback and self._listener: > newResult = win32com.client.Dispatch(Result) > phrase = newResult.PhraseInfo.GetText() > self._callback(phrase, self._listener) > > The error I get is: > class _ListenerCallback(_ListenerBase): > TypeError: Error when calling the metaclass bases > cannot create 'NoneType' instances > > I went through the list archives and found a couple of messages > regarding this, so I tried the following in an interactive shell: > >>> lb = win32com.client.getevents("SAPI.SpSharedRecoContext") > >>> type(lb) > > > Can anyone point me in the right direction? Why is getevents returning a > NoneType? How can I fix it? > > Thanks, > Arun Sounds like oobj is None when you try to call the __init__ method of _ListenerBase. -Larry From arunkakorp at gmail.com Sun Aug 31 21:27:21 2008 From: arunkakorp at gmail.com (Arun Kumar) Date: Mon, 01 Sep 2008 00:57:21 +0530 Subject: [python-win32] cannot create 'NoneType' instances In-Reply-To: References: <48BAE2AA.9090405@gmail.com> Message-ID: <48BAF099.5050307@gmail.com> The problem appeared to have been with another error that I saw only when I restarted the machine and python. When I first try to import this module 'import speech' it fails with the error below. Subsequent calls to 'import speech' fail with the 'NoneType' error. File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 554, in AddModuleToCache? dict = mod.CLSIDToClassMap AttributeError? : 'module' object has no attribute 'CLSIDToClassMap' This error was being thrown up in the gencache.EnsureModule() call. I found some posts about deleting the gen_py directory, and retrying the import and it seems to be working now. Thanks, Arun Larry Bates wrote: > Arun Kumar wrote: >> hi, >> I'm new to python as well as pywin. I'm having trouble with the >> following code: >> >> _ListenerBase = win32com.client.getevents("SAPI.SpSharedRecoContext") >> class _ListenerCallback(_ListenerBase): >> >> """Created to fire events upon speech recognition. Instances of this >> class automatically die when their listener loses a reference to >> its grammar. TODO: we may need to call self.close() to release the >> COM object, and we should probably make goaway() a method of self >> instead of letting people do it for us. >> """ >> >> def __init__(self, oobj, listener, callback): >> _ListenerBase.__init__(self, oobj) >> self._listener = listener >> self._callback = callback >> >> def OnRecognition(self, _1, _2, _3, Result): >> # When our listener stops listening, it's supposed to kill this >> # object. But COM can be funky, and we may have to call close() >> # before the object will die. >> if self._listener and not self._listener.islistening(): >> self.close() >> self._listener = None >> >> if self._callback and self._listener: >> newResult = win32com.client.Dispatch(Result) >> phrase = newResult.PhraseInfo.GetText() >> self._callback(phrase, self._listener) >> >> The error I get is: >> class _ListenerCallback(_ListenerBase): >> TypeError: Error when calling the metaclass bases >> cannot create 'NoneType' instances >> >> I went through the list archives and found a couple of messages >> regarding this, so I tried the following in an interactive shell: >> >>> lb = win32com.client.getevents("SAPI.SpSharedRecoContext") >> >>> type(lb) >> >> >> Can anyone point me in the right direction? Why is getevents >> returning a NoneType? How can I fix it? >> >> Thanks, >> Arun > > Sounds like oobj is None when you try to call the __init__ method of > _ListenerBase. > > -Larry > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: