removing certain cells via tags fails due to wrong type
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
jupyter-notebook
add a comment |
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
jupyter-notebook
add a comment |
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
jupyter-notebook
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
jupyter-notebook
jupyter-notebook
asked Nov 23 at 8:59
math
520923
520923
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
many thanks for your answer. Everything goes through now but I still get the input cells. the file looks ok, as there is a tag:{ "cells": [ { "cell_type": "code", "execution_count": 77, "metadata": { "tags": [ "remove_cell" ] },
– math
Nov 26 at 17:15
Can you share the test.ipynb file. So that I can reproduce the issue.
– Sangram Gaikwad
Nov 27 at 5:53
@math Remember you will still view input cells in notebook (test.ipynb), Only after converting to HTML/other formats the tagged cells will be removed. Hence I suggest you also sharetest.html
file.
– Sangram Gaikwad
Nov 27 at 6:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443437%2fremoving-certain-cells-via-tags-fails-due-to-wrong-type%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
many thanks for your answer. Everything goes through now but I still get the input cells. the file looks ok, as there is a tag:{ "cells": [ { "cell_type": "code", "execution_count": 77, "metadata": { "tags": [ "remove_cell" ] },
– math
Nov 26 at 17:15
Can you share the test.ipynb file. So that I can reproduce the issue.
– Sangram Gaikwad
Nov 27 at 5:53
@math Remember you will still view input cells in notebook (test.ipynb), Only after converting to HTML/other formats the tagged cells will be removed. Hence I suggest you also sharetest.html
file.
– Sangram Gaikwad
Nov 27 at 6:13
add a comment |
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.
many thanks for your answer. Everything goes through now but I still get the input cells. the file looks ok, as there is a tag:{ "cells": [ { "cell_type": "code", "execution_count": 77, "metadata": { "tags": [ "remove_cell" ] },
– math
Nov 26 at 17:15
Can you share the test.ipynb file. So that I can reproduce the issue.
– Sangram Gaikwad
Nov 27 at 5:53
@math Remember you will still view input cells in notebook (test.ipynb), Only after converting to HTML/other formats the tagged cells will be removed. Hence I suggest you also sharetest.html
file.
– Sangram Gaikwad
Nov 27 at 6:13
add a comment |
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.
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 Nov 26 at 11:49
Sangram Gaikwad
18910
18910
many thanks for your answer. Everything goes through now but I still get the input cells. the file looks ok, as there is a tag:{ "cells": [ { "cell_type": "code", "execution_count": 77, "metadata": { "tags": [ "remove_cell" ] },
– math
Nov 26 at 17:15
Can you share the test.ipynb file. So that I can reproduce the issue.
– Sangram Gaikwad
Nov 27 at 5:53
@math Remember you will still view input cells in notebook (test.ipynb), Only after converting to HTML/other formats the tagged cells will be removed. Hence I suggest you also sharetest.html
file.
– Sangram Gaikwad
Nov 27 at 6:13
add a comment |
many thanks for your answer. Everything goes through now but I still get the input cells. the file looks ok, as there is a tag:{ "cells": [ { "cell_type": "code", "execution_count": 77, "metadata": { "tags": [ "remove_cell" ] },
– math
Nov 26 at 17:15
Can you share the test.ipynb file. So that I can reproduce the issue.
– Sangram Gaikwad
Nov 27 at 5:53
@math Remember you will still view input cells in notebook (test.ipynb), Only after converting to HTML/other formats the tagged cells will be removed. Hence I suggest you also sharetest.html
file.
– Sangram Gaikwad
Nov 27 at 6:13
many thanks for your answer. Everything goes through now but I still get the input cells. the file looks ok, as there is a tag:
{ "cells": [ { "cell_type": "code", "execution_count": 77, "metadata": { "tags": [ "remove_cell" ] },
– math
Nov 26 at 17:15
many thanks for your answer. Everything goes through now but I still get the input cells. the file looks ok, as there is a tag:
{ "cells": [ { "cell_type": "code", "execution_count": 77, "metadata": { "tags": [ "remove_cell" ] },
– math
Nov 26 at 17:15
Can you share the test.ipynb file. So that I can reproduce the issue.
– Sangram Gaikwad
Nov 27 at 5:53
Can you share the test.ipynb file. So that I can reproduce the issue.
– Sangram Gaikwad
Nov 27 at 5:53
@math Remember you will still view input cells in notebook (test.ipynb), Only after converting to HTML/other formats the tagged cells will be removed. Hence I suggest you also share
test.html
file.– Sangram Gaikwad
Nov 27 at 6:13
@math Remember you will still view input cells in notebook (test.ipynb), Only after converting to HTML/other formats the tagged cells will be removed. Hence I suggest you also share
test.html
file.– Sangram Gaikwad
Nov 27 at 6:13
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443437%2fremoving-certain-cells-via-tags-fails-due-to-wrong-type%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown