Dear everyone,
I just installed swiplserver 1.0.2 using Python 3.10 (SWI Prolog 9.0.4, AMD 64 version) and then I tried the first example from the docu:
from swiplserver import PrologMQI, PrologThread
with PrologMQI() as mqi:
with mqi.create_thread() as prolog_thread:
result = prolog_thread.query("atom(a)")
print(result)
But instead the expected “True” response I get this error message:
Prolog: ERROR: -g mqi_start: catch/3: Unknown procedure: mqi_start/0
Traceback (most recent call last):
File "D:/SWIProlog/swiplservertest.py", line 3, in <module>
with PrologMQI() as mqi:
File "D:\Python310\lib\site-packages\swiplserver\prologmqi.py", line 326, in __enter__
self.start()
File "D:\Python310\lib\site-packages\swiplserver\prologmqi.py", line 428, in start
raise PrologLaunchError("no port found in stdout")
swiplserver.prologmqi.PrologLaunchError: no port found in stdout
mqi_start in the Interpreter runs and gives the result true.
I’m a little perplexed, because I think I did everything as stated in the documentation.
Could you, please, give me some hint?
Thx very much
Franz
If mqi_start/0 is undefined we are dealing with an incomplete system. MQI is in library(mqi) and should be auto-loadable. From the path names this looks like you are using Windows? Installed from swi-prolog.org? My Windows VM is broken at the moment, so I can’t run a quick test. What happens if you run this in a Prolog console?
?- [library(mqi)].
If that works there is probably something wrong with the autoload index. You can fix that by starting swipl-win.exe with sufficient rights to write to the installation directories and type
?- make.
% Updating index for library ...
Should that fix things, please let us know because that means something is wrong with the distribution files.
Thanks. What actually matters here is not the Windows version, but which distribution you used. We have binaries for Windows on swi-prolog.org, but there are several other sites that provide SWI-Prolog installers for Windows, such as Portable Apps. In addition it can be built using MSYS2, Cygwin or WSL. I assume you are using the default installer from swi-prolog.org?