Skip to content
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

validate_filepath_arg claims '/path/to/somewhere.txt' invalid #11

Closed
freelanceAndy opened this issue Feb 11, 2020 · 2 comments
Closed

Comments

@freelanceAndy
Copy link

freelanceAndy commented Feb 11, 2020

Using Python 3.6.9 with pathvalidate 2.1.0:

import argparse
from pathvalidate.argparse import validate_filename_arg, validate_filepath_arg

parser = argparse.ArgumentParser()
parser.add_argument('--s3-bucket', type=str, help='check authentication repo for bucket names')
parser.add_argument('--input-path', type=validate_filepath_arg)
parser.add_argument('--output-path', type=validate_filepath_arg)
args = parser.parse_args(['download', '--s3-bucket', 'default', '--input-path', '/path/to/somewhere.txt', '--output-path', '/path/to/somewhere.txt'])

python3 example_bug.py
usage: example_bug.py [-h] [--s3-bucket S3_BUCKET] [--input-path INPUT_PATH]
[--output-path OUTPUT_PATH]
example_bug.py: error: argument --input-path: reason=MALFORMED_ABS_PATH, target-platform=universal, description=an invalid absolute file path (/path/to/somewhere.txt) for the platform (universal). specify an appropriate platform or 'auto'.

The error is raised in:
def validate_abspath(self, value: PathType) -> None:
...

       if self._is_universal() and any([is_posix_abs, is_nt_abs]):
           raise err_object
@thombashi
Copy link
Owner

@freelanceAndy
Thank you for your report.

Please try to upgrade pathvalidate package to 2.2.0 and re-execute.
I believe the latest version fixed the issue.

@freelanceAndy
Copy link
Author

Thanks for your swift response! Works great now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants