Content-Length: 302723 | pFad | https://github.com/python/cpython/issues/146646

9E Document that glob functions in pathlib and glob modules ignore access errors · Issue #146646 · python/cpython · GitHub
Skip to content

Document that glob functions in pathlib and glob modules ignore access errors #146646

@Jackenmen

Description

@Jackenmen

Documentation

Based on #68308 (and just the fact that it has stayed unchanged for years), I assume this is intentional, and so I'm only creating a docs issue.

This behaviour is not documented anywhere in the relevant documentation, and (to me) it feels a bit surprising:

Some examples (ran as a non-root user):

Python 3.14.3 (main, Feb  4 2026, 09:28:29) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib import Path
>>> list(Path("/root").glob("*"))
[]
>>> list(Path("/root/x").glob("*"))
[]
>>> import glob
>>> glob.glob("/root/*")
[]
>>> glob.glob("*", root_dir="/root")
[]
>>> glob.glob("*", root_dir="/root", recursive=True)
[]
>>> glob.glob("/root/x/*")
[]
>>> glob.glob("*", root_dir="/root/x")
[]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Status

    Done

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/146646

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy