Skip to content
Snippets Groups Projects
Commit b856d660 authored by Eliott Sammier's avatar Eliott Sammier
Browse files

Fix inverted error messages

parent 9a5c421f
Branches
Tags
No related merge requests found
......@@ -46,7 +46,7 @@ def parse_mosetp(graph: Graph, filepath: str, id: str):
regex = re.compile(r'.*new PageContenu\("(.*)", "(.*)", "(.*)", ""\);')
# The lines we need are fairly basic, grep is much faster
# than a Python HTML parser to filter them
cmd_array = ["grep", "new PageContent(", filepath]
cmd_array = ["grep", "new PageContenu(", filepath]
try:
cmd = subprocess.run(
cmd_array,
......@@ -59,11 +59,13 @@ def parse_mosetp(graph: Graph, filepath: str, id: str):
m = regex.match(line)
if m is not None: # should always match but just in case
generate_triples(graph, id, m.group(2), m.group(1), index)
else:
eprint(f"page regex found no match on line '{line}'")
except FileNotFoundError as e:
eprint(f"Failed to run 'grep': {e.strerror}: {e.filename}")
except subprocess.CalledProcessError as e:
if e.returncode == 1:
eprint(f"{filepath}: page regex found no match, skipping.'")
eprint(f"{filepath}: grep found no match, skipping.'")
else:
eprint(e.stderr, end="")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment