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

invalid pyproject.toml breaks JupyterLab #1103

Closed
edublancas opened this issue Jul 15, 2023 · 1 comment · Fixed by #1111
Closed

invalid pyproject.toml breaks JupyterLab #1103

edublancas opened this issue Jul 15, 2023 · 1 comment · Fixed by #1111

Comments

@edublancas
Copy link

edublancas commented Jul 15, 2023

Hi. Thanks a lot for jupytext, I've been an avid user for years!

I was testing some functionality we're adding to JupySQL and started to play around with invalid configurations:

[tool.jupysql.SqlMagic]
autopandas = False
displaylimit = 1

I put False on purpose to create an invalid TOML.

Then, I noticed my JupyterLab started giving errors, and the console showed this message:

    ValueError: Only all lowercase booleans allowed

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/eduardo/miniconda3/envs/jupysql/lib/python3.10/site-packages/tornado/web.py", line 1786, in _execute
        result = await result
      File "/Users/eduardo/miniconda3/envs/jupysql/lib/python3.10/site-packages/jupyter_server/services/contents/handlers.py", line 122, in get
        self.contents_manager.get(
      File "/Users/eduardo/miniconda3/envs/jupysql/lib/python3.10/site-packages/jupytext/contentsmanager.py", line 199, in get
        return self.super.get(path, content, type, format)
      File "/Users/eduardo/miniconda3/envs/jupysql/lib/python3.10/site-packages/jupyter_server/services/contents/filemanager.py", line 428, in get
        model = self._dir_model(path, content=content)
      File "/Users/eduardo/miniconda3/envs/jupysql/lib/python3.10/site-packages/jupyter_server/services/contents/filemanager.py", line 320, in _dir_model
        contents.append(self.get(path=f"{path}/{name}", content=False))
      File "/Users/eduardo/miniconda3/envs/jupysql/lib/python3.10/site-packages/jupytext/contentsmanager.py", line 201, in get
        config = self.get_config(path, use_cache=content is False)
      File "/Users/eduardo/miniconda3/envs/jupysql/lib/python3.10/site-packages/jupytext/contentsmanager.py", line 571, in get_config
        config_file = self.get_config_file(parent_dir)
      File "/Users/eduardo/miniconda3/envs/jupysql/lib/python3.10/site-packages/jupytext/contentsmanager.py", line 518, in get_config_file
        doc = toml.loads(model["content"])
      File "/Users/eduardo/miniconda3/envs/jupysql/lib/python3.10/site-packages/toml/decoder.py", line 514, in loads
        raise TomlDecodeError(str(err), original, pos)
    toml.decoder.TomlDecodeError: Only all lowercase booleans allowed (line 2 column 1 char 24)

Since this is affecting the contents manager, this breaks JupyterLab, as files are no longer visible:

image

Uninstalling jupytext fixes the problem.

I'm using jupytext 1.14.7

@mwouts
Copy link
Owner

mwouts commented Jul 16, 2023

Hey @edublancas , thank you for your kinds words. Yes it would make sense to catch errors on invalid configurations, at least in Jupyter - I'll try to provide a fix soon.

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