Hi, this is my first attempt at using your API to automate some analysis of SPEOS results.
Upon selecting the location of the xmp file I want to work with, the script fails (line 34).
Please help me understand what I'm doing incorrectly to help me get started with what looks like a very useful API!
In [9]: %run template.py
---------------------------------------------------------------------------
COMError Traceback (most recent call last)
File ~\Documents\CREO_work\scripts\automation\template.py:40
36 path_export = getfilename("*.txt", True)
37 xmp.export_template_measures(path_xml, path_export)
---> 40 main()
File ~\Documents\CREO_work\scripts\automation\template.py:34, in main()
32 xmp = DpfXmpViewer()
33 path_xmp = getfilename("*.xmp")
---> 34 xmp.open_file(path_xmp)
35 path_xml = getfilename("*.xml")
36 path_export = getfilename("*.txt", True)
File ~\AppData\Roaming\SpaceClaim\Published Scripts\ansys_optical_automation\post_process\dpf_xmp_viewer.py:361, in DpfXmpViewer.open_file(self, str_path)
359 self.source_list = []
360 if self.dpf_instance.MapType == 2 or self.dpf_instance.MapType == 3:
--> 361 self.__get_source_list()
362 else:
363 raise ImportError("Opening the file failed.")
File ~\AppData\Roaming\SpaceClaim\Published Scripts\ansys_optical_automation\post_process\dpf_xmp_viewer.py:575, in DpfXmpViewer.__get_source_list(self)
573 for layer in range(total_sources):
574 name = automation.VARIANT()
--> 575 self.dpf_instance.ExtendedGetSourceName(layer, pointer(name))
576 self.source_list.append(name.value[0])
577 return self.source_list
File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\comtypes\client\dynamic.py:111, in _Dispatch.__getattr__(self, name)
109 dispid = self._ids.get(name)
110 if not dispid:
--> 111 dispid = self._comobj.GetIDsOfNames(name)[0]
112 self._ids[name] = dispid
114 if name in self._methods:
File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\comtypes\automation.py:725, in IDispatch.GetIDsOfNames(self, *names, **kw)
723 arr = (c_wchar_p * len(names))(*names)
724 ids = (DISPID * len(names))()
--> 725 self.__com_GetIDsOfNames(riid_null, arr, len(names), lcid, ids)
726 return ids[:]
COMError: (-2147352570, 'Unknown name.', (None, None, None, 0, None))