Skip to content

Conversation

sam-bristow
Copy link
Contributor

The UART example was using the older pySerial API which was deprecated in v3.0. I have updated the example code to use the context-manager API which is clearer, shorter, and less error-prone.

I've also gone through and updated the remaining print statements to print() function calls while I was in there.

Low-hanging fruit of Python3 compatibility work.

I've left fix_py_compile.py as it is only ever going to be run under
Python 2.
Version 3.0 of python-serial introduced an updated API, we may as well
use it.

This change also uses context-managers for dealing with UARTs as they
are less error-prone and the code is much cleaner/shorter.
@pdp7
Copy link
Collaborator

pdp7 commented Oct 9, 2018

@sam-bristow thanks for making this PR.

Do you know if this change for the new python-serial API break backwards compatibility?

@sam-bristow
Copy link
Contributor Author

That change is purely documentation so it wont make any difference the library's compatibility.
The context-manager API I have used in the updated examples has been around for at least 3 years.

@pdp7 pdp7 merged commit 32b1f7e into adafruit:master Oct 11, 2018
@pdp7
Copy link
Collaborator

pdp7 commented Oct 11, 2018

@sam-bristow thanks!

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.

2 participants