Search code examples
prolog

SWI-Prolog No permission to modify static procedure `set_prolog_flag/2' in init.pl


I'm trying to modify the initial configuration of SWI-Prolog in command line, following the official documentation from SWI-Prolog FAQ 1 and 2 to change the output displayed. However, I have run into this error:

X@X:~/Documents/Prolog$ swi-prolog.swipl
ERROR: /home/X/snap/swi-prolog/55/.config/swi-prolog/init.pl:1:
ERROR:    No permission to modify static procedure `set_prolog_flag/2'
Welcome to SWI-Prolog (threaded, 64 bits, version 8.4.3)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

The file init.pl is a one liner:

set_prolog_flag(answer_write_options, [quoted(true), portray(true), max_depth(18)]).

All the information I found was that the error could be related to a system-defined flag that is not marked changeable, since other entries in this forum for No permission to modify static procedure are more related to syntax error.


I'm new to prolog, helps and suggestions are welcomed!


Solution

  • You tried to redefine set_prolog_flag/2 as a fact.

    Add :- in front of it to make it a directive.