Skip to content

PTH208 suggests Path.iterdir(), which does not support file descriptors #17695

Closed
@sbrudenell

Description

@sbrudenell

Summary

import os
os.listdir(1)
$ ruff --version
ruff 0.11.7
$ ruff check --isolated --select PTH208 t.py
t.py:2:1: PTH208 Use `pathlib.Path.iterdir()` instead.
  |
1 | import os
2 | os.listdir(1)
  | ^^^^^^^^^^ PTH208
  |

Found 1 error.

Path.iterdir() doesn't support directory file descriptors.

Related: #17694, #17693, #17691, #12871, #7620

Version

0.11.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions especially welcomeruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions