1
0
mirror of https://github.com/arsenetar/send2trash.git synced 2026-01-22 14:41:40 +00:00
Files
send2trash/send2trash/exceptions.py
Andrew Senetar 65bda6c7ca feat: Drop support for Python 2 and remove compatibility code
This removes support for Python 2, and drops most of the compatibility
code that was used to support both Python 2 and Python 3.
2025-08-06 05:27:32 +00:00

21 lines
867 B
Python

import errno
class TrashPermissionError(PermissionError):
"""A permission error specific to a trash directory.
Raising this error indicates that permissions prevent us efficiently
trashing a file, although we might still have permission to delete it.
This is *not* used when permissions prevent removing the file itself:
that will be raised as a regular PermissionError (OSError on Python 2).
Application code that catches this may try to simply delete the file,
or prompt the user to decide, or (on Freedesktop platforms), move it to
'home trash' as a fallback. This last option probably involves copying the
data between partitions, devices, or network drives, so we don't do it as
a fallback.
"""
def __init__(self, filename):
PermissionError.__init__(self, errno.EACCES, "Permission denied", filename)