Skip to main content

Some encoding issue with python3 version of snmph_from_cred_id function?

  • July 31, 2025
  • 1 reply
  • 0 views

Hi,

Encountered weird issue when trying to query MAC-address information with SNMP. With python2 version of this function, mac address information is returned as hex string as it should but when using python3 version, the same information is returning something other than hex string.

Python3 version:

Python2 version:

Maybe some encoding issue with python3 version?

1 reply

  • August 12, 2025

The information is the same from Python2 to 3. Python3 strings are unicode and so all those code points can be represented by utf-8 characters which is what you are seeing. I think it might be best to do something like... answer[0][1].encode("utf-8").hex(). This will push the string into bytes and then show the hex of the entire output.