From ed9347e9bd830c797a3c33e026fc624864eff821 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 26 Jan 2020 10:34:30 +0100 Subject: [PATCH] more robust: * split(maxsplit=1) will raise ValueError if split into two strings is not possible * int('a') will raise ValueError if 'a' cannot be interpreted as an integer --- python/damask/table.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/damask/table.py b/python/damask/table.py index 3ef824c6d..15b501ac9 100644 --- a/python/damask/table.py +++ b/python/damask/table.py @@ -76,11 +76,11 @@ class Table(): try: N_comment_lines,keyword = f.readline().strip().split(maxsplit=1) if keyword != 'header': - raise TypeError + raise ValueError else: comments = [f.readline().strip() for i in range(1,int(N_comment_lines))] labels = f.readline().split() - except TypeError: + except ValueError: f.seek(0) comments = [] line = f.readline().strip()