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

/Users/ken/duptemp/foo and others are invalid filenames. What? #33

Closed
kwloafman opened this issue Jun 14, 2023 · 1 comment
Closed

/Users/ken/duptemp/foo and others are invalid filenames. What? #33

kwloafman opened this issue Jun 14, 2023 · 1 comment
Labels

Comments

@kwloafman
Copy link

On macOS 12.6.6. Basically, it's marking anything with a leading '/' as invalid.

$ ipython
Python 3.11.3 (main, Apr  7 2023, 19:29:16) [Clang 14.0.0 (clang-1400.0.29.202)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.13.2 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import pathvalidate as pv

In [2]: pv.is_valid_filepath('/Users/ken/duptemp/foo')
Out[2]: False

In [3]: pv.is_valid_filepath('~/duptemp/foo')
Out[3]: True

In [4]: pv.is_valid_filepath('bar/zot')
Out[4]: True

In [5]: pv.is_valid_filepath('/bar/zot')
Out[5]: False
@thombashi
Copy link
Owner

That is because platform argument defaults to "universal".
universal means that check if the file path is usable on any OS.
File paths starting with / is invalid for Windows.
The return value will be True if you set platform keyword argument value for any of "auto", "POSIX", "macOS".

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

No branches or pull requests

2 participants