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

Ctrl-C not working #115

Open pampelmuse76 opened 3 years ago

pampelmuse76 commented 3 years ago

A python program, which does not determine in the prolog part, cannot be stopped by entering Ctrl-C.


!/usr/bin/python

from pyswip import Prolog prolog = Prolog() prolog.assertz(""" f(X) :- X #> 0, f(X) """) for result in prolog.query("f(X)"): print(result["X"])

Python 3.9.1 pyswip 0.2.10 SWI-Prolog version 8.2.3 for x86_64-linux

allComputableThings commented 3 years ago

Did you try: prolog.query("f(X)", catcherrors=False) ?

On Mon, Dec 28, 2020 at 8:04 AM pampelmuse76 notifications@github.com wrote:

A python program, which does not determine in the prolog part, cannot be stopped by entering Ctrl-C.

!/usr/bin/python

from pyswip import Prolog prolog = Prolog() prolog.assertz(""" f(X) :- X #> 0, f(X) """) for result in prolog.query("f(X)"): print(result["X"])

Python 3.9.1 pyswip 0.2.10 SWI-Prolog version 8.2.3 for x86_64-linux

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yuce/pyswip/issues/115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3QJLFYXPP4OFDC4NYWZRDSXCUCHANCNFSM4VMGBDLQ .

pampelmuse76 commented 3 years ago

Yes, with catcherrors=False and catcherrors=True. Neither works.

pampelmuse76 commented 3 years ago

Sending a kill signal (TERM) to the process id is working (it determines the program)