Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw TypeError when wrong PySwip version is being used #5

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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