Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'OSError: Directory not found' when trying to trash file in network drive #10

Open
edmundchong opened this issue Feb 10, 2017 · 2 comments
Labels
macOS Affects macOS only

Comments

@edmundchong
Copy link

edmundchong commented Feb 10, 2017

I am trying to use send2trash on a Mac OS X system.

when I try send2trash(fn) I get the error OSError: Directory not found. This only occurs when trying to trash files on my network drive (the network folder is mapped to /Volumes/...).

It seems that when I try to manually move the file to trash in Finder, the file disappears completely and does not show up in Trash. I googled a little and found that OSX seems to lack support for trashing files on network volumes! (e.g. https://arstechnica.com/civis//viewtopic.php?f=19&t=1225663). I wonder if this is something that can be overcome in the send2trash code?

@arsenetar arsenetar added the macOS Affects macOS only label Jan 22, 2021
@walksonair
Copy link

walksonair commented Jul 1, 2021

I also am running into this problem:

On main computer I developed my code asking it to trash a temporary file that is on an attached external hard drive. I then move this code over to my work horse computer that mounted the very same external hard drive as a network drive. When I run Send2Trash '/Volumes/HardDrive/trashmefolder' on the work horse folder, I get the error stating

  File "/usr/local/lib/python3.9/site-packages/send2trash/plat_osx_ctypes.py", line 56, in send2trash
    check_op_result(op_result)
  File "/usr/local/lib/python3.9/site-packages/send2trash/plat_osx_ctypes.py", line 39, in check_op_result
    raise OSError(msg)

However, running same code with the same path on main computer does not produce this error.

I also can confirm Send2Trash will trash any file/folder I give it on the work horse computer that is locally mounted.

If Send2Trash accepts the path to the file, then I don't expect there to be any issues with moving my code to another computer as MacOS mounts the network drive with the same path text.

I suspect it may be some sort of Mac OS Gatekeeper or security issue...but I enabled 'Terminal' to have full disk access or for network volumes. I am not sure what else to add.

@walksonair
Copy link

I also am running into this problem:

On main computer I developed my code asking it to trash a temporary file that is on an attached external hard drive. I then move this code over to my work horse computer that mounted the very same external hard drive as a network drive. When I run Send2Trash '/Volumes/HardDrive/trashmefolder' on the work horse folder, I get the error stating

  File "/usr/local/lib/python3.9/site-packages/send2trash/plat_osx_ctypes.py", line 56, in send2trash
    check_op_result(op_result)
  File "/usr/local/lib/python3.9/site-packages/send2trash/plat_osx_ctypes.py", line 39, in check_op_result
    raise OSError(msg)

However, running same code with the same path on main computer does not produce this error.

I also can confirm Send2Trash will trash any file/folder I give it on the work horse computer that is locally mounted.

If Send2Trash accepts the path to the file, then I don't expect there to be any issues with moving my code to another computer as MacOS mounts the network drive with the same path text.

I suspect it may be some sort of Mac OS Gatekeeper or security issue...but I enabled 'Terminal' to have full disk access or for network volumes. I am not sure what else to add.

On further research, it's not possible to trash anything that resides on a network volume on the MacOS platform. I'd advise as such in the error message if it can be accommodated. I rescind my previous comment and withdraw this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS Affects macOS only
Projects
None yet
Development

No branches or pull requests

3 participants