1. Antoine Pitrou
  2. pathlib
  3. Issues
Issue #12 resolved

Broken links are iterated over, but raise error when stat()'ed

July Tikhonov
created an issue
[x for x in Path() if x.is_dir()]

will fail if the working directory features some broken link (the link will be iterated over, but calling is_dir() method will cause a FileNotFoundError)

This is not strictly a bug, but it disallows a clean way to iterate over the directory (like in the shown example, which was taken from the pathlib docs). Probably broken links should not be iterated over - or they should not respond with error on is_dir() and similar methods.

(sorry for several editions of issue - I hitted something during editing, releasing it.)

Comments (4)

  1. Log in to comment