forked from platformio/platformio-core
Fix error with unicode for serial ports description
This commit is contained in:
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (2, 8, "0.dev4")
|
VERSION = (2, 8, "0.dev5")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -272,9 +272,18 @@ def get_serialports():
|
|||||||
from serial.tools.list_ports import comports
|
from serial.tools.list_ports import comports
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise exception.GetSerialPortsError(os.name)
|
raise exception.GetSerialPortsError(os.name)
|
||||||
result = [{"port": p, "description": unicode(d, errors='ignore'),
|
|
||||||
"hwid": h}
|
result = []
|
||||||
for p, d, h in comports() if p]
|
for p, d, h in comports():
|
||||||
|
if not p:
|
||||||
|
continue
|
||||||
|
if "windows" in get_systype():
|
||||||
|
try:
|
||||||
|
d = unicode(d, errors="ignore")
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
result.append({"port": p, "description": d, "hwid": h})
|
||||||
|
|
||||||
# fix for PySerial
|
# fix for PySerial
|
||||||
if not result and system() == "Darwin":
|
if not result and system() == "Darwin":
|
||||||
for p in glob("/dev/tty.*"):
|
for p in glob("/dev/tty.*"):
|
||||||
|
Reference in New Issue
Block a user