[python-win32] Seemingly identical COM-calls fail in Python client but work in other client

Michael Gebhardt tmic.mailinglist at gmail.com
Fri Oct 16 15:46:16 CEST 2009


Hi!

I am trying to control the electromagnetic simulator CST Microwave Studio
from Python using COM automation, and I am experiencing trouble:

>From Matlab, I use the following calls:

cst = actxserver('CSTStudio.Application');               % Launch the
simulator application
mws = invoke(cst, 'OpenFile', 'my_project_file.cst'); % Open simulation
project file
a_s11 = invoke(mws, 'Result1D', 'a1(1)1(1)');  % Acces a previously
caculated result
N = invoke(a_s11, 'GetN');  % Get number of samples in result

Everything works fine from Matlab. When I use Python,l however, I find
myself in trouble when I attempt to create the "Result1D" object:

import win32com.client
cst = win32com.client.Dispatch("CSTStudio.Application")
mws = cst.OpenFile("my_project_file.cst")
# So far, everything is fine, the program starts, and the file opens, but
from here on...
a_s11 = mws.Result1D("a1(1)1(1)")

... I get the following traceback:
[C:AbstractMeas/src]|54> mycst.mws.Result1D("a1(1)1(1)")
-----------------------------------------------------------------------
com_error                                 Traceback (most recent call last)

C:\Users\emicgeb\workspace\AbstractMeas\src\<ipython console> in <module>()

C:\Python26\lib\site-packages\win32com\client\dynamic.pyc in Result1D(self,
*args)

com_error: (-2147417851, 'The server threw an exception.', None, None)


I have no idea what has gone wrong. Any suggestions how I could find out
what's going on?

I'm using dynamic dispatch (can't find anything that seems suitable to run
through makepy.py... :-( ? ). Python 2.6.3, pywin32-214.

I would appreciate any help or suggestions.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20091016/b8ee1102/attachment.htm>


More information about the python-win32 mailing list