send2trash
send2trash copied to clipboard
send2trash intermittently unable to find Dropbox trash on Mac
Consider the following code:
import os
from send2trash import send2trash
my_path = os.path.expanduser("~/Library/CloudStorage/Dropbox/test.txt")
with open(my_path, "w"):
pass
send2trash(my_path)
When run, it fails about 50% of the time with the following error:
Traceback (most recent call last):
File "/Users/chadeos/bin/test_s2t.py", line 7, in <module>
send2trash(my_path)
File "/Users/chadeos/opt/anaconda3/lib/python3.9/site-packages/send2trash/mac/modern.py", line 26, in send2trash
check_op_result(op_result)
File "/Users/chadeos/opt/anaconda3/lib/python3.9/site-packages/send2trash/mac/modern.py", line 16, in check_op_result
raise OSError(op_result[2].localizedFailureReason())
OSError: The volume doesn’t have a trash.
I'm using send2trash 1.8.2, Python 3.9.15, and Mac OS Ventura 13.3.1.