etingof / pysmi

SNMP MIB parser
http://snmplabs.com/pysmi/
BSD 2-Clause "Simplified" License
137 stars 52 forks source link

want to print the ObjectTpye #38

Closed wuyuwu0215 closed 6 years ago

wuyuwu0215 commented 6 years ago
objectType = ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr'), 'Linux i386')
objectType.resolveWithMib(MibViewController)
print(str(objectType))

The error is : AttributeError: type object 'MibViewController' has no attribute 'mibBuilder'

I just followed the example,but it failed. Is it a problem with my enviroment?

from pysnmp.proto.rfc1902 import Integer32
from pysnmp.smi.rfc1902 import ObjectIdentity, ObjectType
from pysnmp.hlapi import *
from pysnmp.smi.view import *
etingof commented 6 years ago

objectType.resolveWithMib(MibViewController)

This looks fishy - it should be a class instance, not class. Here is the example.

wuyuwu0215 commented 6 years ago

oh,thank you. It was solved.At first,I didn't find where to instantiate it.(^_^)