check for empty line moved to avoid error

This commit is contained in:
Dominik Demuth 2023-05-11 18:00:29 +02:00
parent 15c959fd71
commit 267554b252

View File

@ -49,10 +49,8 @@ class AsciiReader:
with self.fname.open('r') as f:
for i, line in enumerate(islice(f, len(self.header)+len(self.lines), num_lines)):
line = line.rstrip('\n\t\r, ')
is_empty = len(line) == 0
line = re.split(r'[\s,;]', line)
try:
comment_start = line.index('#')
self.line_comment.append(' '.join(line[comment_start:]))
@ -60,6 +58,8 @@ class AsciiReader:
except ValueError:
self.line_comment.append('')
is_empty = len(line) == 0
if not is_empty:
self.width.append(len(line))
self.lines.append(line)