-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Older Pythons do not support 'except ... as...' syntax.
- Loading branch information
Showing
4 changed files
with
40 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
# Authors: Matt Hooks <[email protected]> | ||
# Zachary Lorusso <[email protected]> | ||
# | ||
import sys | ||
|
||
from pysnmp.smi.rfc1902 import * | ||
from pysnmp.hlapi.auth import * | ||
from pysnmp.hlapi.context import * | ||
|
@@ -18,6 +20,7 @@ | |
|
||
try: | ||
import asyncio | ||
|
||
except ImportError: | ||
import trollius as asyncio | ||
|
||
|
@@ -127,8 +130,9 @@ def __cbFun(snmpEngine, sendRequestHandle, | |
try: | ||
varBindsUnmade = vbProcessor.unmakeVarBinds(snmpEngine, varBinds, | ||
lookupMib) | ||
except Exception as e: | ||
future.set_exception(e) | ||
except Exception: | ||
ex = sys.exc_info()[1] | ||
future.set_exception(ex) | ||
else: | ||
future.set_result( | ||
(errorIndication, errorStatus, errorIndex, varBindsUnmade) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
# Copyright (c) 2005-2018, Ilya Etingof <[email protected]> | ||
# License: http://snmplabs.com/pysnmp/license.html | ||
# | ||
import sys | ||
|
||
from pysnmp.smi.rfc1902 import * | ||
from pysnmp.hlapi.auth import * | ||
from pysnmp.hlapi.context import * | ||
|
@@ -120,8 +122,9 @@ def __cbFun(snmpEngine, sendRequestHandle, | |
try: | ||
varBindsUnmade = vbProcessor.unmakeVarBinds(snmpEngine, varBinds, lookupMib) | ||
|
||
except Exception as e: | ||
deferred.errback(Failure(e)) | ||
except Exception: | ||
ex = sys.exc_info()[1] | ||
deferred.errback(Failure(ex)) | ||
|
||
else: | ||
deferred.callback((errorStatus, errorIndex, varBindsUnmade)) | ||
|
@@ -236,8 +239,9 @@ def __cbFun(snmpEngine, sendRequestHandle, | |
try: | ||
varBindsUnmade = vbProcessor.unmakeVarBinds(snmpEngine, varBinds, lookupMib) | ||
|
||
except Exception as e: | ||
deferred.errback(Failure(e)) | ||
except Exception: | ||
ex = sys.exc_info()[1] | ||
deferred.errback(Failure(ex)) | ||
|
||
else: | ||
deferred.callback((errorStatus, errorIndex, varBindsUnmade)) | ||
|
@@ -366,8 +370,9 @@ def __cbFun(snmpEngine, sendRequestHandle, | |
lookupMib) | ||
for varBindTableRow in varBindTable] | ||
|
||
except Exception as e: | ||
deferred.errback(Failure(e)) | ||
except Exception: | ||
ex = sys.exc_info()[1] | ||
deferred.errback(Failure(ex)) | ||
|
||
else: | ||
deferred.callback((errorStatus, errorIndex, varBindsUnmade)) | ||
|
@@ -524,8 +529,9 @@ def __cbFun(snmpEngine, sendRequestHandle, | |
lookupMib) | ||
for varBindTableRow in varBindTable] | ||
|
||
except Exception as e: | ||
deferred.errback(Failure(e)) | ||
except Exception: | ||
ex = sys.exc_info()[1] | ||
deferred.errback(Failure(ex)) | ||
|
||
else: | ||
deferred.callback((errorStatus, errorIndex, varBindsUnmade)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
# Copyright (c) 2005-2018, Ilya Etingof <[email protected]> | ||
# License: http://snmplabs.com/pysnmp/license.html | ||
# | ||
import sys | ||
|
||
from pysnmp.smi.rfc1902 import * | ||
from pysnmp.hlapi.auth import * | ||
from pysnmp.hlapi.context import * | ||
|
@@ -128,8 +130,9 @@ def __cbFun(snmpEngine, sendRequestHandle, | |
try: | ||
varBindsUnmade = vbProcessor.unmakeVarBinds(snmpEngine, varBinds, lookupMib) | ||
|
||
except Exception as e: | ||
deferred.errback(Failure(e)) | ||
except Exception: | ||
ex = sys.exc_info()[1] | ||
deferred.errback(Failure(ex)) | ||
|
||
else: | ||
deferred.callback((errorStatus, errorIndex, varBindsUnmade)) | ||
|