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

[system-health] Make run_command() Python 3-compliant #6371

Merged
merged 2 commits into from
Jan 7, 2021
Merged

[system-health] Make run_command() Python 3-compliant #6371

merged 2 commits into from
Jan 7, 2021

Conversation

jleveque
Copy link
Contributor

@jleveque jleveque commented Jan 6, 2021

- Why I did it

  • 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.

- How I did it

- How to verify it

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

@jleveque
Copy link
Contributor Author

jleveque commented Jan 6, 2021

@Junchao-Mellanox, @keboliu, @aravindmani-1: Please review.

@lgtm-com

This comment has been minimized.

@lguohan lguohan merged commit 2d77a36 into sonic-net:master Jan 7, 2021
@jleveque jleveque deleted the healthd_py3_bug branch January 7, 2021 17:59
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants