I am exploring pysnmp (python snmp library). While executing an example, I got error
AttributeError: 'module' object has no attribute 'MibVariable'
against method call cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0)
Example code is given below
from pysnmp.entity.rfc3413.oneliner import cmdgen
cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
cmdgen.CommunityData('public', 0),
cmdgen.UdpTransportTarget(('demo.snmplabs.com', 161)),
cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0),
lookupNames=True, lookupValues=True
)
Normally, this happens if mutual top level imports exist as mentioned here.
How can I overcome this issue without changing library source code?