[docs] [issue20164] Undocumented KeyError from os.path.expanduser
Terry J. Reedy
report at bugs.python.org
Sun Sep 28 03:49:08 CEST 2014
Terry J. Reedy added the comment:
I think the doc should be considered correct and posixpath buggy. The ntpath code checks for the existence of HOME and substitutes before returning the arg unchanged, as documented.
if 'HOME' in os.environ:
userhome = os.environ['HOME']
elif 'USERPROFILE' in os.environ:
userhome = os.environ['USERPROFILE']
elif not 'HOMEPATH' in os.environ:
return path
<create userhome from HOMEDRIVE and HOMEPATH
--
The pwd doc already says " KeyError is raised if the entry asked for cannot be found.", so this is not an issue.
----------
assignee: docs at python ->
components: -Documentation
nosy: +terry.reedy
stage: needs patch -> test needed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20164>
_______________________________________
More information about the docs
mailing list