Say I have a path to a nonexistent directory:
dirpath = Path("this/directory/doesnt/exist")
or even a completely invalid path:
dirpath = Path(r"D:\:$`~[]*/'/..")
If I call dirpath.glob('whatever')
, one of two things can happen:
- It can throw an exception (
FileNotFoundError
/OSError
) - It can yield 0 results
The documentation, of course, doesn't contain any information about this. So, how does Path.glob()
handle nonexistent and invalid paths?