Comments (8)
Would you post which version of nbconvert and hide_code you're using?
from hide_code.
Thanks for the prompt reply!
I'm using nbconvert 6.0.6 and hide_code 0.5.5.
from hide_code.
It looks like hide_code isn't fully installed. Can you run jupyter nbextension list
and jupyter serverextension list
then post the output of each?
from hide_code.
Also might be an issue with nbconvert 6.x. This was release a couple of weeks ago and I haven't tested hide_code against it yet.
from hide_code.
Yes, please find the output below
xjjgww:~ xjjgwws-MacBook-Air:~
() xjjgww/ ⁄(⁄⁄•⁄ω⁄•⁄⁄)⁄$ jupyter nbextension list
Known nbextensions:
config dir: /Users/xjjgww/.jupyter/nbconfig
notebook section
hide_code/hide_code enabled
- Validating: OK
config dir: /usr/local/etc/jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
xjjgww:~ xjjgwws-MacBook-Air:~
() xjjgww/ ⁄(⁄⁄•⁄ω⁄•⁄⁄)⁄$ jupyter serverextension list
config dir: /Users/xjjgww/.jupyter
hide_code enabled
- Validating...
hide_code OK
config dir: /usr/local/etc/jupyter
jupyterlab enabled
- Validating...
jupyterlab 2.2.8 OK
from hide_code.
Just noticed nbconvert 6.X may have broke this extension.
template_path has become template_paths. If referring to a 5.x style .tpl template use the full path with the template_file argument to the file. On the command line the pattern is --template-file=<path/to/file.tpl>.
Try downgrading to nbconvert 5.x until I can get hide_code updated.
from hide_code.
Many thanks for figuring this out!
I tried nbconvert 5.5 and 5.6 (uninstall 6.x and install 5.x). jupyter nbconvert --to html
works but jupyter nbconvert --to hide_code_html
threw
traitlets.traitlets.TraitError: 'template_path' is not a trait of 'HideCodeHTMLExporter' instances
The detailed output is as
[NbConvertApp] Converting notebook LIGOtutorialJLab.ipynb to hide_code_html
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/traitlets/traitlets.py", line 535, in get
value = obj._trait_values[self.name]
KeyError: 'template_path'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/jupyter-nbconvert", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/jupyter_core/application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.7/site-packages/traitlets/config/application.py", line 837, in launch_instance
app.start()
File "/usr/local/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 340, in start
self.convert_notebooks()
File "/usr/local/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 510, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/usr/local/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 481, in convert_single_notebook
output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
File "/usr/local/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 410, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/usr/local/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 179, in from_filename
return self.from_file(f, resources=resources, **kw)
File "/usr/local/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 197, in from_file
return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
File "/usr/local/lib/python3.7/site-packages/nbconvert/exporters/html.py", line 94, in from_notebook_node
self.register_filter('highlight_code', highlight_code)
File "/usr/local/lib/python3.7/site-packages/nbconvert/exporters/templateexporter.py", line 383, in register_filter
return self._register_filter(self.environment, name, jinja_filter)
File "/usr/local/lib/python3.7/site-packages/nbconvert/exporters/templateexporter.py", line 126, in environment
self._environment_cached = self._create_environment()
File "/usr/local/lib/python3.7/site-packages/nbconvert/exporters/templateexporter.py", line 411, in _create_environment
additional_paths + \
File "/usr/local/lib/python3.7/site-packages/hide_code/hide_code_html_exporter.py", line 27, in template_path
return super(HideCodeHTMLExporter, self).template_path + [os.path.join(os.path.dirname(__file__), "Templates")]
File "/usr/local/lib/python3.7/site-packages/traitlets/traitlets.py", line 575, in __get__
return self.get(obj, cls)
File "/usr/local/lib/python3.7/site-packages/traitlets/traitlets.py", line 538, in get
default = obj.trait_defaults(self.name)
File "/usr/local/lib/python3.7/site-packages/traitlets/traitlets.py", line 1574, in trait_defaults
"instances" % (n, type(self).__name__))
traitlets.traitlets.TraitError: 'template_path' is not a trait of 'HideCodeHTMLExporter' instances
Any idea why this happened? Thank you!
from hide_code.
After some more digging nbconvert 6.0 also forces traitlets to upgrade from 4.x to 5.x. Would you try also downgrading to traitlets==4.3.3. This worked for me on a fresh virtualenv with Python 3.8.
Here's the output of jupyter --version
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : 4.7.7
ipython : 7.18.1
ipykernel : 5.3.4
jupyter client : 6.1.7
jupyter lab : not installed
nbconvert : 5.4.1
ipywidgets : 7.5.1
nbformat : 5.0.7
traitlets : 4.3.3
from hide_code.
Related Issues (20)
- URL for exports are incorrect using jupyterhub HOT 1
- Support for recent nbconvert and traitlets HOT 4
- pip install on Mac OSx 13.6 doesn't recognize existing pyzmq v25.1.2 already installed
- It is impossible to export to HTML if notebook was renamed
- Export to HTML and PDF still with the output HOT 6
- Hide code : Support for letters with accent marks HOT 2
- Using hide_code then convert to PDF HOT 1
- Add Binder demo HOT 1
- Use tags to identify cell disclosure state
- hide-code v0.5.5 cannot be installed via pypi HOT 2
- Install with Conda HOT 1
- Installation problem - No module named hide_code_html_exporter HOT 9
- Exporting result in 404 error on Jupyterhub HOT 1
- 404 : Not Found You are requesting a page that does not exist! HOT 4
- 500: Internal Server Error when exporting to... anything? HOT 6
- Jupyter Lab 3.0 not supported HOT 4
- Can't install into an empty virtual environment HOT 1
- Traitlets too old for Jupyter Server HOT 3
- Impossible to make it work with jupyter installed with anaconda
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hide_code.