PythonCOM syntax question

Noah noah at noah.org
Mon Apr 29 22:33:36 EDT 2002


Probably you need to add .Value() like this:
	AccountNumber	= buffer.Field("AccountNum").Value()

One thing I find very helpful is to use the
'COM Makepy utility'. I launch it from PythonWin
under the 'Tools' menu. Afterwards you can use the
Interactive Window to manually create your objects.
PythonWin will then do autocompletion on your COM objects.
I find this very helpful to identify what
fields and methods Python can see.

So you might type
	buffer.
and as soon as you hit the '.' you would like a list
of fields and methods that you can access.

Yours,
Noah

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Greg Pierce
Sent: Monday, April 29, 2002 12:43 PM
To: python-list at python.org
Subject: PythonCOM syntax question


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