From c7ee1660f625fde5ca2d955bef3c697f51997ec3 Mon Sep 17 00:00:00 2001 From: Ronald Oussoren Date: Fri, 18 Nov 2022 11:55:36 +0100 Subject: [PATCH] GH-95815: Document less specific error for os.remove os.remove can raise PermissionError instead of IsADirectoryError, when the object to be removed is a directory (in particular on macOS). This reverts a change done in #14262. --- Doc/library/os.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 0f0fb55e315c95..3387d0842da8b6 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2421,7 +2421,7 @@ features: .. function:: remove(path, *, dir_fd=None) Remove (delete) the file *path*. If *path* is a directory, an - :exc:`IsADirectoryError` is raised. Use :func:`rmdir` to remove directories. + :exc:`OSError` is raised. Use :func:`rmdir` to remove directories. If the file does not exist, a :exc:`FileNotFoundError` is raised. This function can support :ref:`paths relative to directory descriptors