From 267554b252fa1d6e1e6c9b499877ef90928101c1 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Thu, 11 May 2023 18:00:29 +0200 Subject: [PATCH] check for empty line moved to avoid error --- src/nmreval/io/asciireader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nmreval/io/asciireader.py b/src/nmreval/io/asciireader.py index 04fd19e..e2c0464 100644 --- a/src/nmreval/io/asciireader.py +++ b/src/nmreval/io/asciireader.py @@ -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)