-
Notifications
You must be signed in to change notification settings - Fork 38
Handle encoding error in mks_g_series driver #19
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
Open
ScottSoren
wants to merge
1
commit into
CINF:master
Choose a base branch
from
ScottSoren:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR, but the default behavior of decode() without arguments has changed from 'ascii' to 'utf-8'. Most likely, the intention is that it should be ascii and getting bytes that cannot be decoded as ascii is a communications error. So trying to decode as utf-8 might in principle allow scrambled message to be decoded and the fault will appear somewhere else. I suggest to explicitely add the 'ascii' argument to decode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing from ascii to utf-8 was actually the first thing I tried. I changed, a few lines above in the same function,
com_string = com_string.encode('ascii')
to
com_string = com_string.encode('utf-8')
Gave the same error message. But of course in hindsight that makes sense, after I figured out it was the returning message that gave the error.
Strangely, though, this wasn't a problem before updating the rest of the drive to Robert's version. It's not a py2 vs py3 thing since I tried both...
I'll try your suggestion, and make a new pull request if it works, next time I have down time between experiments at my setup. It's a kind of tedious process to edit in on the rasppi (a requirement so that I can test it) and then copy it over to my fork to pull request it, but I think it's worth it for now so you can suggest changes just like this.