UAVCAN with Python 3.7 issue?

Pavel,
I am running uavcan_gui_tool on MacOS X, however I am seeing these errors in the logs. Any idea how to fix? It seems to be preventing the online nodes from showing up in the gui.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/node.py", line 195, in call_handlers
    wrapper(transfer)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/node.py", line 169, in call
    result = handler(event, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/app/node_monitor.py", line 184, in _on_node_status
    priority=self.TRANSFER_PRIORITY, callback=self._on_info_response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/node.py", line 427, in request
    request_not_response=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/transport.py", line 664, in __init__
    payload_bits = payload._pack()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/transport.py", line 606, in _pack
    return ''.join(field._pack(tao and last) for _, last, field in enum_mark_last(self._fields.values()))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/transport.py", line 606, in <genexpr>
    return ''.join(field._pack(tao and last) for _, last, field in enum_mark_last(self._fields.values()))
RuntimeError: generator raised StopIteration
2018-10-13 22:30:19,192 ERROR uavcan.node Transfer handler exception
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/transport.py", line 127, in enum_mark_last
    last = next(it)
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/node.py", line 195, in call_handlers
    wrapper(transfer)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/node.py", line 169, in call
    result = handler(event, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/app/node_monitor.py", line 184, in _on_node_status
    priority=self.TRANSFER_PRIORITY, callback=self._on_info_response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/node.py", line 427, in request
    request_not_response=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/transport.py", line 664, in __init__
    payload_bits = payload._pack()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/transport.py", line 606, in _pack
    return ''.join(field._pack(tao and last) for _, last, field in enum_mark_last(self._fields.values()))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan/transport.py", line 606, in <genexpr>
    return ''.join(field._pack(tao and last) for _, last, field in enum_mark_last(self._fields.values()))
RuntimeError: generator raised StopIteration

The GUI tool uses an older version of PyUAVCAN by default, which doesn’t yet support Python 3.7. You can fix this by upgrading to the current master of PyUAVCAN, which incorporates the fix.

First off, I am on OSX, I checked out the master branch for PyUAVCAN which has the fix, however, I have a question on installation. My System has both python 2.7 and python 3.7 .

The confusion for me, comes down to installation of PyUAVCAN into the correct directory.

For some reason, PyUAVCAN is installed in 2 different locations (and they are different versions)

/Library/Python/2.7/site-packages/uavcan (pip install uavcan also only looks at 2.7 directory )

and

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/uavcan

When I run:

./setup.py build && ./setup.py install

it only seems to look at: the 2.7 path

i.e this is the output:

Checking .pth file support in /Library/Python/2.7/site-packages/

/usr/bin/python -E -c pass

TEST PASSED: /Library/Python/2.7/site-packages/ appears to support .pth files

Is there an option I am missing to build install PyUAVCAN for Python 3.7 ?

Instead of ./setup.py build && ./setup.py install try running python3.7 setup.py build && python3.7 setup.py install.

Well that was easy! Specifying python3.7 fixed the build issue.

thanks.

and also fixed the issue with the exceptions being thrown.