From e98a526a6ab4649f6cc7b2e5fbcc692586e9c3a3 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Wed, 15 May 2019 22:17:41 +0200 Subject: [PATCH] Directories are not notebooks Fixes #228 --- HISTORY.rst | 8 ++++++++ jupytext/contentsmanager.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index fc09b1110..29ac82416 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,14 @@ Release History --------------- +1.1.2 (2019-05-15) +++++++++++++++++++++++ + +**BugFixes* + +- Directories ending in .jl (or .ipynb) are not notebooks (#228) + + 1.1.1 (2019-04-16) ++++++++++++++++++++++ diff --git a/jupytext/contentsmanager.py b/jupytext/contentsmanager.py index 659e2b27e..4e39135a1 100644 --- a/jupytext/contentsmanager.py +++ b/jupytext/contentsmanager.py @@ -295,10 +295,12 @@ def save(self, model, path=''): def get(self, path, content=True, type=None, format=None, load_alternative_format=True): """ Takes a path for an entity and returns its model""" path = path.strip('/') + os_path = self._get_os_path(path) ext = os.path.splitext(path)[1] # Not a notebook? - if not self.exists(path) or (type != 'notebook' if type else ext not in self.all_nb_extensions()): + if (not self.exists(path) or os.path.isdir(os_path) or + (type != 'notebook' if type else ext not in self.all_nb_extensions())): return super(TextFileContentsManager, self).get(path, content, type, format) fmt = preferred_format(ext, self.preferred_jupytext_formats_read)