Problem
The mtconnect Python library (PyPI package) cannot parse device XML files fetched directly from real Haas CNC machines via the /probe endpoint. This prevents using authentic machine configurations.
Error
ValueError: Missing required id for MTC
Root Cause
xmlhelper.py has two limitations:
- No XML namespace support
Real Haas probe responses use MTConnect 1.2 namespaces:
<MTConnectDevices xmlns="urn:mtconnect.org:MTConnectDevices:1.2" ...>
The library uses simple element.find("Device") calls. With namespaces, tags become {urn:mtconnect.org:MTConnectDevices:1.2}Device, so find("Device") returns None.
- Assumes Device elements are direct children of root
Real probe responses have a
and wrapper:
<MTConnectDevices>
<Header .../>
<Devices>
<Device id="dev1" ...>
The library iterates list(root), expecting Device elements. Instead it gets Header (no id attribute) and Devices (wrapper, also no id), triggering the error.
Workaround
Use a manually created XML without namespaces and without the wrapper.
Proposed Fix
Patch xmlhelper.py to:
Strip XML namespaces from element tags
Skip <Header> elements
Unwrap <Devices> container to find actual Device elements
Problem
The mtconnect Python library (PyPI package) cannot parse device XML files fetched directly from real Haas CNC machines via the /probe endpoint. This prevents using authentic machine configurations.
Error
ValueError: Missing required id for MTCRoot Cause
xmlhelper.py has two limitations:
Real Haas probe responses use MTConnect 1.2 namespaces:
<MTConnectDevices xmlns="urn:mtconnect.org:MTConnectDevices:1.2" ...>The library uses simple
element.find("Device")calls. With namespaces, tags become{urn:mtconnect.org:MTConnectDevices:1.2}Device, sofind("Device")returns None.Real probe responses have a
and wrapper:The library iterates
list(root), expectingDeviceelements. Instead it getsHeader(no id attribute) andDevices(wrapper, also no id), triggering the error.Workaround
Use a manually created XML without namespaces and without the wrapper.
Proposed Fix
Patch
xmlhelper.pyto:Strip XML namespaces from element tags
Skip
<Header>elementsUnwrap
<Devices>container to find actual Device elements