Fix error with non unicode chars in serial port description

This commit is contained in:
Ivan Kravets committed 2016-01-25 23:42:43 +02:00
1 parent 3ce32e54b2
commit d2f3b76132
3 files changed
+4 -2

No files matched your search

+2 -1
View File
@@ -272,7 +272,8 @@ def get_serialports():
from serial.tools.list_ports import comports
except ImportError:
raise exception.GetSerialPortsError(os.name)
result = [{"port": p, "description": d, "hwid": h}
result = [{"port": p, "description": unicode(d, errors='ignore'),
"hwid": h}
for p, d, h in comports() if p]
# fix for PySerial
if not result and system() == "Darwin":