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

make path relative #1177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

make path relative #1177

wants to merge 1 commit into from

Conversation

phaustin
Copy link

the validate button is failing for me on current master with error messages like:

FileNotFoundError: [Errno 2] No such file or directory: '/source/Assign_1'

this is because path is being set with '/' as the first character, making the os.path.join with the notebook_dir a noop. My fix using pathlib.relative_to works, but obviously it would be better to catch this at the initialization and make sure path is relative.

@jhamrick
Copy link
Member

Hmm, I'm not able to reproduce this unfortunately. Do you know why the path is starting with a / in the first place? I would think that shouldn't happen... can you open a JavaScript console on the offending notebook and look at what Jupyter.notebook.notebook_path is?

But I agree if this is possible we should check that the path is relative rather than absolute. However, we haven't quite yet dropped support for Python 2 (happening very soon though). Would you mind writing this without pathlib so that the python 2 tests will still pass?

@jhamrick jhamrick added this to the 0.6.1 milestone Aug 21, 2019
@jhamrick jhamrick modified the milestones: 0.6.1, 0.7.0 Nov 6, 2019
@jabalazs
Copy link

I am having the same issue. The Jupyter.notebook.notebook_path in my case is /source/assignment_3/assignment_3.ipynb.

Steps to replicate:

  1. Create a new conda environment:
    conda create -n nbgrader python=3.7
  2. Install nbgrader:
    conda install nbgrader -c conda-forge
    At this point, the validate button still works.
  3. Install jupytext:
    conda install jupytext -c conda-forge
    The validate button does not work anymore, and displays the error referenced above.

@jhamrick jhamrick removed this from the 0.7.0 milestone Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants