In the Python module proposed above, the program has a bug on the lines load "(EF) planar on contour" :
Exception has occurred: com_error
(-2147352573, 'Membre introuvable.', None, None)
File "C:\test.py", line 61, in FlashLoadRecordDescription rec.Description = f"UniqueID: {rec.UniqueId} {rec.Description or ''}".rstrip() File "C:\test.py", line 96, in <module> if __name__ == "__main__": FlashLoadRecordDescription() pywintypes.com_error: (-2147352573, 'Membre introuvable.', None, None)
The error you encountered is not a bug in the code, but a limitation of Robot’s COM type system. The types: IRobotLoadRecordThermalIn3Points, IRobotLoadRecordLinear3D, and IRobotLoadRecordIn3Points do not implement IRobotLoadRecord2, which is the interface that exposes the UniqueId property for the other 21.
These 3 record types inherit only from the IRobotLoadRecord interface, which does not provide UniqueId.
In addition, when using Python via pywin32, CastTo may fail for Robot COM types, even when they technically implement IRobotLoadRecordCommon. This means that filtering of records using IsAutoGenerated cannot be done and all records will be “flashed”. One possible approach could be to use pythonnet to access the .NET COM interfaces, where casting behaves like in C#.
Stéphane Kapetanovic
Did you find this post helpful? If it gave you one or more solutions,
don't forget to click the Accept Solution button and leave a < like !
