COM error/exception in Python, but not in VB (no dispatch interface available)
Jason R. Coombs
jaraconospam at jaraco.com
Mon Jan 28 16:23:37 EST 2002
Hi all. I hope there's someone out there that might know the intricacies of
Python and COM enough to help narrow this problem down. I realize this post
is a bit long and perhaps tedious, but I wanted to be sure to communicate
the problem clearly. Feel free to skim the technical details first to get
an overview of the problem.
I'm using a library from SoftwareFX called Image Toppings. It takes images
and draws vector graphics on top.
I've got VBScript that works:
<%
Set itc = Server.CreateObject( "ImageToppings.Server" )
itc.Load( "c:\projects\cmc\JNC-OEC.itf" )
%>
<%=itc.GetHTMLTag( "PNG", FALSE )%>
It generates the image and everything runs great.
However, the equivalent Python fails.
<%
import win32com.client
itc = win32com.client.Dispatch( 'ImageToppings.Server' )
itc.Load( 'c:\\projects\\cmc\\JNC-OEC.itf' )
%>
<%=itc.GetHTMLTag( 'PNG', 0 )%>
The error I get is:
Python ActiveX Scripting Engine (0x80020009)
Traceback (innermost last):
File "<Script Block >", line 5, in ?
Response.Write(itc.GetHTMLTag( 'PNG', 0, 'BORDER=0' ))
File "C:\Program
Files\Python\win32com\gen_py\1EA1AA40-466C-11D3-B8B0-00105A273451x0x1x0.py",
line 56, in GetHTMLTag
return self._ApplyTypes_(0x6, 1, (24, 32), ((8, 1), (11, 1), (8, 49),
(8, 49)), 'GetHTMLTag', None,swType, bMap, swImageAttr, swUseThisImage)
File "C:\Program Files\Python\win32com\client\__init__.py", line 343, in
_ApplyTypes_
return self._get_good_object_(apply(self._oleobj_.InvokeTypes, (dispid,
0, wFlags, retType, argTypes) + args), user, resultCLSID)
COM Error: Object has no dispatch interface available.
The documentation for GetHTMLTag specifies 4 parameters: a required file
type (string either 'PNG' or 'JPEG'), a required boolean value (whether to
generate image map), an optional string of image attributes, and an optional
string of a file to use.
I'm using other Software FX components via Python successfully. I am not
using any Python components that require boolean parameters. I'm wondering
if that could be the issue here. Could it be that the InvokeTypes won't
create a variant boolean?
I have not been able to successfully use this component with Python, and I
need to be able to do so. I've tried passing different parameters; I've
tried assigning the result to a variable; I've tried passing (0 == 1)
instead of 0 for the boolean (second) parameter, but this has no effect.
I will pay for technical support, but I need to know where to go. Is this a
python issue or an issue with their component? Can I identify for which
object there is no dispatch interface available? Can I tell from the
traceback if it's the return value or a parameter?
Obviously, I've already run make_py on the appropriate object. Do I maybe
need to make_py on another interface? If that's a possibility, how could I
know which one?
Any suggestions are greatly appreciated.
Jason
More information about the Python-list
mailing list