tbird20d / grabserial

Grabserial - python-based serial dump and timing program - good for embedded Linux development
GNU General Public License v2.0
198 stars 79 forks source link

command string - TypeError: unicode strings are not supported, please encode to bytes #22

Closed mungewell closed 6 years ago

mungewell commented 6 years ago

When attempting to send a serial command on startup I get the following errror.

smart@smart:~/grabserial-master$ python3 ./grabserial -T -b 115200 -d /dev/ttyUSB0 -c 'logcat -c;logcat -vtime'
Traceback (most recent call last):
  File "./grabserial", line 530, in <module>
    grab(sys.argv[1:])
  File "./grabserial", line 402, in grab
    sd.write(command + "\n")
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 532, in write
    d = to_bytes(data)
  File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 63, in to_bytes
    raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: 'logcat -c;logcat -vtime\n'

Using Python3 on Xubuntu. Fails on xfce-term and xterm.

tbird20d commented 6 years ago

I just did a big sweep through grabserial to try to fix all unicode string issues (especially with Python 3). Can you try grabserial version 1.9.8, and let me know if you are still having problems.

Thanks, -- Tim