Change for reading new lines for both Windows and Linux

Tue, 27 Mar 2018 15:13:05 +0300

author
Ioannis <ioannis@inoe.ro>
date
Tue, 27 Mar 2018 15:13:05 +0300
changeset 145
a99ae250e086
parent 144
c61651ad1137
child 146
968f8c944f90

Change for reading new lines for both Windows and Linux

atmospheric_lidar/licel.py file | annotate | diff | comparison | revisions
--- a/atmospheric_lidar/licel.py	Fri Mar 23 16:09:49 2018 +0200
+++ b/atmospheric_lidar/licel.py	Tue Mar 27 15:13:05 2018 +0300
@@ -186,7 +186,7 @@
         channels = {}
         photodiodes = {}
 
-        with open(self.filename, 'rb') as f:
+        with open(self.filename, 'rbU') as f:
 
             self.read_header(f)
 
@@ -200,7 +200,7 @@
                 b = np.fromfile(f, 'b', 1)
 
                 if (a[0] != 13) | (b[0] != 10):
-                    logging.warning("No end of line found after record. File could be corrupt: %s" % file_path)
+                    logging.warning("No end of line found after record. File could be corrupt: %s" % self.filename)
 
                 channel = self.channel_data_class(current_channel_info, raw_data, self.duration(),
                                                   use_id_as_name=self.use_id_as_name)
@@ -326,7 +326,7 @@
 
     def import_header_only(self):
         """ Import only the header lines, withouth reading the acutal data."""
-        with open(self.filename, 'rb') as f:
+        with open(self.filename, 'rbU') as f:
             self.read_header(f)
 
     @staticmethod

mercurial