From fdc32ea310d4b054b1ac714a3caa6abdd76dbcab Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Tue, 26 Feb 2019 18:39:24 +0100 Subject: [PATCH] Rename paired notebooks, even those that were not previously open #190 --- jupytext/contentsmanager.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jupytext/contentsmanager.py b/jupytext/contentsmanager.py index e637df558..1020fa3ea 100644 --- a/jupytext/contentsmanager.py +++ b/jupytext/contentsmanager.py @@ -413,6 +413,14 @@ def trust_notebook(self, path): def rename_file(self, old_path, new_path): """Rename the current notebook, as well as its alternative representations""" + if old_path not in self.paired_notebooks: + try: + # we do not know yet if this is a paired notebook (#190) + # -> to get this information we open the notebook + self.get(old_path, content=True) + except Exception: + pass + if old_path not in self.paired_notebooks: super(TextFileContentsManager, self).rename_file(old_path, new_path) return