Count the line outside the f-string so Python 3.11 still parses the script

This commit is contained in:
2026-09-26 15:07:32 +02:00
parent 9c797dea94
commit 186181a25a
3 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -166,7 +166,8 @@ def read_premises(root):
except OSError as failure:
sys.exit(f"README.md in {root}: {failure.strerror} - no premises.")
except UnicodeDecodeError as failure:
sys.exit(f"README.md is not UTF-8 on line {failure.object[:failure.start].count(b'\n') + 1} - no premises.")
line = failure.object.count(b"\n", 0, failure.start) + 1
sys.exit(f"README.md is not UTF-8 on line {line} - no premises.")
for name in ("Goals", "Audience"):
bodies = found.get(name, [])
if not bodies: