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

os_path is not defined #6458

Open
Raghav-Bell opened this issue Jun 24, 2022 · 18 comments
Open

os_path is not defined #6458

Raghav-Bell opened this issue Jun 24, 2022 · 18 comments
Labels

Comments

@Raghav-Bell
Copy link

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

@krassowski
Copy link
Member

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

@Raghav-Bell
Copy link
Author

Raghav-Bell commented Jul 1, 2022

@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

@krassowski
Copy link
Member

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

@Raghav-Bell
Copy link
Author

Thanks @krassowski it is working fine , now .

@junjis0203
Copy link

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

notebook/notebook/utils.py

Lines 199 to 201 in 4ba07e1

inside_root = abs_path[len(abs_root):]
if any(part.startswith('.') for part in inside_root.split(os.sep)):
return True

@ZhouXH-git
Copy link

Thanks @krassowski it is working fine , now .

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

@krassowski
Copy link
Member

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

@ZhouXH-git
Copy link

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

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

@zanapepaj
Copy link

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

@ZhouXH-git
Copy link

ZhouXH-git commented Sep 15, 2022 via email

@Raghav-Bell
Copy link
Author

Hi! @xuhuizhou-vt please check discourse.

@liuguanfu1120
Copy link

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.

@pai-djmoon
Copy link

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.

@jasonhilton
Copy link

@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!

@janton42
Copy link

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.

@kostyafarber
Copy link
Contributor

Is there any reason why this is still open?

@zycalice
Copy link

It would be great to have it working in the first place, not to rename the original folder to make it work

@YVin3D
Copy link

YVin3D commented Sep 20, 2023

Bit of a brutal solution, but I fixed it using pip install --force-reinstall notebook my guess is something in that dependency list was broken in my existing install, and reinstalling everything updates to a newer version where this is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests