I’m using: SWI-Prolog version 8.0.3, via pengines on docker
Gundam:my_codes andreacortis$ docker run -p 0.0.0.0:3030:3030 -i -d -t pengines
Gundam:my_codes andreacortis$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c988c1b8f54e pengines "swipl daemon.pl --p…" 16 minutes ago Up 16 minutes 0.0.0.0:3030->3030/tcp elegant_noether
the server is up and running
Gundam:my_codes andreacortis$ curl http://0.0.0.0:3030/docs/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>
[...]
I want the code to: reproduce the example at https://github.com/ian-andrich/PythonPengines
by using these commands in python:
from pengines.Builder import PengineBuilder
from pengines.Pengine import Pengine
pengine_builder = PengineBuilder(urlserver="http://0.0.0.0:3030")
In [20]: pengine = Pengine(builder=pengine_builder,slave_limit=1, debug=True)
Starting call.
Starting post request with URL http://0.0.0.0:3030/pengine/create, content_type: application/json, and body: {"chunk": 100, "format": "json"}
Starting Post request.
URL is: http://0.0.0.0:3030/pengine/create
Data (body) : b'{"chunk": 100, "format": "json"}'
Headers: {'User-Agent': 'PythonPengine', 'Accept': 'application/json', 'Accept-Language': 'en-us,en;q=0.5', 'Content-type': 'application/json'}
response_string is : {
"event":"create",
"id":"84ec823c-c2dc-4993-86f5-7d64d8ee996f",
"slave_limit":3
}
{'event': 'create', 'id': '84ec823c-c2dc-4993-86f5-7d64d8ee996f', 'slave_limit': 3}
Initialization complete.
In [21]: query = "X = 3, writeln(X)"
...: pengine.ask(query)
...: print(pengine.currentQuery.availProofs)
Starting the call to ask.
Current state is idle
Initializing query with query: X = 3, writeln(X)
Call to ask is complete
[]
I am not getting anything back and I do not understand if this is a prolog issue or a python issue.
By the way, I also get an empty list by trying the query
query = "member(X, [1,2,3])"
pengine.ask(query)
print(pengine.currentQuery.availProofs)
or any other query.
Any advice, please?
Thanks
Andrea