diff --git a/jupytext/contentsmanager.py b/jupytext/contentsmanager.py index d7233ce6d..12ca4d25d 100644 --- a/jupytext/contentsmanager.py +++ b/jupytext/contentsmanager.py @@ -473,10 +473,10 @@ def get_config_file(self, directory): if self.file_exists(pyproject_path): import toml - with open(pyproject_path, "r") as stream: - doc = toml.loads(stream.read()) - if doc.get("tool", {}).get("jupytext") is not None: - return pyproject_path + model = self.get(pyproject_path, type="file") + doc = toml.loads(model["content"]) + if doc.get("tool", {}).get("jupytext") is not None: + return pyproject_path if not directory: return None