Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2732,7 +2732,9 @@ features:
.. function:: remove(path, *, dir_fd=None)

Remove (delete) the file *path*. If *path* is a directory, an
:exc:`OSError` is raised. Use :func:`rmdir` to remove directories.
:exc:`OSError` is raised. The exact exception type depends on the platform:
for example, :exc:`IsADirectoryError` or :exc:`PermissionError`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! One suggestion: Could you maybe add, on which plattform (for the well known ones) which error is used? Thanks!

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
Expand Down
Comment thread
StanFromIreland marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Clarify that the :exc:`OSError` subclass raised by :func:`os.remove` when the
path is a directory is platform-dependent.
Loading