Skip to content

Commit

Permalink
handle ValueError (#20)
Browse files Browse the repository at this point in the history
* handle ValueError

* Fix MutableMapping import on Python 3.10
  • Loading branch information
neon-ninja authored Jul 28, 2022
1 parent 6482a7b commit fc71034
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion nodebook/ipython/nodebookext.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def execute_cell(line, cell):
ipython magic for executing nodebook cell, expects cell id and parent id inline, followed by code
"""
assert NODEBOOK_STATE['nodebook'] is not None, "Nodebook not initialized, please use %nodebook {nodebook_name}"
cell_id, parent_id = line.lstrip().split(' ')
try:
cell_id, parent_id = line.lstrip().split(' ')
except ValueError:
cell_id = line.lstrip()
parent_id = None

# make sure cell exists and is in the right position
NODEBOOK_STATE['nodebook'].insert_node_after(cell_id, parent_id)
Expand Down
2 changes: 1 addition & 1 deletion nodebook/pickledict.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from UserDict import DictMixin
except ImportError:
# see https://github.com/flask-restful/flask-restful/pull/231/files
from collections import MutableMapping as DictMixin
from collections.abc import MutableMapping as DictMixin

PANDAS_CODE = 1
CLOUDPICKLE_CODE = 2
Expand Down

0 comments on commit fc71034

Please sign in to comment.