Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle ValueError #20

Merged
merged 2 commits into from
Jul 28, 2022
Merged

handle ValueError #20

merged 2 commits into from
Jul 28, 2022

Conversation

neon-ninja
Copy link
Contributor

@neon-ninja neon-ninja commented Aug 30, 2021

Hi,

This PR fixes the following exception:

ValueError                                Traceback (most recent call last)
<ipython-input-7-705f095156ba> in <module>
----> 1 get_ipython().run_cell_magic('execute_cell', ' EB910D7B09F2443081D464E1B36C9392', 'x = 4\n')

/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2401             with self.builtin_trap:
   2402                 args = (magic_arg_s, cell)
-> 2403                 result = fn(*args, **kwargs)
   2404             return result
   2405 

~/git/nodebook/nodebook/ipython/nodebookext.py in execute_cell(line, cell)
     70     print(line.lstrip().split(' '))
     71     assert NODEBOOK_STATE['nodebook'] is not None, "Nodebook not initialized, please use %nodebook {nodebook_name}"
---> 72     cell_id, parent_id = line.lstrip().split(' ')
     73 
     74     # make sure cell exists and is in the right position

ValueError: not enough values to unpack (expected 2, got 1)

This problem appears to have been caused by ipython rstriping the %%execute_cell line magic - if the trailing space were there, parent_id would be ''. Note this problem only occurs with the first cell in the notebook, as it's the only cell without a parent.

@kzielnicki
Copy link
Contributor

Hi! Sorry to not notice your PR, nodebook hasn't been in active use or development for some time. I'm happy to merge your fix though, thanks for submitting it!

@kzielnicki kzielnicki merged commit fc71034 into stitchfix:master Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants