changeset 2:8f1a773a3cd5

Don't strip lines to make printing easier.
author Daniel O'Connor <darius@dons.net.au>
date Wed, 20 Nov 2013 13:16:56 +1030
parents 99f25c8ab92f
children 535076e31660
files iec1107.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/iec1107.py	Wed Nov 20 12:46:59 2013 +1030
+++ b/iec1107.py	Wed Nov 20 13:16:56 2013 +1030
@@ -77,7 +77,6 @@
         while True:
             line = s.readline()
             cksum ^= reduce(lambda x, y: x ^ y, map(ord, line))
-            line = line.strip()
             if len(line) == 0:
                 raise Error('Timeout during message')
             if line == '!':
@@ -95,7 +94,7 @@
         cksum ^= ord(fin[0])
         if cksum != ord(fin[1]):
             raise Error('Checksum mismatch, expected 0x%02x, got 0x%02x' % (cksum, ord(fin[1])))
-        self.reading = lines
+        self.rawreading = lines
         del s
 
 def main():
@@ -105,8 +104,8 @@
         sys.exit(1)
 
     res = IEC1107Reading(sys.argv[1])
-    print res.reading
-
+    map(sys.stdout.write, res.rawreading)
+    print res
 if __name__ == '__main__':
     main()