I am using python 3.7.3 on Debian 10 and I'm finding it writing .python_history in my homedir. I want to shut that off completely; I want it to never, ever, write ~/.python_history (I don't care whether it tries to read it, because it will never be there once I managed to suppress writing it). docs.python.org/3.7/tutorial/interactive.html says that "[t]he default configuration also saves your history into a file named .python_history in your user directory", implying that there is some way to configure it otherwise. But I see no documentation on the relevant configuration, either there or in the analogous page for current python. Presumably I'm just missing something, but it would be nice to see some kind of pointer to the relevant configuration documentation. I've been thrashing around trying to set sys.__interactivehook__ in $PYTHONSTARTUP, that being my best guess at what I need to use based on a few searches, but have so far failed to find the magic incantation that will suppress writing ~/.python_history. I don't know whether I'm failing to set it or just haven't found the right thing to set it to. Mouse
Hi,
I am using python 3.7.3 on Debian 10 and I'm finding it writing .python_history in my homedir. I want to shut that off completely
According to [1] it's possible:
The default behavior is enable tab-completion and to use ~/.python_history as the history save file. To disable it, delete (or override) the sys.__interactivehook__ attribute in your sitecustomize or usercustomize module or your PYTHONSTARTUP file.
[1]: https://docs.python.org/3/library/site.html#readline-configuration Hope it helps, bests, -- Julien Palard https://mdk.fr
participants (2)
-
Julien Palard
-
mouse@ip4b.ca