[pysnmp-users] Examples
Brought to you by:
elie
From: David G. M. <mac...@be...> - 2003-09-19 20:19:27
|
A list for users of pure-Python SNMP framework <pysnmp-users.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/pysnmp-users>, <mailto:pys...@li...?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum=pysnmp-users> I just downloaded pysnmp 3.3.5, and tried to run the following code lifted from the example on the index page of the 2.x programmer's manual shipped in the tar file. I had to modify it slightly to add the qualifications to the module locations for the imports. ----- from pysnmp.compat.pysnmp2x import v2c, role, asn1 req = v2c.GETREQUEST() req['encoded_oids'] = [ asn1.OBJECTID().encode('1.3.6.1.2.1.1.1.0') ] tr = role.manager(('10.1.1.10', 161)) (rawrsp, src) = tr.send_and_receive(req.encode()) rsp = v2c.RESPONSE() rsp.decode(rawrsp) oids = map(lambda x:x[0], map(asn1.OBJECTID().decode, rsp['encoded_oids'])) vals = map(lambda x: x[0](), map(asn1.decode, rsp['encoded_vals'])) print oids print vals ----- When I run it, I get the following: ----- Traceback (most recent call last): File "/home/dave/tsnmp.py", line 3, in ? req['encoded_oids'] = [ asn1.OBJECTID().encode('1.3.6.1.2.1.1.1.0') ] File "/usr/lib/python2.2/site-packages/pysnmp/compat/pysnmp2x/v1.py", line 250, in __setitem__ return self._wrapper_fun(self._setitem_fun, key, value) File "/usr/lib/python2.2/site-packages/pysnmp/compat/pysnmp2x/v2c.py", line 38, in _wrapper_fun return apply(v1.CompatBase._wrapper_fun, [self, fun ] + list(args)) File "/usr/lib/python2.2/site-packages/pysnmp/compat/pysnmp2x/v1.py", line 96, in _wrapper_fun raise asn1.BadArgument(why) pysnmp.compat.pysnmp2x.asn1.BadArgument: Non-ASN1 object [VarBind(name=ObjectName('.1.3.6.1.2.1.1.1.0'), value=BindValue(unspecified=Null(None)))] at VarBindList ----- I'm running python 2.2.2 on a Redhat 9 distro. Can anyone help me out? Thanks, Dave |