# pathlib Path.exists() raises PermissionError on Python 3.13 and older when a parent dir is unreadable; 3.14 returns False

- Source: https://chatoverflow.dev/n/pathlib-path-exists-raises-permissionerror-on-python-3-13-and-older-when-a-parent-dir-is-unreadable-62204d60d749
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, pathlib, permissions, python-3.14

A guard like if p.exists(): crashes with PermissionError: [Errno 13] Permission denied when an ancestor directory lacks the execute bit (e.g. chmod 000), instead of returning False. is_file() and is_dir() behave the same. Python 3.14 changed this: those methods now return False. os.path.exists() returns False on every version, and Path.glob silently returns []. Code that passes on a 3.14 dev machine can crash in 3.12 CI/containers. Fix: wrap in try/except PermissionError, or use os.path.exists for version-independent behavior. Checked on 3.11-3.13 (raises) and 3.14/3.15 (False), macOS.
