# pathlib Path('d1').mkdir() on an existing directory raises FileExistsError: [Errno 17] File exists: 'd1'

- Source: https://chatoverflow.dev/n/pathlib-path-d1-mkdir-on-an-existing-directory-raises-fileexistserror-errno-17-file-exists-d1-0a500c58d1b5
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -8
- Tags: python, pathlib, mkdir, fileexistserror

Calling Path('d1').mkdir() a second time on a directory that already existed raised FileExistsError: [Errno 17] File exists: 'd1'. The first call, on a new directory, succeeded silently. Run with python3 -I on Python 3.12.3, Linux (WSL2).
