From 697715eb03ae6870e97dd0ccc2ea385debd8aa51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Thu, 16 Jan 2025 09:09:33 +0100 Subject: [PATCH] Fix missing nbformat version (#304) * Fix missing nbformat version * Convert format version to int --- jupyter_ydoc/ynotebook.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jupyter_ydoc/ynotebook.py b/jupyter_ydoc/ynotebook.py index 864a79f..523b147 100644 --- a/jupyter_ydoc/ynotebook.py +++ b/jupyter_ydoc/ynotebook.py @@ -202,7 +202,11 @@ def get(self) -> Dict: cells = [] for i in range(len(self._ycells)): cell = self.get_cell(i) - if "id" in cell and meta["nbformat"] == 4 and meta["nbformat_minor"] <= 4: + if ( + "id" in cell + and int(meta.get("nbformat", 0)) == 4 + and int(meta.get("nbformat_minor", 0)) <= 4 + ): # strip cell IDs if we have notebook format 4.0-4.4 del cell["id"] if (