twistedSnmp and hexadecimal values ...

Mike C. Fletcher mcfletch at
Wed Mar 30 17:03:37 CEST 2005

Francesco Ciocchetti wrote:

>I'm tryng to use TwistedSnmp to make query and walk directly inside my
>python code.
>The problem i'm facing is that any time there is an hexadecimal value to
>be returned by the snmpwalk it is returened in a weird and useless
>way... does anyone had any (successfull) experience with twistedsnmp and
>hexadecimal values (as Mac Addresses)?
TwistedSNMP returns the raw (binary) values as strings.  Hexadecimal
"values" are just human readable presentation logic for a binary value
(stored as a string).  For instance, for a MAC address, we currently
display it to our users using:

        for v in mac

where mac is the "weird and useful" ;) value you got back.  That will
give you a colon-separated hexadecimal display value, which may or may
not be exactly what you want.  Feel free to play with the display logic
to get what you feel to be a good display format.

We (Cinemon) often use string sub-classes that provide extra formatting
logic and apply those to the values when we get the data-values in, but
that's just an artefact of how we store and process the results of the
TwistedSNMP queries, not TwistedSNMP itself.

BTW, more detail in a question (what result you got, what result you
expected, what you did to get the result) is generally a good idea.


  Mike C. Fletcher
  Designer, VR Plumber, Coder

More information about the Python-list mailing list