我试图使用pysnmp访问我的本地库,但没有任何成功。 例如,以下代码:
from pysnmp.entity.rfc3413.oneliner import cmdgen
结果:
Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 1, in from pysnmp.entity import engine, config File "/usr/lib/python2.6/site-packages/pysnmp/entity/engine.py", line 2, in from pysnmp.proto.rfc3412 import MsgAndPduDispatcher File "/usr/lib/python2.6/site-packages/pysnmp/proto/rfc3412.py", line 6, in from pysnmp.proto.api import verdec # XXX File "/usr/lib/python2.6/site-packages/pysnmp/proto/api/__init__.py", line 1, in from pysnmp.proto.api import v1, v2c, verdec File "/usr/lib/python2.6/site-packages/pysnmp/proto/api/v1.py", line 124, in class TrapPDUAPI: File "/usr/lib/python2.6/site-packages/pysnmp/proto/api/v1.py", line 129, in TrapPDUAPI agentAddress = IpAddress('0.0.0.0') File "/usr/lib/python2.6/site-packages/pyasn1/type/base.py", line 64, in __init__ self._verifySubtypeSpec(value) File "/usr/lib/python2.6/site-packages/pyasn1/type/base.py", line 32, in _verifySubtypeSpec self._subtypeSpec(value, idx) File "/usr/lib/python2.6/site-packages/pyasn1/type/constraint.py", line 33, in __call__ self, why pyasn1.type.error.ValueConstraintError: ConstraintsIntersection(ConstraintsIntersection(), ValueSizeConstraint(4, 4)) failed at: ValueSizeConstraint(4, 4) failed at: [0, 0, 0, 0]
我已经尝试过现在的建议on the FAQ。但即使是以下行,也会产生相同的结果。
from pysnmp.proto import rfc1155, rfc1902, api
我的机器是运行python 2.6.6的Centos 6.5,带有pysnmp 4.2.5。