jupyter / nbgrader

A system for assigning and grading notebooks
https://nbgrader.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.3k stars 317 forks source link

RTC extension results in incorrect paths Validate notebook button #1836

Open ykazakov opened 1 year ago

ykazakov commented 1 year ago

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
  2. Open the notebook in my-course/source/ps1/problem1.ipynb
  3. Press the Validate button
milandeepbassi commented 10 months ago

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

guyq1997 commented 2 months ago

Hello ykazakov,

i am facing the same problem. Did you find a solution? : )

I manually create the assignment with prefix "RTC:" and it works. LOL

But in this case i need to create two assignment

  1. RTC:Assignment name
  2. Assignment name
ykazakov commented 2 months ago

i am facing the same problem. Did you find a solution? : )

No. I disabled the RTC plugin for student notebooks and use it only for a shared notebook without nbgrader.