Skip to content

Commit 421e3ae

Browse files
gh-162326: Clarify Windows FileExistsError message for directories
1 parent 405f127 commit 421e3ae

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎Doc/builtins/exceptions.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,13 @@ depending on the system error code.
790790
Raised when trying to create a file or directory which already exists.
791791
Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`.
792792

793+
.. note::
794+
795+
On Windows, :exc:`FileExistsError` may include the message
796+
"Cannot create a file when that file already exists" even when
797+
attempting to create a directory. This wording comes from the
798+
Windows operating system. See :attr:`OSError.strerror`.
799+
793800
.. exception:: FileNotFoundError
794801

795802
Raised when a file or directory is requested but doesn't exist.

0 commit comments

Comments
 (0)