pyswip
pyswip copied to clipboard
Can disable interactive debugging? Segfault on when run in PyCharm.
With this script to generate a prolog exception:
from pyswip.prolog import Prolog, PrologError
def problem(prolog):
try:
next(prolog.assertz(f"a23123 s "))
except PrologError as e:
pass
except Exception as e:
raise
for x in range(200): problem(Prolog())
running:
python pytest.py
ERROR: Syntax error: Operator expected
ERROR: assertz((a23123
ERROR: ** here **
ERROR: s )).
Call: (1) pyrun([a, s, s, e, r, t, z, '('|...], _1904) ?
enters Prolog's interactive debugger. When called from within PyCharm, the interactive prompt doesn't seem supported and the program segfaults somewhere internal to prolog.
Any ideas on how to disable interactive debugging?
Neither of:
args.append("--no-tty")
args.append("--tty=false")
in initialize fixes this. Are the not correctly loaded into the initialize call. (Perhaps not -- these options dont seem to disable interactive input at the command line for swipl).
Also -- the bug goes away in PyCharm when "Emulate terminal in output console" is enabled in the run configuration.