pyswip icon indicating copy to clipboard operation
pyswip copied to clipboard

Can disable interactive debugging? Segfault on when run in PyCharm.

Open allComputableThings opened this issue 5 years ago • 1 comments

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?

allComputableThings avatar May 07 '20 01:05 allComputableThings

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.

allComputableThings avatar May 07 '20 03:05 allComputableThings