{ } Raw JSON

bundles / IPython 9.17.0 / IPython / utils / path / get_home_dir

function

IPython.utils.path:get_home_dir

source: /dev/ipython/IPython/utils/path.py:158

Signature

def get_home_dir(require_writable: bool = False) → str

Summary

Return the 'home' directory, as a unicode string.

Extended Summary

Uses os.path.expanduser('~'), and checks for writability.

See stdlib docs for how this is determined. For Python <3.8, $HOME is first priority on ALL platforms. For Python >=3.8 on Windows, %HOME% is no longer considered.

Parameters

require_writable : bool [default: False]

if True:

guarantees the return value is a writable directory, otherwise raises HomeDirError

if False:

The path is resolved, but it is not guaranteed to exist or be writable.

Aliases

  • IPython.paths.get_home_dir