From 5fa4d281e610f0ffc12dc4794d2f862cd470d2d9 Mon Sep 17 00:00:00 2001 From: Robert Leander Date: Mon, 15 Jun 2026 13:59:25 +0200 Subject: [PATCH 1/2] fix empty-end-line on prj issue --- imod/formats/prj/prj.py | 2 ++ imod/tests/test_formats/test_prj.py | 1 + 2 files changed, 3 insertions(+) diff --git a/imod/formats/prj/prj.py b/imod/formats/prj/prj.py index dd9859a92..056916bb0 100644 --- a/imod/formats/prj/prj.py +++ b/imod/formats/prj/prj.py @@ -451,6 +451,8 @@ def _parse_block(lines: _LineIterator, content: Dict[str, Any]) -> None: while key is None and not lines.finished: n, key, active = _parse_blockheader(lines) + if key is None: + return try: if key in KEYS: if n != 1: diff --git a/imod/tests/test_formats/test_prj.py b/imod/tests/test_formats/test_prj.py index b5d07f419..12027fb01 100644 --- a/imod/tests/test_formats/test_prj.py +++ b/imod/tests/test_formats/test_prj.py @@ -118,6 +118,7 @@ "benzene",1 "chloride",2 + """ ) From 69b51531c26661cfc584a06ee7faa3385eabae18 Mon Sep 17 00:00:00 2001 From: Robert Leander Date: Mon, 15 Jun 2026 14:28:03 +0200 Subject: [PATCH 2/2] Added empty lines to pixi file --- imod/formats/prj/prj.py | 4 +++- imod/tests/test_formats/test_prj.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/imod/formats/prj/prj.py b/imod/formats/prj/prj.py index 056916bb0..726f942b8 100644 --- a/imod/formats/prj/prj.py +++ b/imod/formats/prj/prj.py @@ -484,7 +484,9 @@ def _parse_block(lines: _LineIterator, content: Dict[str, Any]) -> None: ) except Exception as e: - raise type(e)(f"{e}\nError occurred for keyword: {key}") + raise type(e)( + f"{e}\nError occurred for keyword: {key} in line {lines.count + 1}" + ) if blockcontent is not None and active is not None: blockcontent["active"] = active diff --git a/imod/tests/test_formats/test_prj.py b/imod/tests/test_formats/test_prj.py index 12027fb01..9d79382e5 100644 --- a/imod/tests/test_formats/test_prj.py +++ b/imod/tests/test_formats/test_prj.py @@ -94,6 +94,8 @@ 1,2, 000, 100000.0, 1.0, -999.9900 ,"{basepath}/first.gen" 1,2, 000, 100000.0, 1.0, -999.9900 ,"{basepath}/second.gen" + + 0001,(PCG),1, Precondition Conjugate-Gradient,[] MXITER= 500 ITER1= 25