PythonCOM syntax question

logistix logstx at bellatlantic.net
Mon Apr 29 21:41:09 EDT 2002


The problem is that Field is a property, and Call is a method.  If you can
take a look at the IDL (and make sense of it) that shows how the native
calls get tranlated into COM.  I can't remember offhand how PythonCM deals
with properties, but if you use the MakePy utility under tools in PythonWin,
then pythonwin's autocomplete stuff should make it pretty easy to locate the
appropriate function names.

--
-

"Greg Pierce" <greg at turtleprod.com> wrote in message
news:mailman.1020109433.4914.python-list at python.org...
I'm trying to interact with the Navision Axapta ERP package via it's COM
connector...and I'm having trouble with particular types of calls.  I'm
hoping someone can help me if there's some syntax problem I'm having.

I'm able to create the Axapta COM objects and can call certain methods on
them, but not others.  I'm no COM expert, but there is a difference in the
method specs that I can see.  Those that I _cannot_ call all have a "get" in
the API documentation for Axapta -- like this:

HRESULT get_Field( [in] VARIANT field, [out, retval] VARIANT *pVal );

Those that I _can_ call don't -- like this:

HRESULT Call(  [in] BSTR bstrMethod, [in, optional] VARIANT v1,  [out,
retval] VARIANT *pResult);

Is there some different syntax I should need to use in Python to access
those "get" methods?

This code in VB works ( where "buffer" is an already created COM object) :

MyValue = buffer.Call( "openBalanceMST" )
AccountNumber = buffer.Field("AccountNum")

But in Python, the "call" line works, and then the "field" line returns a
"com_error: (-2147352573, 'Member not found.', None, None)"

Any ideas?  Did that explanation make sense?

Thanks,

g.









More information about the Python-list mailing list