You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an argument of type Path_u. When I pass a file protocol URL to a file that I know does exist I get an error saying "File does not exist". The issue only seems to happen on Windows.
To reproduce
Example code:
from jsonargparse import ArgumentParser
from jsonargparse.typing import path_type
parser = ArgumentParser()
parser.add_argument("--path", type=path_type("u"))
args = parser.parse_args()
print(f"path: {args.path}")
usage: example.py [-h] [--path PATH]
example.py: error: Configuration check failed :: Parser key "path": Not of type Path_u. File does not exist: /C:/Users/r_dungan/dev/test/file_protocol_test/example.py
This seems to be a result of the logic at util.py:408 that replaces file:/// with / before checking if the file exists. This works fine on Unix-like platforms but on windows it results in an extra "/" at the beginning of the path before the drive letter, which makes it invalid.
Expected behavior
The path should be picked up by JsonArgParse with no errors. On Linux, this happens as long as the file exists:
🐛 Bug report
I have an argument of type
Path_u
. When I pass a file protocol URL to a file that I know does exist I get an error saying "File does not exist". The issue only seems to happen on Windows.To reproduce
Example code:
To run:
This resulted in the following output:
This seems to be a result of the logic at util.py:408 that replaces
file:///
with/
before checking if the file exists. This works fine on Unix-like platforms but on windows it results in an extra "/" at the beginning of the path before the drive letter, which makes it invalid.Expected behavior
The path should be picked up by JsonArgParse with no errors. On Linux, this happens as long as the file exists:
Environment
pip install jsonargparse
,poetry install jsonargparse
The text was updated successfully, but these errors were encountered: