From a007c6709a27da6ac33243b521722c5adbda466f Mon Sep 17 00:00:00 2001 From: telamonian Date: Tue, 29 Sep 2020 08:21:18 -0400 Subject: [PATCH] bugfix: convert nb dict to nb Node before calling `jupytext.writes` --- jupytext/contentsmanager.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jupytext/contentsmanager.py b/jupytext/contentsmanager.py index c4b62b01b..2c59921c9 100644 --- a/jupytext/contentsmanager.py +++ b/jupytext/contentsmanager.py @@ -155,7 +155,9 @@ def save_one_file(path, fmt): text_model = dict( type="file", format="text", - content=jupytext.writes(model["content"], fmt=fmt), + content=jupytext.writes( + nbformat.from_dict(model["content"]), fmt=fmt + ), ) return self.super.save(text_model, path) @@ -163,8 +165,12 @@ def save_one_file(path, fmt): return write_pair(path, jupytext_formats, save_one_file) except Exception as e: - self.log.error(u'Error while saving file: %s %s', path, e, exc_info=True) - raise HTTPError(500, u'Unexpected error while saving file: %s %s' % (path, e)) + self.log.error( + u"Error while saving file: %s %s", path, e, exc_info=True + ) + raise HTTPError( + 500, u"Unexpected error while saving file: %s %s" % (path, e) + ) def get( self,