jupyter / nbgrader

A system for assigning and grading notebooks

Home Page:https://nbgrader.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RTC extension results in incorrect paths Validate notebook button

ykazakov opened this issue · comments

It seems like some notebook paths in nbgrader UI are determined from the page address, which does not work with the jupyter-collaboration extension.
For example, by pressing the "Validate" button at the top of the notebook for an assignment gives me the error:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/nbgrader/lib/python3.11/site-packages/nbgrader/server_extensions/validate_assignment/handlers.py", line 46, in validate_notebook
    result = validator.validate(fullpath)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/nbgrader/lib/python3.11/site-packages/nbgrader/validator.py", line 298, in validate
    with utils.chdir(dirname):
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/nbgrader/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/nbgrader/lib/python3.11/site-packages/nbgrader/utils.py", line 385, in chdir
    os.chdir(dirname)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/user/nbgrader/RTC:my-course/source/ps1'

The RTC: part in the page address is inserted by the jupyter-collaboration plugin.

Operating system

macOS 13.5.2

nbgrader --version

Python version 3.11.5 | packaged by conda-forge | (main, Aug 27 2023, 03:33:12) [Clang 15.0.7 ]
nbgrader version 0.9.1

jupyter notebook --version

Python version 3.11.5 | packaged by conda-forge | (main, Aug 27 2023, 03:33:12) [Clang 15.0.7 ]
nbgrader version 0.9.1

Steps to reproduce the behavior

  1. Run:
mamba create --name nbgrader
mamba activate nbgrader
mamba install -c conda-forge nbgrader jupyter-collaboration
nbgrader quickstart my-course
jupyter lab
  1. Open the notebook in my-course/source/ps1/problem1.ipynb
  2. Press the Validate button

Finding issues with using NBGrader plus Assignment Fetching relating to this.

Can see when accessing the Assignments tab the following URL:

/user/fWVysmUvHuc3NEZ0r/lab/tree/RTC%3A

Once clicking on the assignment it loads with:

/user/fWVysmUvHuc3NEZ0r/lab/tree/g__18309/Challenge.ipynb

Opening the Notebook from the File Tree results in:

/user/fWVysmUvHuc3NEZ0r/lab/tree/RTC%3Ag__18309/Challenge.ipynb