yuce / pyswip

PySwip is a Python - SWI-Prolog bridge enabling to query SWI-Prolog in your Python programs. It features an (incomplete) SWI-Prolog foreign language interface, a utility class that makes it easy querying with Prolog and also a Pythonic interface.
MIT License
464 stars 97 forks source link

Problem running the quick test code on Windows 11 #132

Closed tapadeep closed 2 years ago

tapadeep commented 2 years ago

I'm trying to execute Processor.py, which contains:

from pyswip import Prolog
prolog = Prolog()
prolog.assertz("father(michael,john)")

I run into the following error:

PS C:\Users\tapad\OneDrive\Documents\sem-iii-m.tech.-materials\CSE643-AI-Artificial Intelligence\Assignment 5\Solution> python Processor.py
ERROR: The system was unable to find the specified registry key or value.
Traceback (most recent call last):
  File "C:\Users\tapad\OneDrive\Documents\sem-iii-m.tech.-materials\CSE643-AI-Artificial Intelligence\Assignment 5\Solution\Processor.py", line 1, in <module>
    from pyswip import Prolog
  File "C:\Users\tapad\AppData\Local\Programs\Python\Python310\lib\site-packages\pyswip\__init__.py", line 29, in <module>
    from pyswip.prolog import Prolog
  File "C:\Users\tapad\AppData\Local\Programs\Python\Python310\lib\site-packages\pyswip\prolog.py", line 28, in <module>
    from pyswip.core import *
  File "C:\Users\tapad\AppData\Local\Programs\Python\Python310\lib\site-packages\pyswip\core.py", line 567, in <module>
    (_path, SWI_HOME_DIR) = _findSwipl()
  File "C:\Users\tapad\AppData\Local\Programs\Python\Python310\lib\site-packages\pyswip\core.py", line 410, in _findSwipl
    (path, swiHome) = _findSwiplWin()
  File "C:\Users\tapad\AppData\Local\Programs\Python\Python310\lib\site-packages\pyswip\core.py", line 208, in _findSwiplWin
    match = pattern.match(ret[-1])
IndexError: list index out of range

I am using Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32, SWI-Prolog (threaded, 64 bits, version 8.4.1)

Any help is greatly appreciated.

lolomap commented 2 years ago

How did you fix that

tapadeep commented 2 years ago

How did you fix that

I ran Windows Terminal as administrator.