I'm currently working on a SNMP module in Python 3 (Python 3.1.3) based on PySnmp to easily send GET/WALK SNMP queries from other programs. This is mainly for fun/learning.
When querying an existing OID, I get a tuple such as :
(ObjectName(1.3.6.1.2.1.1.7.0), Integer(72))
which I can read using a "for" construct.
However, when querying a non-existing OID (which is what I do for unit testing), I get :
(ObjectName(2.3.4.5.6.7.8), NoSuchObject('b'''))
How can I differentiate the "normal" case, where the 2nd element of the tuple is an integer/string/(other?) and the "error" case where this 2nd element is a 'NoSuchObject' ?