Bugs item #841597, was opened at 2003-11-13 18:09
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=841597&group_id=78018
Category: com
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Stephen White (swhite)
Assigned to: Nobody/Anonymous (nobody)
Summary: [PATCH] win32com doesn't work with Sun's Java/ActiveX Bridge
Initial Comment:
Having created an ActiveX/COM object using Sun's
Java/ActiveX bridge I found it worked fine in VBA and
also using Perl's Win32::OLE - but was disappointed to
find it didn't work in Python.
>>> import win32com.client
>>> o = win32com.client.Dispatch("Simple.Bean")
>>> o.Greeting()
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "win32com\client\dynamic.py", line 471, in
__getattr__
raise pythoncom.com_error, details
com_error: (-2147352567, 'Exception occurred.', (0,
None, 'java.lang.NullPointerException', None, 0,
-2147352567), None)
Read/write access to attributes did work, which I found
puzzling so I checked the code. It would appear that
win32com relies on access to an attribute returning
'ERRORS_BAD_CONTEXT' when it doesn't exist, in which
case win32com then tries the equivalent method. Sun's
Java/ActiveX bridge isn't returning this error code, so
win32com never tries to execute the method.
The attached patch causes win32com to operate correctly
in this case.
I'm not very familiar with COM so I'm not sure if it's
Java or win32com at fault here, or if there's a better
fix, but this one works for me.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=841597&group_id=78018
|