|
31 | 31 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
32 | 32 | # THE POSSIBILITY OF SUCH DAMAGE.
|
33 | 33 | #
|
| 34 | +import sys |
| 35 | + |
34 | 36 | from pysnmp.smi.rfc1902 import *
|
35 | 37 | from pysnmp.hlapi.auth import *
|
36 | 38 | from pysnmp.hlapi.context import *
|
|
41 | 43 |
|
42 | 44 | try:
|
43 | 45 | import asyncio
|
| 46 | + |
44 | 47 | except ImportError:
|
45 | 48 | import trollius as asyncio
|
46 | 49 |
|
@@ -137,8 +140,9 @@ def __cbFun(snmpEngine, sendRequestHandle,
|
137 | 140 | try:
|
138 | 141 | varBindsUnmade = vbProcessor.unmakeVarBinds(snmpEngine, varBinds,
|
139 | 142 | lookupMib)
|
140 |
| - except Exception as e: |
141 |
| - future.set_exception(e) |
| 143 | + except Exception: |
| 144 | + ex = sys.exc_info()[1] |
| 145 | + future.set_exception(ex) |
142 | 146 | else:
|
143 | 147 | future.set_result(
|
144 | 148 | (errorIndication, errorStatus, errorIndex, varBindsUnmade)
|
@@ -242,8 +246,9 @@ def __cbFun(snmpEngine, sendRequestHandle,
|
242 | 246 | try:
|
243 | 247 | varBindsUnmade = vbProcessor.unmakeVarBinds(snmpEngine, varBinds,
|
244 | 248 | lookupMib)
|
245 |
| - except Exception as e: |
246 |
| - future.set_exception(e) |
| 249 | + except Exception: |
| 250 | + ex = sys.exc_info()[1] |
| 251 | + future.set_exception(ex) |
247 | 252 | else:
|
248 | 253 | future.set_result(
|
249 | 254 | (errorIndication, errorStatus, errorIndex, varBindsUnmade)
|
@@ -353,8 +358,9 @@ def __cbFun(snmpEngine, sendRequestHandle,
|
353 | 358 | varBindTableRow,
|
354 | 359 | lookupMib)
|
355 | 360 | for varBindTableRow in varBindTable]
|
356 |
| - except Exception as e: |
357 |
| - future.set_exception(e) |
| 361 | + except Exception: |
| 362 | + ex = sys.exc_info()[1] |
| 363 | + future.set_exception(ex) |
358 | 364 | else:
|
359 | 365 | future.set_result(
|
360 | 366 | (errorIndication, errorStatus, errorIndex, varBindsUnmade)
|
@@ -493,8 +499,9 @@ def __cbFun(snmpEngine, sendRequestHandle,
|
493 | 499 | varBindTableRow,
|
494 | 500 | lookupMib)
|
495 | 501 | for varBindTableRow in varBindTable]
|
496 |
| - except Exception as e: |
497 |
| - future.set_exception(e) |
| 502 | + except Exception: |
| 503 | + ex = sys.exc_info()[1] |
| 504 | + future.set_exception(ex) |
498 | 505 | else:
|
499 | 506 | future.set_result(
|
500 | 507 | (errorIndication, errorStatus, errorIndex, varBindsUnmade)
|
|
0 commit comments