python - No module named compat.octets -
i trying utilize below code perform simple snmp operation. please help me figure out error.
pysnmp.entity.rfc3413.oneliner import cmdgen cmdgen = cmdgen.commandgenerator() errorindication, errorstatus, errorindex, varbinds = cmdgen.getcmd( cmdgen.communitydata('public'), cmdgen.udptransporttarget(('demo.snmplabs.com', 161)), cmdgen.mibvariable('snmpv2-mib', 'sysname', 0), ) # check errors , print out results if errorindication: print(errorindication) elif errorstatus: print(errorstatus) else: name, val in varbinds: print('%s = %s' % (name.prettyprint(), val.prettyprint()))
the above code gives next error:
traceback (most recent phone call last): file "tut.py", line 1, in <module> pysnmp.entity.rfc3413.oneliner import cmdgen file "/usr/lib/python2.6/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 1, in <module> pysnmp.entity import engine, config file "/usr/lib/python2.6/site-packages/pysnmp/entity/engine.py", line 2, in <module> pysnmp.proto.rfc3412 import msgandpdudispatcher file "/usr/lib/python2.6/site-packages/pysnmp/proto/rfc3412.py", line 3, in <module> pyasn1.compat.octets import null importerror: no module named compat.octets
chances scheme pyasn1 pysnmp packages version-incompatible each other. i'd suggest putting both pyasn1 , pysnmp packages (the latest ones) $home , setting $pythonpath pointing each of them.
python snmp pysnmp
No comments:
Post a Comment