This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Pathlib: Add an expandUserPath method or argument
Type: enhancement Stage: resolved
Components: Library (Lib) Versions:
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Andrea Moro, xtreak
Priority: normal Keywords:

Created on 2019-06-12 16:49 by Andrea Moro, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg345379 - (view) Author: Andrea Moro (Andrea Moro) Date: 2019-06-12 16:49
Assuming the given path contains a '~' character, it would be nice to have a function to expand the given path so any further calls to an .exists doesn't fail.

A prototype of the function could be

        # Expand the home path in *ix based systems if any
        if '~' in s:
            x = [x for x in Path(s).parts if x not in '~']
            p = Path.home()
            for item in x:
                p = p.joinpath(item)
msg345384 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-06-12 17:07
There is expanduser : os.path.expanduser also accepts a path like object. Is this report different from these two functions?
msg345387 - (view) Author: Andrea Moro (Andrea Moro) Date: 2019-06-12 17:16
I have completely missed it. Thanks for flagging it.
Date User Action Args
2022-04-11 14:59:16adminsetgithub: 81436
2019-06-12 17:17:01Andrea Morosetstatus: open -> closed
stage: resolved
2019-06-12 17:16:46Andrea Morosetmessages: + msg345387
2019-06-12 17:07:42xtreaksetnosy: + xtreak
messages: + msg345384
2019-06-12 16:49:14Andrea Morocreate