Skip to content

Commit 5f4b511

Browse files
author
Jimmie Goode
committed
Handle missing attachment key
1 parent a5e6c3c commit 5f4b511

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jupyter_ydoc/ydoc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_cell(self, index: int) -> Dict[str, Any]:
9090
if "id" in cell and meta["nbformat"] == 4 and meta["nbformat_minor"] <= 4:
9191
# strip cell IDs if we have notebook format 4.0-4.4
9292
del cell["id"]
93-
if cell["cell_type"] in ["raw", "markdown"] and not cell["attachments"]:
93+
if "attachments" in cell and cell["cell_type"] in ["raw", "markdown"] and not cell["attachments"]:
9494
del cell["attachments"]
9595
return cell
9696

@@ -137,7 +137,7 @@ def get(self):
137137
if "id" in cell and meta["nbformat"] == 4 and meta["nbformat_minor"] <= 4:
138138
# strip cell IDs if we have notebook format 4.0-4.4
139139
del cell["id"]
140-
if cell["cell_type"] in ["raw", "markdown"] and not cell["attachments"]:
140+
if "attachments" in cell and cell["cell_type"] in ["raw", "markdown"] and not cell["attachments"]:
141141
del cell["attachments"]
142142
cells.append(cell)
143143

0 commit comments

Comments
 (0)