notebook: send2trash failing in Fedora 26 container
Reported by @invisibleroads in a comment on #405:
send2trash fails in a Fedora 26 container and I’m not sure why. Deleting files worked in the previous release but is broken now. For now, our workaround is disable the trash functionality.
c.FileContentsManager.delete_to_trash = False
Here is the traceback:
File "$VIRTUAL_ENV/lib/python3.6/site-packages/notebook/services/contents/handlers.py", line 235, in delete yield gen.maybe_future(cm.delete(path))
File "$VIRTUAL_ENV/lib/python3.6/site-packages/notebook/services/contents/manager.py", line 275, in delete self.delete_file(path)
File "$VIRTUAL_ENV/lib/python3.6/site-packages/notebook/services/contents/filemanager.py", line 507, in delete_file send2trash(os_path)
n
File "$VIRTUAL_ENV/lib/python3.6/site-packages/send2trash/plat_other.py", line 185, in send2trash dest_trash = find_ext_volume_trash(topdir)
File "$VIRTUAL_ENV/lib/python3.6/site-packages/send2trash/plat_other.py", line 145, in find_ext_volume_trash trash_dir = find_ext_volume_fallback_trash(volume_root)
File "$VIRTUAL_ENV/lib/python3.6/site-packages/send2trash/plat_other.py", line 139, in find_ext_volume_fallback_trash check_create(trash_dir)
File "$VIRTUAL_ENV/lib/python3.6/site-packages/send2trash/plat_other.py", line 84, in check_create os.makedirs(dir, 0o700)
File "$VIRTUAL_ENV/lib64/python3.6/os.py", line 220, in makedirs mkdir(name, mode) NotADirectoryError: [Errno 20] Not a directory: b'/home/user/Experiments/Logs/Untitled.ipynb/.Trash-1000'
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 19 (12 by maintainers)
Commits related to this issue
- send2trash not work https://github.com/jupyter/notebook/issues/3130 Now, files not delete on https://hub.docker.com/r/jupyter/base-notebook/ and derived container images. — committed to mnagaku/docker-stacks by mnagaku 6 years ago
- Specify wildcard address correctly and disable trash function The syntax for telling the notebook to listen on all addresses has changed, see https://github.com/jupyter/docker-stacks/pull/721. Also,... — committed to callysto/docker-stacks by ianabc 6 years ago
Well, a quick programmatic solution would be to write
~/.jupyter/jupyter_notebook_config.py
with:I think you can also do this in
/etc/jupyter/jupyter_notebook_config.py
if you prefer not to modify the home directory.If you want to disable send2trash, you need
False
instead ofTrue
there.delete_to_trash = True
means that deleting a file trashes it rather than really deleting.