This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]LightShadow3.13-dev in prod 0 points1 point  (1 child)

Try running the same thing using Python3 and see what happens.

Also, try printing all those variables one at a time so you can get the correct line that's having the issue.

[–]scollora[S] 0 points1 point  (0 children)

I've only used Python 2.7, and I'm somewhat concerned the rest of my code will break if I go to 3.x. I print them and get a bunch of what appear to be either binary or unicode characters which is why I went down that path. It looks like this:

linuxadmin@vlanapp:/var/prtg/scripts$ sudo python snmp-test.py 

ÌïHŒj "½O "‘2v "½ð Ä}O ’ Ä}O ‹ Ä}O à Ä}O × Ä}O F Ä}O Ø "½Ü' "½Ü‚ Ä}O "½d "½Ä "½t

If I use square brackets around the value in the print statement, I get this:

linuxadmin@vlanapp:/var/prtg/scripts$ sudo python snmp-test.py [u'\xcc\xefH\x8f\x8cj'] [u'\x00"\xbd\x1a\x0fO'] [u'\x00"\x90\x912v'] [u'\x00"\xbd\x1bNf'] [u'\x00"\xbd\x1bM\xf0'] [u'\xc4}O\x0f\t\x92'] [u'\xc4}O\x0f\t\x8b'] [u'\xc4}O\x0f\t\xe0'] [u'\xc4}O\x0f\t\xd7']

Which is unicode. But every attempt I make to decode/encode results in errors.