[system-health] Make run_command() Python 3-compliant#6371
Merged
lguohan merged 2 commits intosonic-net:masterfrom Jan 7, 2021
jleveque:healthd_py3_bug
Merged
[system-health] Make run_command() Python 3-compliant#6371lguohan merged 2 commits intosonic-net:masterfrom jleveque:healthd_py3_bug
run_command() Python 3-compliant#6371lguohan merged 2 commits intosonic-net:masterfrom
jleveque:healthd_py3_bug
Conversation
Contributor
Author
|
@Junchao-Mellanox, @keboliu, @aravindmani-1: Please review. |
This comment has been minimized.
This comment has been minimized.
Junchao-Mellanox
approved these changes
Jan 7, 2021
aravindmani-1
approved these changes
Jan 7, 2021
lguohan
approved these changes
Jan 7, 2021
lguohan
pushed a commit
that referenced
this pull request
Jan 9, 2021
Pass universal_newlines=True parameter to subprocess.Popen(); no longer use .encode('utf-8') on resulting stdout.
This was missed in #5886
Note: I would prefer to use text=True instead of universal_newlines=True, as the former is an alias only available in Python 3 and is more understandable than the latter. However, Even though the setup.py file for this package only specifies Python 3, the LGTM tool finds other Python 2 code in the repo and validates the code as Python 2 code and alerts that text=True is an invalid parameter. Will stick with universal_newlines=True for now. Once all Python code in the repo has been converted to Python 3, I will change all universal_newlines=True to text=True.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
- Why I did it
universal_newlines=Trueparameter tosubprocess.Popen(); no longer use.encode('utf-8')on resulting stdout.This was missed in #5886
Note: I would prefer to use
text=Trueinstead ofuniversal_newlines=True, as the former is an alias only available in Python 3 and is more understandable than the latter. However, Even though the setup.py file for this package only specifies Python 3, the LGTM tool finds other Python 2 code in the repo and validates the code as Python 2 code and alerts thattext=Trueis an invalid parameter. Will stick withuniversal_newlines=Truefor now. Once all Python code in the repo has been converted to Python 3, I will change alluniversal_newlines=Truetotext=True.- How I did it
- How to verify it
- Which release branch to backport (provide reason below if selected)