SigmaStudio COM interface Python example fails
I'm trying to put together a demo on Windows that will use a Python (3.8) program to retrieve some I2C values from peripherals in a Sigma Studio schematic. (it's an A2B network schematic). I followed the directions here for the win32com client:
https://wiki.analog.com/resources/tools-software/sigmastudio/usingsigmastudio/scripting/python
correcting for the version number (the wiki was written for 4.0, I'm using 4.5)
The example fails on line 26:
server.set_object_property('setName', 'Tone1', 'sineWave1')
File "D:/projects/adi_ss/scripting/example/ss_test.py", line 26, in <module>
server.set_object_property('setName', 'Tone1', 'sineWave1')
File "<COMObject Analog.SigmaStudioServer.SigmaStudioServer>", line 2, in set_object_property
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Analog.SigmaStudioServer', 'Index was outside the bounds of the array.', None, 0, -2146233080), None)
Does this indicate that something in the COM interface has changed since the wiki was written? If I'm reading it right the documentation seems to imply that should have worked?
Thanks,
Brewster
sigmastudio
python
scripting
sigmastudio bug_report
Hello Brewster,
I ran into this same issue a few months ago.
The solution in this case is to add three additional params set to 0. This is only needed for the setName invocations:
server.set_object_property('setName', 'Tone1', 'sineWave1', 0, 0, 0)
Curiously, the original code works on some PCs but not others - even with exactly the same SigmaStudio, Python, and win32com library versions. At this time we are not sure why this is the case.
Joshua
Thanks for the speedy reply - there is no way I would have guessed at that one...
for anyone else that stumbles on this thread, there's a small (but obvious) typo in the example:
# # Connect objects server.connect_object('sineWave1', 0, 'Output1', 0)
should be
# # Connect objects
server.connect_object('sineWave1', 0, 'Output1', 0)
Fixed.
Please log in to reply.