[jupytext] TypeError: 'coroutine' object is not subscriptable

Hello,
After installing jupytext package on my JupyterLab server, when I try to create a notebook, I got the following error.
Do I miss something in the configuration?

Traceback (most recent call last):
      File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/auth/decorator.py", line 73, in inner
        return await out
               ^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 285, in post
        await self._new_untitled(path, type=type, ext=ext)
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 233, in _new_untitled
        self.contents_manager.new_untitled(path=path, type=type, ext=ext)
      File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 410, in new_untitled
        config = self.get_config(path)
                 ^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 581, in get_config
        self.cached_config.config = self.load_config_file(
                                    ^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 550, in load_config_file
        config_content = model["content"]
                         ~~~~~^^^^^^^^^^^
    TypeError: 'coroutine' object is not subscriptable
[W 2024-07-25 16:43:53.545 SingleUserLabApp handlers:774] wrote error: 'Unhandled error'
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/auth/decorator.py", line 73, in inner
        return await out
               ^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 285, in post
        await self._new_untitled(path, type=type, ext=ext)
      File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 233, in _new_untitled
        self.contents_manager.new_untitled(path=path, type=type, ext=ext)
      File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 410, in new_untitled
        config = self.get_config(path)
                 ^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 581, in get_config
        self.cached_config.config = self.load_config_file(
                                    ^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 550, in load_config_file
        config_content = model["content"]
                         ~~~~~^^^^^^^^^^^
    TypeError: 'coroutine' object is not subscriptable
Jupyterlab Version 4.2.4

$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.26.0
ipykernel        : 6.29.5
ipywidgets       : 8.1.3
jupyter_client   : 8.6.2
jupyter_core     : 5.7.2
jupyter_server   : 2.14.2
jupyterlab       : 4.2.4
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : 7.2.1
qtconsole        : not installed
traitlets        : 5.14.3
$ python --version
Python 3.11.9

How did you install jupytext?

Yes, I’ve installed jupytext with mamba install jupytext
jupytext 1.16.3 pyhd8ed1ab_0 conda-forge

Hmmm. Your version is known to be an issue. See here:

“We use asyncio.iscoroutinefunction to determine whether the current contents manager is sync or async (#1260)”

Even though the error there doesn’t match yours, I suspect since ‘coroutine’ is involved in yours, that it is related. Try downgrading to 1.16.2 like the original post there says?

1 Like

Thank you very much for your quick answer, it works with jupytext 1.16.2.

1 Like