diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2012-08-16 02:13:53 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2012-08-16 02:13:53 +0000 |
commit | d3919081ab599bdb17e476fe3049f8f7451dd893 (patch) | |
tree | 1d4e0f77b15ac295d7fb179a6c73cf3cb96ff76c | |
parent | 2127db6f279f1ab0b7e4ddc2df89f03269d7de3f (diff) | |
download | pyserial-d3919081ab599bdb17e476fe3049f8f7451dd893.tar.gz |
improve python 3 compatibility [Bug 3518380]
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@455 f19166aa-fa4f-0410-85c2-fa1106f25c8a
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | serial/tools/list_ports_posix.py | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 8a8e224..8359d28 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -450,6 +450,7 @@ Bugfixes (posix): - [Patch 3462364] Fix: NameError: global name 'base' is not defined - list_ports and device() for BSD updated (Anders Langworthy) +- [Bug 3518380] python3.2 -m serial.tools.list_ports error Bugfixes (win32): diff --git a/serial/tools/list_ports_posix.py b/serial/tools/list_ports_posix.py index 7913d81..974c037 100644 --- a/serial/tools/list_ports_posix.py +++ b/serial/tools/list_ports_posix.py @@ -41,7 +41,11 @@ def read_line(filename): def re_group(regexp, text):
"""search for regexp in text, return 1st group on match"""
- m = re.search(regexp, text)
+ if sys.version < '3':
+ m = re.search(regexp, text)
+ else:
+ # text is bytes-like
+ m = re.search(regexp, text.decode('ascii', 'replace'))
if m: return m.group(1)
|