summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--pysnmp/debug.py5
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 0620905..36e9b6d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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 2dc33c0..d3f1f36 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 ('!', '~')