#136 TypeError: can't use string pattern on a bytes-like object

v2.6
closed-fixed
Chris Liechti
None
5
2014-09-19
2012-12-14
Anonymous
No

In list_ports_posix.py, in usb_lsusb_string

gen_ports = list_ports.comports()
File "/usr/local/lib/python3.2/dist-packages/serial/tools/list_ports_posix.py", line 122, in comports
return [(d, describe(d), hwinfo(d)) for d in devices]
File "/usr/local/lib/python3.2/dist-packages/serial/tools/list_ports_posix.py", line 122, in <listcomp>
return [(d, describe(d), hwinfo(d)) for d in devices]
File "/usr/local/lib/python3.2/dist-packages/serial/tools/list_ports_posix.py", line 93, in describe
return usb_lsusb_string(sys_usb)
File "/usr/local/lib/python3.2/dist-packages/serial/tools/list_ports_posix.py", line 71, in usb_lsusb_string
iManufacturer = re_group('iManufacturer\s+\w+ (.+)', desc)
File "/usr/local/lib/python3.2/dist-packages/serial/tools/list_ports_posix.py", line 44, in re_group
m = re.search(regexp, text)
File "/usr/lib/python3.2/re.py", line 161, in search
return _compile(pattern, flags).search(string)
TypeError: can't use a string pattern on a bytes-like object

Related

Bugs: #138

Discussion


  • Anonymous
    2012-12-14

    Uploaded a change that lets this work correctly for me here:

    Kubuntu 12.10 64bit
    Python 3.2.3

     

  • Anonymous
    2012-12-14

    chmorgan@gmail.com is my email. sourceforge isn't doing a great job linking my account via openid.....

     
  • YodaDaCoda
    YodaDaCoda
    2013-06-07

    This bug affects pyserial on my raspberry pi (using python v3.2). Above patch successfully fixes the problem.

     
    Last edit: YodaDaCoda 2013-06-07
  • Chris Liechti
    Chris Liechti
    2013-10-12

    • status: open --> closed-fixed
    • assigned_to: Chris Liechti
    • Group: --> v2.6
     
  • Chris Liechti
    Chris Liechti
    2013-10-12

    I see, unfortunately the simple fix with the "b" string prefix is not working as pySerial currently also supports Python 2.5, which does not know that yet.

    However, it should be fixed with a different workaround in r455 (fix for Bug 3518380, old SF numbering)