diff options
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | pysnmp/debug.py | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 06209059..36e9b6d7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -39,6 +39,7 @@ Revision 4.2.6rc0 reworked towards more robust and simple design with the execution observer facility. - MIB instrumentation example improved to cover table index building facility. +- Handle the case of absent stderr stream at Debug printer. - Fix to decodeMessageVersion() to withstand broken SNMP messages. - Fix to rfc1902.Bits type to make it accepting hex and binary initializers, cope with missing bits identifieirs at prettyPrint(). diff --git a/pysnmp/debug.py b/pysnmp/debug.py index 2dc33c06..d3f1f367 100644 --- a/pysnmp/debug.py +++ b/pysnmp/debug.py @@ -35,7 +35,10 @@ class Debug: defaultPrinter = sys.stderr.write def __init__(self, *flags): self._flags = flagNone - self._printer = self.defaultPrinter + if self.defaultPrinter: + self._printer = self.defaultPrinter + else: + self._printer = lambda x: None # stderr may not be available self('running pysnmp version %s' % __version__) for f in flags: inverse = f and f[0] in ('!', '~') |