On this page
site.gethistoryfile
Prev: site.execusercustomize | Up: site | Next: site.getsitepackages
Rel: site.abs_paths, site.addpackage, site.addsitedir, site.addsitepackages
Ref: docs.python.org — site.gethistoryfile
Tags: #public #python3 #stdlib #site
Import
import site
from site import gethistoryfile
Signature & Overview
site.gethistoryfile()
Check if the PYTHON_HISTORY environment variable is set and define it as the .python_history file. If PYTHON_HISTORY is not set, use the default .python_history file.
Usage
import site
if hasattr(site, 'gethistoryfile'):
assert isinstance(site.gethistoryfile(), str)
Gotchas
- Requires Python 3.13+: Honors
PYTHON_HISTORYenv var.
REPL Inspect
from site import gethistoryfile
help(gethistoryfile)
Linked from
Related notes
- tuts/python3/stdlib_module/site/execusercustomize Linked here; links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/getsitepackages Linked here; links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/site/abs_paths Linked here; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/addpackage Linked here; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/addsitedir Linked here; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/addsitepackages Linked here; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/addusersitepackages shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/check_enableusersite shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/enablerlcompleter shared tags: #site, #stdlib