Fix error with non unicode chars in serial port description

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

View File

@ -1,2 +1,3 @@
.pioenvs
.clang_complete
.gcc-flags.json

View File

@ -14,7 +14,7 @@
import sys
VERSION = (2, 8, "0.dev3")
VERSION = (2, 8, "0.dev4")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

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":