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

send2trash.exceptions.TrashPermissionError #3374

Closed
nick-youngblut opened this issue Feb 25, 2018 · 1 comment · Fixed by #5894
Closed

send2trash.exceptions.TrashPermissionError #3374

nick-youngblut opened this issue Feb 25, 2018 · 1 comment · Fixed by #5894

Comments

@nick-youngblut
Copy link

nick-youngblut commented Feb 25, 2018

I'm getting the following error when trying to trash (delete) a notebook (Untitled.ipynb):

Traceback (most recent call last): 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/send2trash/plat_other.py", 
line 141, in find_ext_volume_fallback_trash check_create(trash_dir) File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/send2trash/plat_other.py", 
line 86, in check_create os.makedirs(dir, 0o700) File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/os.py", 
line 220, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: b'/ebio/abt3_projects/.Trash-6354' 

During handling of the above exception, another exception occurred: Traceback (most recent call last): 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/tornado/web.py", line 1512, in _execute result = yield result 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/tornado/gen.py", line 1055, in run value = future.result() 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/tornado/concurrent.py", line 238, in result raise_exc_info(self._exc_info) File "<string>", line 4, in raise_exc_info 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/tornado/gen.py", line 307, in wrapper yielded = next(result) 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/notebook/services/contents/handlers.py", line 235, in delete yield gen.maybe_future(cm.delete(path)) 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/notebook/services/contents/manager.py", line 278, in delete self.delete_file(path) 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/notebook/services/contents/filemanager.py", line 499, in delete_file send2trash(os_path) 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/send2trash/plat_other.py", line 191, in send2trash dest_trash = find_ext_volume_trash(topdir) 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/send2trash/plat_other.py", line 151, in find_ext_volume_trash trash_dir = find_ext_volume_fallback_trash(volume_root) 
File "/ebio/abt3_projects/software/miniconda3_gt4.4/lib/python3.6/site-packages/send2trash/plat_other.py", line 144, in find_ext_volume_fallback_trash raise TrashPermissionError(e.filename) send2trash.exceptions.TrashPermissionError: [Errno 13] Permission denied: b'/ebio/abt3_projects/.Trash-6354'

Apparently, Jupyter is trying to write to the /ebio/abt3_projects/ folder, but I don't have access to this directory. How do I change the directory for ./Trash-*?

I'm running Jupyter installed in conda 4.4.10 on Ubuntu 16.04.3. Here's my Jupyter install info:

jupyter                   1.0.0                    py36_0    conda-forge
jupyter_client            5.2.2                    py36_0    conda-forge
jupyter_console           5.2.0                    py36_0    conda-forge
jupyter_contrib_core      0.3.3                    py36_1    conda-forge
jupyter_contrib_nbextensions 0.4.0                    py36_0    conda-forge
jupyter_core              4.4.0                      py_0    conda-forge
jupyter_highlight_selected_word 0.1.0                    py36_0    conda-forge
jupyter_latex_envs        1.4.0                    py36_1    conda-forge
jupyter_nbextensions_configurator 0.4.0                    py36_0    conda-forge
@takluyver
Copy link
Member

This should be fixed by PR #3304, in that it will just delete the file in that case rather than failing to trash it. The location of the trash directory is determined by a freedesktop spec, so that files show up as trash in file managers.

stefanor added a commit to stefanor/notebook that referenced this issue Dec 1, 2020
_check_trash() was added (in jupyter#3304) because TrashPermissionError didn't
exist, yet.

Now that it does, we can use it, and stop guessing what will cause a
permission problem.

Closes: jupyter#3374
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants