"NameError: global name 'base' is not defined"


I’m getting the following error when I try to get_uarm(). Can anyone help me to solve it?

version: pyuarm-

import pyuarm
uarm = pyuarm.get_uarm()
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.7/dist-packages/pyuarm/uarm.py”, line 27, in get_uarm
File “/usr/local/lib/python2.7/dist-packages/pyuarm/tools/list_uarms.py”, line 8, in uarm_ports
File “/usr/lib/python2.7/dist-packages/serial/tools/list_ports_posix.py”, line 122, in comports
return [(d, describe(d), hwinfo(d)) for d in devices]
File “/usr/lib/python2.7/dist-packages/serial/tools/list_ports_posix.py”, line 93, in describe
return usb_lsusb_string(sys_usb)
File “/usr/lib/python2.7/dist-packages/serial/tools/list_ports_posix.py”, line 80, in usb_lsusb_string
return base
NameError: global name ‘base’ is not defined

I think the issue was related to your OS, could you give some information about your OS?

“pyuarm” use a tool to list all COM ports of your computer, then filtered by a pre-defined string left only uarm’s COM port, the tool belongs to library “serial” which come from python official library, you can checkout the tool using the python interpreter to figure out if that’s the problem:

duke@duke-uf ~ $ python
Python 3.5.2 (default, Jul 28 2016, 18:18:57) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from serial.tools import list_ports
>>> for i in list_ports.comports():
...     print(i)
/dev/ttyS0 - ttyS0

This works well both on python2 and python3, maybe you can just try python3 when you get problems in python2.