diff options
author | elie <elie> | 2012-08-22 10:55:19 +0000 |
---|---|---|
committer | elie <elie> | 2012-08-22 10:55:19 +0000 |
commit | 8a1a2a94f386cb0b99bc734a39036fc46528dd43 (patch) | |
tree | 24e844ac1ba833815b08b133a12fd6dfe02709d5 | |
parent | 07a6d5be43e4d1299c847eb1a0e3ac5c1b9f210f (diff) | |
download | pysnmp-8a1a2a94f386cb0b99bc734a39036fc46528dd43.tar.gz |
fix to MIB data reading routine to make it working with possible Windows
end-of-line's
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | pysnmp/smi/builder.py | 4 |
2 files changed, 3 insertions, 2 deletions
@@ -76,6 +76,7 @@ Revision 4.2.3 - The notificationType parameter of AsynNotificationOriginator.sendNotification made defaulted to reflect its optional nature. - Built-in debugger now supports negating debugging categories. +- Fix to MIB data reading routine to make it working with possible Windows end-of-line's. - Fix to CommandGenerator's SNMPv3 engine autodiscovery algorithm when retryCount is administratively set to 0. - Fix to Notification Originator to make it communicating a single diff --git a/pysnmp/smi/builder.py b/pysnmp/smi/builder.py index 3108d22..fd61d87 100644 --- a/pysnmp/smi/builder.py +++ b/pysnmp/smi/builder.py @@ -139,7 +139,7 @@ class ZipMibSource(__AbstractMibSource): raise IOError('No file in ZIP: %s' % p) def _getData(self, f, mode=None): - return self.__loader.get_data(os.path.join(self._srcName, f)) + return self.__loader.get_data(os.path.join(self._srcName, f)).replace('\r\n', '\n') class DirMibSource(__AbstractMibSource): def _init(self): @@ -158,7 +158,7 @@ class DirMibSource(__AbstractMibSource): def _getData(self, f, mode): try: if f in os.listdir(self._srcName): # make FS case-sensitive - return open(os.path.join(self._srcName, f), mode).read() + return open(os.path.join(self._srcName, f), mode).read().replace('\r\n', '\n') except OSError: pass raise IOError # pretend there's no such file |