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

[sffbase] Make convert_hex_to_string() compatible with both Python 2 and Python 3 #165

Merged
merged 1 commit into from
Feb 10, 2021
Merged

Conversation

jleveque
Copy link
Contributor

@jleveque jleveque commented Feb 6, 2021

When called with Python 3, str.strip(binascii.unhexlify(ret_str)) will raise an exception: descriptor 'strip' requires a 'str' object but received a 'bytes'. This patch (binascii.unhexlify(ret_str).decode("utf-8").strip()) will work properly with both Python 2 and Python 3.

Fixes #160

@jleveque
Copy link
Contributor Author

@snider-nokia: Please test and review.

@snider-nokia
Copy link
Contributor

Indeed, this fix works, Joe. Thanks.

@jleveque jleveque merged commit affe6be into sonic-net:master Feb 10, 2021
@jleveque jleveque deleted the sffbase_py3 branch February 10, 2021 22:56
jleveque added a commit that referenced this pull request Feb 10, 2021
…and Python 3 (#165)

When called with Python 3, `str.strip(binascii.unhexlify(ret_str))` will raise an exception: ` descriptor 'strip' requires a 'str' object but received a 'bytes'`. This patch (`binascii.unhexlify(ret_str).decode("utf-8").strip()`) will work properly with both Python 2 and Python 3.

Fixes #160
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
… table for Y cable (sonic-net#165)

This PR fixes the naming convention for firmware related fields for Y cable.
In particular all the fields are now named as tor_self and tor_peer in place of tor1 and tor 2

Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com

Description
This PR fixes the naming convention for firmware related fields for Y cable.
In particular all the fields are now named as tor_self and tor_peer in place of tor1 and tor 2

Motivation and Context
Required by telemetry team as part of their initial schema

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
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.

sffbase.py convert_hex_to_string method is throwing exception on str.strip operation after Python 3 migration
2 participants