1
0
mirror of https://github.com/arsenetar/send2trash.git synced 2026-01-22 14:41:40 +00:00

Define TrashPermissionError (#21)

This commit is contained in:
Thomas Kluyver
2018-02-06 22:28:47 +00:00
committed by Virgil Dupras
parent f6897609ba
commit 6b0bd46036
4 changed files with 45 additions and 4 deletions

View File

@@ -29,7 +29,15 @@ Usage
>>> from send2trash import send2trash
>>> send2trash('some_file')
When there's a problem ``OSError`` is raised.
On Freedesktop platforms (Linux, BSD, etc.), you may not be able to efficiently
trash some files. In these cases, an exception ``send2trash.TrashPermissionError``
is raised, so that the application can handle this case. This inherits from
``PermissionError`` (``OSError`` on Python 2). Specifically, this affects
files on a different device to the user's home directory, where the root of the
device does not have a ``.Trash`` directory, and we don't have permission to
create a ``.Trash-$UID`` directory.
For any other problem, ``OSError`` is raised.
.. _PyGObject: https://wiki.gnome.org/PyGObject
.. _GIO: https://developer.gnome.org/gio/