[pysnmp-users] Notification Originator example fails (pysnmp 4.2.5 / Python 3.4)
Brought to you by:
elie
From: Марат Р. <mar...@gm...> - 2015-02-19 09:51:35
|
Hello, I would like to use pysnmp 4.2.5 (installed via pip) to send SNMP traps. I tried running the following example (taken from http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/agent/ntforg/trap-v2c-with-mib-lookup.py ): --- from pysnmp.entity.rfc3413.oneliner import ntforg ntfOrg = ntforg.NotificationOriginator() errorIndication = ntfOrg.sendNotification( ntforg.CommunityData('public'), ntforg.UdpTransportTarget(('localhost', 162)), 'trap', ntforg.MibVariable('SNMPv2-MIB', 'coldStart'), ( ntforg.MibVariable('SNMPv2-MIB', 'sysName', 0), 'new name' ) ) if errorIndication: print('Notification not sent: %s' % errorIndication) --- When I run it with Python 3.4.2 I get this: --- Exception ignored in: <bound method AsynNotificationOriginator.__del__ of <pysnmp.entity.rfc3413.oneliner.ntforg.AsynNotificationOriginator object at 0x7fd0a07a4978>> Traceback (most recent call last): File "/usr/local/lib/python3.4/site-packages/pysnmp/entity/rfc3413/oneliner/ntforg.py", line 33, in __del__ def __del__(self): self.uncfgNtfOrg() File "/usr/local/lib/python3.4/site-packages/pysnmp/entity/rfc3413/oneliner/ntforg.py", line 100, in uncfgNtfOrg for authDataKey in authDataKeys: RuntimeError: dictionary changed size during iteration --- With Python 2.7.8 the example works just fine. Is the example not applicable to pysnmp 4.2.5 / Python 3.4? Best regards, Marat Rysbekov |