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

Nbgrader Menu in JupyterLab opens windows that cannot be closed #1772

Closed
ykazakov opened this issue Mar 31, 2023 · 2 comments · Fixed by #1773
Closed

Nbgrader Menu in JupyterLab opens windows that cannot be closed #1772

ykazakov opened this issue Mar 31, 2023 · 2 comments · Fixed by #1773

Comments

@ykazakov
Copy link
Contributor

Operating system

MacOS 13.2.1 (22D68)

nbgrader --version

% nbgrader --version     
Python version 3.11.1 | packaged by conda-forge | (main, Mar 30 2023, 16:46:19) [Clang 14.0.6 ]
nbgrader version 0.8.2

jupyter notebook --version

Not using jupyter notbook but jupyter lab:

% jupyter notebook --version
6.5.3
% jupyter lab --version
3.5.3

Expected behavior

The windows opened by Nbgrader menus (Assignment List, Formgrder, Course List) should be closable.

Actual behavior

If a window is opened the second time (e.g., Nbgrader > Formgrader, close, Nbgrader > Formgrader), the widow no longer has title and cannot be closed. See the screenshot:

Screenshot 2023-03-31 at 14 16 03

Steps to reproduce the behavior

  1. Install nbgrader and jupyter lab:
mamba create -n nbg -c conda-forge python -y
mamba activate nbg
mamba install jupyterlab  
pip install nbgrader # the latest version is not yet on conda-forge
  1. Setup a course
mkdir -p /Users/Shared/nbgrader
cd /Users/Shared/nbgrader
nbgrader quickstart course101
% cat ~/.jupyter/nbgrader_config.py 
c = get_config()
c.Exchange.root = "/tmp/nbgrader/exchange"
c.CourseDirectory.root = "/Users/Shared/nbgrader/course101"
  1. Start jupter lab
% jupyter lab
  1. Open menu Nbgrader > Formgrader (or Assignment List or Course List)
  2. Close the opened window Formgrader
  3. Open the same window again: Nbgrader > Formgrader
    The result is shown in the screenshot above

Further details

Upon opening the menu second time (Step 6) the browser console (Safari) shows the following messages:

[Warning] A disposed object cannot be added. – je {_flags: 5, _layout: null, _parent: null, …} (jlab_core.6144df8e3fe03e33f880.js, line 2)
je {_flags: 5, _layout: null, _parent: null, _disposed: e, _hiddenMode: 0, …}je
[Error] Unhandled Promise Rejection: Error: A disposed object cannot be added.
	(anonymous function) (jlab_core.6144df8e3fe03e33f880.js:2:83513)
	asyncFunctionResume
	(anonymous function)
	promiseReactionJobWithoutPromise
	promiseReactionJob
[Error] TypeError: null is not an object (evaluating 'this.layout.widgets') — jlab_core.6144df8e3fe03e33f880.js:2:1605607
	m (jlab_core.6144df8e3fe03e33f880.js:2:1546745)
	b (jlab_core.6144df8e3fe03e33f880.js:2:1547162)
	t (jlab_core.6144df8e3fe03e33f880.js:2:1545706)
	y (jlab_core.6144df8e3fe03e33f880.js:2:1547390)
JupyterLab Log
I 2023-03-31 14:39:09.777 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-03-31 14:39:09.779 ServerApp] nbclassic | extension was successfully linked.
[I 2023-03-31 14:39:09.779 ServerApp] nbgrader.server_extensions.assignment_list | extension was successfully linked.
[I 2023-03-31 14:39:09.779 ServerApp] nbgrader.server_extensions.course_list | extension was successfully linked.
[I 2023-03-31 14:39:09.779 ServerApp] nbgrader.server_extensions.formgrader | extension was successfully linked.
[I 2023-03-31 14:39:09.779 ServerApp] nbgrader.server_extensions.validate_assignment | extension was successfully linked.
[I 2023-03-31 14:39:09.928 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-03-31 14:39:09.966 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-03-31 14:39:09.966 LabApp] JupyterLab extension loaded from /opt/homebrew/Caskroom/mambaforge/base/envs/nbg/lib/python3.11/site-packages/jupyterlab
[I 2023-03-31 14:39:09.966 LabApp] JupyterLab application directory is /opt/homebrew/Caskroom/mambaforge/base/envs/nbg/share/jupyter/lab
[I 2023-03-31 14:39:09.967 ServerApp] jupyterlab | extension was successfully loaded.

  _   _          _      _
 | | | |_ __  __| |__ _| |_ ___
 | |_| | '_ \/ _` / _` |  _/ -_)
  \___/| .__/\__,_\__,_|\__\___|
       |_|
                                                                           
Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.

https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html

Please note that updating to Notebook 7 might break some of your extensions.

[I 2023-03-31 14:39:09.969 ServerApp] nbclassic | extension was successfully loaded.
[I 2023-03-31 14:39:09.970 ServerApp] Loading the assignment_list nbgrader serverextension
[I 2023-03-31 14:39:09.970 ServerApp] nbgrader.server_extensions.assignment_list | extension was successfully loaded.
[I 2023-03-31 14:39:09.970 ServerApp] Loading the course_list nbgrader serverextension
[I 2023-03-31 14:39:09.970 ServerApp] nbgrader.server_extensions.course_list | extension was successfully loaded.
[I 2023-03-31 14:39:09.970 ServerApp] Loading the formgrader nbgrader serverextension
[I 2023-03-31 14:39:09.979 ServerApp] nbgrader.server_extensions.formgrader | extension was successfully loaded.
[I 2023-03-31 14:39:09.979 ServerApp] Loading the validate_assignment nbgrader serverextension
[I 2023-03-31 14:39:09.979 ServerApp] nbgrader.server_extensions.validate_assignment | extension was successfully loaded.
[I 2023-03-31 14:39:09.980 ServerApp] The port 8888 is already in use, trying another port.
[I 2023-03-31 14:39:09.980 ServerApp] Serving notebooks from local directory: /Users/Shared/nbgrader
[I 2023-03-31 14:39:09.980 ServerApp] Jupyter Server 1.23.4 is running at:
[I 2023-03-31 14:39:09.980 ServerApp] http://localhost:8889/lab?token=85a8ceab9bd094b4b872c6b0efc6c9655c16026124b5c70c
[I 2023-03-31 14:39:09.980 ServerApp]  or http://127.0.0.1:8889/lab?token=85a8ceab9bd094b4b872c6b0efc6c9655c16026124b5c70c
[I 2023-03-31 14:39:09.980 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-03-31 14:39:09.983 ServerApp] 
    
    To access the server, open this file in a browser:
        file:///Users/ecull/Library/Jupyter/runtime/jpserver-76178-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/lab?token=85a8ceab9bd094b4b872c6b0efc6c9655c16026124b5c70c
     or http://127.0.0.1:8889/lab?token=85a8ceab9bd094b4b872c6b0efc6c9655c16026124b5c70c
This version of python seems to be incorrectly compiled
(internal generated filenames are not absolute).
This may make the debugger miss breakpoints.
Related bug: http://bugs.python.org/issue1666807
[E 2023-03-31 14:39:11.699 ServerApp] Uncaught exception GET /lab/api/settings?1680266351580 (::1)
    HTTPServerRequest(protocol='http', host='localhost:8889', method='GET', uri='/lab/api/settings?1680266351580', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "/opt/homebrew/Caskroom/mambaforge/base/envs/nbg/lib/python3.11/site-packages/tornado/web.py", line 1713, in _execute
        result = await result
                 ^^^^^^^^^^^^
    tornado.iostream.StreamClosedError: Stream is closed
[W 2023-03-31 14:39:12.960 LabApp] Could not determine jupyterlab build status without nodejs
[I 2023-03-31 14:41:19.353 ServerApp] Released assignments:
[I 2023-03-31 14:41:19.359 ServerApp] Released assignments:
[I 2023-03-31 14:41:19.362 ServerApp] Released assignments:
[I 2023-03-31 14:41:19.433 ServerApp] Released assignments:
[I 2023-03-31 14:41:19.433 ServerApp] Released assignments:
[I 2023-03-31 14:41:19.433 ServerApp] Released assignments:
[I 2023-03-31 14:42:17.069 ServerApp] Released assignments:
[I 2023-03-31 14:42:17.073 ServerApp] Released assignments:
[I 2023-03-31 14:42:17.076 ServerApp] Released assignments:
[I 2023-03-31 14:42:17.094 ServerApp] Released assignments:
[I 2023-03-31 14:42:17.094 ServerApp] Released assignments:
[I 2023-03-31 14:42:17.095 ServerApp] Released assignments:
@ykazakov
Copy link
Contributor Author

A related issue for the JupyterLab extension tutorial:
jupyterlab/jupyterlab_apod#3

The proposed solution is to recreate a widget if it is disposed:
jupyterlab/jupyterlab_apod#3 (comment)

ykazakov added a commit to ykazakov/nbgrader that referenced this issue Mar 31, 2023
ykazakov added a commit to ykazakov/nbgrader that referenced this issue Apr 3, 2023
The extended tests close the opened tab and open it again
ykazakov added a commit to ykazakov/nbgrader that referenced this issue Apr 3, 2023
ykazakov added a commit to ykazakov/nbgrader that referenced this issue Apr 3, 2023
The extended tests close the opened tab and open it again
ykazakov added a commit to ykazakov/nbgrader that referenced this issue Apr 3, 2023
@perllaghu
Copy link
Contributor

perllaghu commented May 2, 2023

I can confirm this is repeatable in Firefox, Chromium, and Edge browsers, on an Ubuntu system

(and note this is a duplicate of #1722 )

brichet pushed a commit that referenced this issue Jun 12, 2023
* Extend ui tests to reproduce #1772

The extended tests close the opened tab and open it again

* Recreate nbgrader widgets after they are disposed.

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

Successfully merging a pull request may close this issue.

2 participants