send2trash icon indicating copy to clipboard operation
send2trash copied to clipboard

Error on broken symlink

Open mallniya opened this issue 1 year ago • 0 comments

Simple setup with broken symlink:

~$ cd /tmp/
/tmp$ touch 1
/tmp$ ln -s 1 2
/tmp$ rm 1

yields an error:

>>> send2trash('/tmp/2')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mallniya/personal/soft/python/.venv/lib/python3.11/site-packages/send2trash/plat_other.py", line 189, in send2trash
    raise OSError(errno.ENOENT, "File not found: %s" % path)
FileNotFoundError: [Errno 2] File not found: /tmp/2

Non-broken symlink (i.e. case with not removing file 1 in setup) works with send2trash just fine.

mallniya avatar Jun 27 '23 23:06 mallniya