asweigart / asweigart/pyinputplus
pyinputplus.inputFilepath(path, mustExist=True) does not validate that a filepath exists on the system.
- Dominant language
- Python
- Stars
- 114
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
Wanted to use pyinputplus.inputFilepath in an exercise from ATBS, however, it does not actually validate that a path exists, it simply
returns the path as a string, nor does it seem to validate an actual filepath, it simply returns whatever value is entered as a string. This does not seem to be intended behavior.
```
>>> import pyinputplus as pyip
>>> pyip.inputFilepath("Enter a valid directory: ", mustExist=True)
Enter a valid directory: /foo/bar/bang/
'/foo/bar/bang/'
>>> pyip.inputFilepath("Enter a valid directory: ", mustExist=True)
Enter a valid directory: Test directory does not exist
'Test directory does not exist'
>>>
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating and reading the inputFilepath implementation, then reproduce the two examples from the issue with mustExist=True. Done means nonexistent paths and non-filepath text are rejected instead of returned unchanged, while valid input continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100