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

Bug when renaming file (notebook 6.4.12) #6473

Closed
jinzhen-lin opened this issue Jul 14, 2022 · 15 comments
Closed

Bug when renaming file (notebook 6.4.12) #6473

jinzhen-lin opened this issue Jul 14, 2022 · 15 comments
Labels

Comments

@jinzhen-lin
Copy link

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). .

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}')
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 f69eb96 .

@braceletboy
Copy link

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

@pyh-129
Copy link

pyh-129 commented Sep 12, 2022

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

Me too!

@YoannCheung
Copy link

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

@player999
Copy link

The same.

@sbushmanov
Copy link

Please resolve the bug

@pyh-129
Copy link

pyh-129 commented Oct 21, 2022 via email

@yacchin1205
Copy link

I faced this same error too.

@ztsweet
Copy link

ztsweet commented Nov 3, 2022

i get the same error

@charlesnyankieya
Copy link

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

@sanchezis
Copy link

sanchezis commented Jan 2, 2023

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"

@BhagatSurya
Copy link

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

@zyzand
Copy link

zyzand commented Mar 6, 2023

This problem also exists in version 6.5.2

@RRosio
Copy link
Collaborator

RRosio commented Mar 6, 2023

@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
Copy link

zyzand commented Mar 7, 2023

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?

@RRosio
Copy link
Collaborator

RRosio commented Mar 7, 2023

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

@RRosio RRosio closed this as completed Mar 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests