Issue
I want to hide certain parts of a jupyter notebook and came across tags which can achieve this. I've tagged the cells with remove_cell
in my notebook an tried to run
$ jupyter nbconvert test.ipynb --TagRemovePreprocessor.remove_input_tags="{'remove_cell'}"
however I always get the following error:
traitlets.traitlets.TraitError: The 'remove_input_tags' trait of a TagRemovePreprocessor instance must be a set, but a value of type 'unicode' (i.e. u'{remove_cell}') was specified.
I've tried to change the "{'remove_cell'}"
to various format, e.g. {'remove_cell'}
etc with the same result. Any help would be appreciated
Solution
According to nbconvert documentation it must be done as you have specified. But there seems to be some bug in command line parsing traitlets
API, used internally by jupyter nbconvert. So i tried a slightly different approach of specifying Configuration in jupyter_nbconvert_config.py
file.
Steps:
jupyter nbconvert --generate-config
This will generate default ~/.jupyter/jupyter_nbconvert_config.py.Edit the configuration file and specify your configuration, in this case
c.TagRemovePreprocessor.remove_input_tags = set(['remove_cell'])
- Run
jupyter nbconvert test.ipynb
This will remove the tagged cells and convert it to default HTML page.
Answered By - Sangram Gaikwad
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.