Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Python 3.7 pyserial issue #3

Merged
merged 2 commits into from
Apr 24, 2020
Merged

fix Python 3.7 pyserial issue #3

merged 2 commits into from
Apr 24, 2020

Conversation

gjmvervoort
Copy link
Contributor

[gert@mars bc125csv]$ echo -en "PRG\nBLT,AO\nEPG" | bc125csv shell
Traceback (most recent call last):
File "/usr/local/bin/bc125csv", line 11, in
load_entry_point('bc125csv==1.0.1', 'console_scripts', 'bc125csv')()
File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/handler.py", line 386, in main
File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/handler.py", line 182, in handle
File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/handler.py", line 286, in command_shell
File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/handler.py", line 220, in get_scanner
File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/scanner.py", line 149, in get_model
File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/scanner.py", line 120, in send
File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/scanner.py", line 115, in writeread
File "/usr/lib/python3.7/site-packages/serial/serialposix.py", line 532, in write
d = to_bytes(data)
File "/usr/lib/python3.7/site-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: 'MDL\r'
[gert@mars bc125csv]$

…code to bytes

[gert@mars bc125csv]$ echo -en "PRG\nBLT,AO\nEPG" | bc125csv shell
Traceback (most recent call last):
  File "/usr/local/bin/bc125csv", line 11, in <module>
    load_entry_point('bc125csv==1.0.1', 'console_scripts', 'bc125csv')()
  File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/handler.py", line 386, in main
  File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/handler.py", line 182, in handle
  File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/handler.py", line 286, in command_shell
  File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/handler.py", line 220, in get_scanner
  File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/scanner.py", line 149, in get_model
  File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/scanner.py", line 120, in send
  File "/usr/local/lib/python3.7/site-packages/bc125csv-1.0.1-py3.7.egg/bc125csv/scanner.py", line 115, in writeread
  File "/usr/lib/python3.7/site-packages/serial/serialposix.py", line 532, in write
    d = to_bytes(data)
  File "/usr/lib/python3.7/site-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: 'MDL\r'
[gert@mars bc125csv]$
@vdeville
Copy link

Hello @gjmvervoort
Thanks for this fix

@vdeville
Copy link

@fdev can you merge this to master ? Thanks

@fdev
Copy link
Owner

fdev commented Apr 24, 2020

Thank you @gjmvervoort for the pull request and fixing the code for Python 3.7. My apologies I could not get around to merging your code sooner. 🙏

@fdev fdev merged commit 8a1ba59 into fdev:master Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants