notebook icon indicating copy to clipboard operation
notebook copied to clipboard

os_path is not defined

Open Raghav-Bell opened this issue 2 years ago • 10 comments

Describe the bug A clear and concise description of what the bug is. os_path is not defined in rename_file function (line 579). To Reproduce Steps to reproduce the behavior:

  1. Go to 'File tab'
  2. Click on 'Rename'
  3. Scroll down to '....'
  4. See error : os_path is not defined .(PFA)

Expected behavior A clear and concise description of what you expected to happen. File should be renamed

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows 11 (OS build 22000.739)
  • Browser [e.g. chrome, safari] Microsoft edge
  • Version [e.g. 22] IPython : 8.4.0 ipykernel : 6.15.0 ipywidgets : not installed jupyter_client : 7.3.4 jupyter_core : 4.10.0 jupyter_server : not installed jupyterlab : not installed nbclient : 0.6.4 nbconvert : 6.5.0 nbformat : 5.4.0 notebook : 6.4.12 qtconsole : not installed traitlets : 5.3.0 Python 3.9.12 Additional context Add any other context about the problem here. It is asked on discourse too (rename_failed)

jupyter_err2

Raghav-Bell avatar Jun 24 '22 06:06 Raghav-Bell

Is the file that you are attempting to rename in a hidden directory, or hidden itself?

krassowski avatar Jun 30 '22 20:06 krassowski

@krassowski , No nothing is hidden . I created new file and tried to rename it and got this error.I think this is the error with new roll back because i renamed the file in other env (older version of Jupyter notebook) . More specific , version of my old jupyter notebook (different env) Selected Jupyter core packages... IPython : 7.29.0 ipykernel : 6.4.1 ipywidgets : 7.6.5 jupyter_client : 6.1.12 jupyter_core : 4.9.1 jupyter_server : 1.4.1 jupyterlab : 3.2.1 nbclient : 0.5.3 nbconvert : 6.1.0 nbformat : 5.1.3 notebook : 6.4.6 qtconsole : 5.1.1 traitlets : 5.1.1 Python 3.8.8

Raghav-Bell avatar Jul 01 '22 04:07 Raghav-Bell

I could not reproduce on Linux. If you continue getting this error in the new environment, could you please provide a full path to the file that you are trying to rename and the new name you are trying to set? If the paths requires removal of potentially sensitive details, please confirm that the sanitised path is still sufficient to reproduce.

Could you also check if this is also reproducible with nbclassic, this is by running jupyter nbclassic instead of jupyter notebook (after installing nbclassic).

krassowski avatar Jul 01 '22 18:07 krassowski

Thanks @krassowski it is working fine , now .

Raghav-Bell avatar Jul 02 '22 04:07 Raghav-Bell

I reproduced this bug unfortunately on Mac.

arguments for rename_file: old_path: 'chap01/Untitled.ipynb' new_path: 'chap01/sample01.ipynb'

self.root_dir: '/Users/win/work'

In this case, is_hidden returns True! because is_hidden assumes absolute path, but passed relative path.

inside_root is '.ipynb' and startwith('.') returns True... https://github.com/jupyter/notebook/blob/4ba07e130f3c0df31b878af99a9b3e8123b69948/notebook/utils.py#L199-L201

junjis0203 avatar Jul 11 '22 02:07 junjis0203

Thanks @krassowski it is working fine , now .

Hi, how did you solve the problem? I also have this bug on my mac.

xuhuizhou-vt avatar Sep 11 '22 14:09 xuhuizhou-vt

Yes, this all confirms what I suspected; two options:

  • contribute by applying https://github.com/jupyter-server/jupyter_server/pull/886 to notebook v6.5
  • use nbclassic which is notebook frontend running on jupyter-server.

krassowski avatar Sep 11 '22 17:09 krassowski

Yes, this all confirms what I suspected; two options:

Thanks. I installed Jupyterlab in my environment and now it works.

xuhuizhou-vt avatar Sep 11 '22 20:09 xuhuizhou-vt

Facing same issue on tljh setup. How did you solve it by installing JupyterLab?

zanapepaj avatar Sep 15 '22 13:09 zanapepaj

Yes. It works for me.

zape @.***>于2022年9月15日 周四上午9:40写道:

Facing same issue on tljh setup. How did you solve it by installing JupyterLab?

— Reply to this email directly, view it on GitHub https://github.com/jupyter/notebook/issues/6458#issuecomment-1248117290, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOL3XV27U7MUDZRB776GI7LV6MRMFANCNFSM5ZWVXEOQ . You are receiving this because you commented.Message ID: @.***>

xuhuizhou-vt avatar Sep 15 '22 13:09 xuhuizhou-vt

Hi! @xuhuizhou-vt please check discourse.

Raghav-Bell avatar Sep 24 '22 05:09 Raghav-Bell

I reproduced this bug by the following steps:

  1. Create a file notebook1.ipynb and save it.
  2. Rename notebook1.ipynb to notebook2.ipynb
  3. Create a new jupyter notebook file, and try to rename it as notebook1.ipynb

I fix this bug by the following steps:

  1. change directory to the .ipynb_checkpoints folder
  2. Delete the notebook2-checkpoint.ipynb

I think this is not a "bug":

  1. The notebook2-checkpoint.ipynb forbids you to create the notebook1.ipynb file, since you can recover the notebook2.ipynb file to notebook1.ipynb, which may cause conflict.

Warning:

  1. Delete the notebook2-checkpoint.ipynb can fix this "bug". However, you will lose the saved check points of notebook2.ipynb.

liuguanfu1120 avatar Sep 26 '22 11:09 liuguanfu1120

I faced the same issue and solved it through change the folder name first.

Actually, it seems like the error is raised if the folder name is 'notebooks' or includes it any way, though it's a sheer guess. To summarise, I faced the issue when the folder containing the notebooks file to rename has a name 'notebooks', and made another folder with another name, and it was solved directly.

pai-djmoon avatar Oct 04 '22 03:10 pai-djmoon

@pai-djmoon Thanks for this - I had my notebooks in a folder called 'notebooks'. I simply did mv notebooks ntbks and the issue was resolved!

jasonhilton avatar Oct 09 '22 14:10 jasonhilton

Thanks @pai-djmoon - moving notebooks to a new folder worked for me, too.

My original folder was not named notebooks or anything similar, though, so I don't think the name of the old folder matters.

janton42 avatar Oct 21 '22 17:10 janton42