-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
click.Path(resolve_path=True) does not resolve non-existing paths under Windows python<=3.9 #2466
Comments
Sounds like the fix is to upgrade Python to fix a bug in Python. |
That sounds like a cop-out to me. It's not always possible to upgrade Python version, and anyway, Click is used by many applications that themselves purport to support their use on Windows with python >= 3.7. If a Click feature (trivial as it may be) doesn't work for a subset of that "supported" space, it makes the feature worse than useless for such projects — use of such a feature means the application is subtly broken in some environments. ("Works everywhere but Windows" — the best kind of bug!) AFAICT, Click purports to support python >= 3.7 on Windows. If it can be fixed easily in Click (so that Click behaves in the way its documentation claims it does), why not? I think the fix might be as simple as replacing this: rv = os.fsdecode(pathlib.Path(rv).resolve()) with rv = os.fsdecode(pathlib.Path(rv).absolute().resolve()) (If a fix is not possible, the documentation12 should be updated to note that Footnotes |
Under Windows, python<=3.9, arguments and parameters of type
click.Path(resolve_path=True)
are not resolved to an absolute path if they refer to non-existing locations.This behavior started with PR #2094.
Python’s
pathlib.Path.resolve()
shares this same broken behavior: on Windows, python <= 3.9,Path("missing-file").resolve()
==Path("file")
; in other environments or with other python versions,Path("missing-file").resolve()
correctly produces an absolute path (by prefixing "missing-file" with the current working directory).Under Windows, with python<=3.9, this test script will fail (at least for me).
Environment:
The text was updated successfully, but these errors were encountered: