I have a followup question to my previous thread: Python script to let stockfish selfplay 10 games from a given position

There are some engines that allow you to set a command that imposes that the hash memory is never cleared among games. For instance the Sugar program by Marco Zerbinati has this UCI command that can be done from the command line:

setoption name NeverClearHash value true 

I tried to do this command in python-chess library but apparently it doesn't work:


How can I set the option "NeverClearHash" to "true" in Python?

  • 2
    what exactly is the question ??????????? Feb 11, 2020 at 21:25

1 Answer 1


First, engine.options["NeverClearHash"] is wrong on two counts.
It is engine.option, not engine.options and that command queries the value rather than sets it.

To set the value you have to do something like:

engine.configure({"NeverClearHash": 1})
or perhaps:
engine.configure({"NeverClearHash": true})

Good programmers are never too proud to read the manual. I wholeheartedly recommend it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.