NameError: global name ‘base’ is not defined

I was facing this error:

$ python Spectrogram.py 
Traceback (most recent call last):
  File "Spectrogram.py", line 22, in 
    devices = SerialPortDevice.enumerate_devices()
  File "/comum/workspace/adafruit_guide_fft-master/SerialPortDevice.py", line 68, in enumerate_devices
    return [SerialPortDevice(port[0], port[1]) for port in serial.tools.list_ports.comports() if port[2] != 'n/a']
  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

Then I found this “pyserial_patch.diff” patch:
http://sourceforge.net/p/pyserial/patches/26/

After editing the list_ports_posix.py the error message disappeared:

$ sudo vi /usr/lib/python2.7/dist-packages/serial/tools/list_ports_posix.py

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s