removing certain cells via tags fails due to wrong type












2















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










share|improve this question



























    2















    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










    share|improve this question

























      2












      2








      2








      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










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 8:59









      mathmath

      314925




      314925
























          1 Answer
          1






          active

          oldest

          votes


















          1





          +50









          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:




          1. jupyter nbconvert --generate-config
            This will generate default ~/.jupyter/jupyter_nbconvert_config.py.


          2. Edit the configuration file and specify your configuration, in this case
            c.TagRemovePreprocessor.remove_input_tags = set(['remove_cell'])


          3. Run jupyter nbconvert test.ipynb This will remove the tagged cells and convert it to default HTML page.






          share|improve this answer
























          • 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 '18 at 17:15











          • Can you share the test.ipynb file. So that I can reproduce the issue.

            – Sangram Gaikwad
            Nov 27 '18 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 '18 at 6:13












          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
          });


          }
          });














          draft saved

          draft discarded


















          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









          1





          +50









          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:




          1. jupyter nbconvert --generate-config
            This will generate default ~/.jupyter/jupyter_nbconvert_config.py.


          2. Edit the configuration file and specify your configuration, in this case
            c.TagRemovePreprocessor.remove_input_tags = set(['remove_cell'])


          3. Run jupyter nbconvert test.ipynb This will remove the tagged cells and convert it to default HTML page.






          share|improve this answer
























          • 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 '18 at 17:15











          • Can you share the test.ipynb file. So that I can reproduce the issue.

            – Sangram Gaikwad
            Nov 27 '18 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 '18 at 6:13
















          1





          +50









          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:




          1. jupyter nbconvert --generate-config
            This will generate default ~/.jupyter/jupyter_nbconvert_config.py.


          2. Edit the configuration file and specify your configuration, in this case
            c.TagRemovePreprocessor.remove_input_tags = set(['remove_cell'])


          3. Run jupyter nbconvert test.ipynb This will remove the tagged cells and convert it to default HTML page.






          share|improve this answer
























          • 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 '18 at 17:15











          • Can you share the test.ipynb file. So that I can reproduce the issue.

            – Sangram Gaikwad
            Nov 27 '18 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 '18 at 6:13














          1





          +50







          1





          +50



          1




          +50





          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:




          1. jupyter nbconvert --generate-config
            This will generate default ~/.jupyter/jupyter_nbconvert_config.py.


          2. Edit the configuration file and specify your configuration, in this case
            c.TagRemovePreprocessor.remove_input_tags = set(['remove_cell'])


          3. Run jupyter nbconvert test.ipynb This will remove the tagged cells and convert it to default HTML page.






          share|improve this answer













          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:




          1. jupyter nbconvert --generate-config
            This will generate default ~/.jupyter/jupyter_nbconvert_config.py.


          2. Edit the configuration file and specify your configuration, in this case
            c.TagRemovePreprocessor.remove_input_tags = set(['remove_cell'])


          3. Run jupyter nbconvert test.ipynb This will remove the tagged cells and convert it to default HTML page.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 11:49









          Sangram GaikwadSangram Gaikwad

          344212




          344212













          • 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 '18 at 17:15











          • Can you share the test.ipynb file. So that I can reproduce the issue.

            – Sangram Gaikwad
            Nov 27 '18 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 '18 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 '18 at 17:15











          • Can you share the test.ipynb file. So that I can reproduce the issue.

            – Sangram Gaikwad
            Nov 27 '18 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 '18 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 '18 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 '18 at 17:15













          Can you share the test.ipynb file. So that I can reproduce the issue.

          – Sangram Gaikwad
          Nov 27 '18 at 5:53





          Can you share the test.ipynb file. So that I can reproduce the issue.

          – Sangram Gaikwad
          Nov 27 '18 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 '18 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 '18 at 6:13




















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          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





















































          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







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()