I recently installed TLJH using the “install on own server” option. I used to be able to rename files, but when I try now, I get this error:
Traceback (most recent call last):
File "/opt/tljh/user/lib/python3.9/site-packages/tornado/web.py", line 1704, in _execute
result = await result
File "/opt/tljh/user/lib/python3.9/site-packages/tornado/gen.py", line 234, in wrapper
yielded = ctx_run(next, result)
File "/opt/tljh/user/lib/python3.9/site-packages/notebook/services/contents/handlers.py", line 135, in patch
model = yield maybe_future(cm.update(model, path))
File "/opt/tljh/user/lib/python3.9/site-packages/notebook/services/contents/manager.py", line 296, in update
self.rename(path, new_path)
File "/opt/tljh/user/lib/python3.9/site-packages/notebook/services/contents/manager.py", line 284, in rename
self.rename_file(old_path, new_path)
File "/opt/tljh/user/lib/python3.9/site-packages/notebook/services/contents/filemanager.py", line 579, in rename_file
raise web.HTTPError(400, f'Cannot rename file or directory {os_path!r}')
NameError: name 'os_path' is not defined
(Reformatted the traceback slightly for readability.)
I opened the file /opt/tljh/user/lib/python3.9/site-packages/notebook/services/contents/filemanager.py
, and here’s the context of the error:
def rename_file(self, old_path, new_path):
"""Rename a file."""
old_path = old_path.strip('/')
new_path = new_path.strip('/')
if new_path == old_path:
return
if (is_hidden(old_path, self.root_dir) or is_hidden(new_path, self.root_dir)) and not self.allow_hidden:
raise web.HTTPError(400, f'Cannot rename file or directory {os_path!r}')
Sure enough, if it detects that either old path or new path is “hidden,” then it creates an exception, but the exception error message references a variable os_path. os_path is not defined, so that’s why it has a NameError.
So, here is my question:
Should I report a bug? If so, where? The best place I could figure out to report this is the jupter_server repository, which has the closest match with the code I’m looking at. The strange thing is that it has a file which nearly matches, but doesn’t have the bug.
Reading the git blame, it never had the bug, either. It only exists in the version on pypi.
Other info
How to get a copy of the code with the bug:
pip download --no-deps notebook==6.4.12
mv notebook-6.4.12-py3-none-any.whl notebook.zip
unzip notebook.zip
grep -R "Cannot rename file or directory {os_path" notebook
Versions of libraries:
(base) root@jupyter:/opt/tljh/user# pip freeze | grep jupyter
jupyter-client==7.3.4
jupyter-core==4.10.0
jupyter-resource-usage==0.6.1
jupyter-server==1.17.1
jupyter-telemetry==0.1.0
jupyterhub==1.5.0
jupyterlab==3.4.3
jupyterlab-pygments==0.2.2
jupyterlab-server==2.14.0
jupyterlab-widgets==1.1.0
nteract-on-jupyter==2.1.3
Error screenshot: