notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Bug when renaming file (notebook 6.4.12)

Open jinzhen-lin opened this issue 2 years ago • 4 comments

Describe the bug In notebook 6.4.12,we cannot rename file sometimes.

To Reproduce Steps to reproduce the behavior:

  1. Install notebook 6.4.12
  2. Start notebook with root_dir="/home/foobar"
  3. Create a directory named abc (or any name with length len(root_dir) - len("Untitled") - 1)
  4. Create a notebook with default filename 'Untitled.ipynb'
  5. Rename the notebook to any other filename

Then you should got the error message

File "/home/xxxxxxx/.miniconda3/lib/python3.8/site-packages/notebook/services/contents/filemanager.py",
line 579, in rename_file raise web.HTTPError(400, f'Cannot rename hidden file or directory {os_path!r}')
NameError: name 'os_path' is not defined

Expected behavior

Rename the file successfully.

According to the error message, I found a typo here (os_path is not defined, it should be old_path). .https://github.com/jupyter/notebook/blob/3e5b767ddbc3526729cadbc69fe472ffc3ec2e7e/notebook/services/contents/filemanager.py#L578-L579 And I notice that the result of is_hidden(old_path, self.root_dir) is true, this is because the result of "abc/Untitled.ipynb"[len("/home/foobar"):] is .ipynb and it is treated as a hidden file.

It seems that this bug is introduced by this commit https://github.com/jupyter/notebook/commit/f69eb96cff7149b38bca068f4b7faaa7baf55902 .

jinzhen-lin avatar Jul 14 '22 03:07 jinzhen-lin

I faced this same error too. Can someone fix this?

braceletboy avatar Aug 26 '22 16:08 braceletboy

I faced this same error too. Can someone fix this?

Me too!

pyh-129 avatar Sep 12 '22 11:09 pyh-129

Same error. I have to rename it in the file folder after I close the jupyter notebook.

YoannCheung avatar Sep 14 '22 08:09 YoannCheung

The same.

player999 avatar Sep 18 '22 13:09 player999

Please resolve the bug

sbushmanov avatar Sep 24 '22 09:09 sbushmanov

Hi, After I rename it, it will be fine. I continue to check the information. It may have the same name as a file in the system

Message ID: @.***>

pyh-129 avatar Oct 21 '22 23:10 pyh-129

I faced this same error too.

yacchin1205 avatar Nov 01 '22 07:11 yacchin1205

i get the same error

ztsweet avatar Nov 03 '22 07:11 ztsweet

Just rename it offline and reload the page. It should work

charlesnyankieya avatar Dec 23 '22 12:12 charlesnyankieya

notebook/services/contents/filemanager.py

There is an error on this file rename function (line 500+)

The only way how to solve this situation is to downgrade...

pip3 install --upgrade notebook=="6.4.11"

sanchezis avatar Jan 02 '23 22:01 sanchezis

notebook/services/contents/filemanager.py

There is an error on this file rename function (line 500+)

The only way how to solve this situation is to downgrade...

pip3 install --upgrade notebook=="6.4.11"

thanks it helps

BhagatSurya avatar Jan 20 '23 15:01 BhagatSurya

This problem also exists in version 6.5.2

zyzand avatar Mar 06 '23 18:03 zyzand

@zyzand The latest release of Notebook, 6.5.3 should include the fix by @yacchin1205. Would you be able to upgrade to 6.5.3 and see if you still experience this issue?

RRosio avatar Mar 06 '23 20:03 RRosio

It works after I upgrade to version 6.5.3. Thanks.

@zyzand The latest release of Notebook, 6.5.3 should include the fix by @yacchin1205. Would you be able to upgrade to 6.5.3 and see if you still experience this issue?

zyzand avatar Mar 07 '23 18:03 zyzand

Thank you @zyzand! As there has been a release with a fix for this issue, I will go ahead and close it.

RRosio avatar Mar 07 '23 18:03 RRosio