[python-win32] win32Com.gencache.EnsureDispatch Problems

Vinay Anantharaman vinaya at adobe.com
Fri Aug 22 01:33:19 CEST 2008


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 "<stdin>", 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: <http://mail.python.org/pipermail/python-win32/attachments/20080821/5590f1c7/attachment.htm>


More information about the python-win32 mailing list