pyswip
pyswip copied to clipboard
Import on Fedora 29 fails
I have trouble importing pyswip on Fedora. When I run
from pyswip import Prolog
I get the error message
ImportError: Could not find the SWI-Prolog library in this platform. If you are sure it is installed, please open an issue.
The problem seems to be that there are two libswipl.so files found in the lib folder of the installation: libswipl.so.7.6.4, and a symlink libswipl.so.7.6 to the former. That's why the glob command in pyswip/core.py at line 145 gets two results, and the variable fullName is therefore set to None (line 151). The easiest workaround would probably be to change the code in core.py (line 146-151) from
if len(files) == 0:
fullName = None
elif len(files) == 1:
fullName = files[0]
else: # Will this ever happen?
fullName = None
to
if len(files) == 0:
fullName = None
else:
fullName = files[0]