cleanup utils.path.get_home_dir #810

minrk opened this Issue Sep 20, 2011 · 0 comments


None yet
1 participant

minrk commented Sep 20, 2011

We have lots of manual code in utils.path.get_home_dir(), but most of it is either duplicate or inferior to os.path.expanduser('~').

I don't know about the failure cases of the builtin func, but ours is easily broken with:

$> unset HOME
$> ipython

Traceback (most recent call last):
IPython.utils.path.HomeDirError: Undefined $HOME, IPython cannot proceed.

os.path.expanduser(), on the other hand, still works in this case because it falls back on the password db if HOME is unset, rather than falling back on HOME in a subprocess, which is also removed by the above unset. It also probably makes a better choice on Windows, about which we have had issues.

@minrk minrk closed this in 351c8fc Nov 24, 2011

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Merge pull request #998 from minrk/homedir
defer to stdlib os.path.expanduser('~') for path.get_home_dir()

frozen env still comes first, and My Documents registry query is fallback on Windows, but in all normal cases, expanduser is used, which has $HOME as first priority.

IPython also no longer considers finding no writable home dir as a fatal error.

closes #810
closes #747
closes #970
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment