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 (