Skip to content

Commit

Permalink
Merge pull request #5 from LaurentMertens/pyswip_err_msg
Browse files Browse the repository at this point in the history
Throw TypeError when wrong PySwip version is being used
  • Loading branch information
rmanhaeve committed Dec 5, 2022
2 parents dde8985 + eb7d877 commit 2385021
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/deepproblog/engines/prolog_engine/swi_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ def query(self, query: str, profile=0) -> List[Dict[str, Any]]:
for k in r:
v = result[0][k]
if type(v) is list:
if isinstance(v[0], str):
raise TypeError("Oops, it appears you are using the wrong version of PySwip.\n"
"Please make sure you are using PySwip from https://github.com/ML-KULeuven/pyswip\n"
"To install, first remove your current PySwip version, then install the correct version.\n"
"You can try doing\n'pip install git+https://github.com/ML-KULeuven/pyswip'.\n"
"For some reason, this does not always resolve the issue. If you still get this error,\n"
"clone the repo locally, then compile from your local codebase doing\n"
"'pip install [path to local clone]'.")
out_partial[k] = [p for p in term2list(parse(result[0][k]))]
else:
out_partial[k] = parse(v)
Expand Down

0 comments on commit 2385021

Please sign in to comment.