Commits

Olav Andreas Lindekleiv  committed 16431f2

Only skip Null columns, but continue on next valid column.

  • Participants
  • Parent commits 38d3ffe

Comments (0)

Files changed (1)

File rptparser.py

                 column_lengths.append(length)
 
             # Loop over rows:
-            more_lines = True
-            while more_lines:
+            while True:
                 line = f.readline()
                 if not line:
                     break
 
+                if len(line.strip()) == 0:
+                    break
+
                 # Loop over columns and get slice of row equal to column value's length:
                 char = 0
                 row = []
                     column_data = line[old_char:char]
                     value = column_data.strip()
 
-                    # Stop looping if we reach a completely empty row value:
-                    if len(value) == 0:
-                        more_lines = False
-                        break
-
                     row.append(value)
 
                 # Don't add empty rows:
             i = 0
             for value in row:
                 # Skip values for Null columns as specified in map_dict:
-                if not columns[i]:
-                    continue
                 i += 1
+                if not columns[i - 1]:
+                    continue
 
                 # Add non-numbers with quotes:
                 try: