kirbs- / hide_code Goto Github PK
View Code? Open in Web Editor NEWCode, prompt and output hiding for Jupyter/IPython notebooks.
License: MIT License
Code, prompt and output hiding for Jupyter/IPython notebooks.
License: MIT License
Thank you for this great extension! Is there any convinent way to export the latex file used to generate pdf? The raw tex file is useful when writing a report.
Hi, after I Install hide_code as following step:
pip install hide_code
jupyter nbextension install --py hide_code
jupyter nbextension enable --py hide_code
jupyter serverextension enable --py hide_code
I try to export PDF, but it still has "Code" in output.
then I go to
http://localhost:8888/nbextensions?nbextension=hide_code/hide_code.
I found there was a warning below:
-------------- warning start ------------
hide_code/hide_code
This nbextension is enabled in the notebook json config, but doesn't provide a yaml file to tell us how to configure it. You can still enable or disable it from here, though.
section: notebook
require path: hide_code/hide_code
compatibility: ?.x
-------------- warning end ------------
How can I solve this problem?
Thanks very much for your help.
My environment :
jupyter notebook --version
5.4.1
jupyter nbconvert --version
5.3.1
HideCodeLatexPDFExporter doesn't actually exist. Need to create the class as an extension of HideCodeLatexExporter.
Line 97 in a5a76d4
[E 16:23:51.341 NotebookApp] Uncaught exception GET /notebooks/Daily_Report.ipynb (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Daily_Report.ipynb', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/tornado/web.py", line 1541, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/tornado/web.py", line 2949, in wrapper
return method(self, *args, **kwargs)
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/notebook/notebook/handlers.py", line 59, in get
get_custom_frontend_exporters=get_custom_frontend_exporters
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/notebook/base/handlers.py", line 424, in render_template
return template.render(**ns)
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
{% extends "page.html" %}
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/notebook/templates/page.html", line 154, in top-level template code
{% block header %}
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/notebook/templates/notebook.html", line 117, in block "header"
{% for exporter in get_custom_frontend_exporters() %}
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/notebook/notebook/handlers.py", line 24, in get_custom_frontend_exporters
exporter = get_exporter(name)()
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/nbconvert/exporters/base.py", line 95, in get_exporter
return entrypoints.get_single('nbconvert.exporters', name).load()
File "/home/dans/projects/Daily_Instrument_Review/DIR/lib/python3.6/site-packages/entrypoints.py", line 81, in load
obj = getattr(obj, attr)
AttributeError: module 'hide_code' has no attribute 'HideCodeLatexPDFExporter'
I use %run to run a python code and define some universal parameters in notebooks.
Also using following in Markdown cells to grab defined parameters from code cells and show as markdown.
Project:
{{parameter.replace("_"," ").title()}}
This works nicely in both html and pdf format through nbconvert, but using this extension it comes out as:
Project: {{parameter.replace(“_“,” “).title()}}
However, I expected:
Project: parameter value
Hi,
When I try to install as root (on Ubuntu):
Running post install task
Starting hide_code.js install
Unable to install into /usr/lib/python2.7/site-packages/notebook/static/custom
Directory doesn't exist.
Make sure Jupyter is installed.
Install as a user doesn't work either.
My custom directory resides under ~/.jupyter/custom
Is there a way to fix the code to configure custom.js to auto-load hide_code.js in the .jupyter directory?
I have also modified my custom.js so will your install break the original custom.js?
Would be great if I could just export/convert notebook to html/pdf and have option to hide all code/prompts globally, instead of having to set which cell to hide cell by cell.
Hi, thanks for this awesome extension, it is just what I needed.
It works pretty well with another amazing extension, RISE, however when I want to export it to slides, it doesn't properly hide the input cells.
I use the following command to perform the conversion
jupyter-nbconvert my_file.ipynb --to slides --post serve
Do you have any ideia or any suggestion regarding this issue?
Thanks!
Hi,
This plugin is really perfect for focusing on the important part of the code.
It could be a good feature to keep the cells hidden or not when sending it to someone else (who has the plugin) or opening the same notebook again.
Thanks for the great job.
When using Python-Markdown to call variables in markdown cells and then using jupyter nbconvert --to hide_code_pdf experian_report.ipynb
to compile pdf, variables are outputted as {{ var }} instead of the actual number.
In a code cell:
a = 1.23
In a markdown cell:
The result is {{ a }}
Result in the markdown cell in notebook:
The result is 1.23
Result in compiled pdf:
The result is {{ a }}
This does not fail when compiling using jupyter nbconvert --to pdf notebook.ipynb
I have gone through the issues and the solutions are not working for me.
I know they should, as I'm encountering the same problem with them but in my case the notebook in not in level3 or above folders:
Pasting the error below:
[W 10:10:11.014 NotebookApp] 404 GET /notebooks/Untitled.ipynb/export/html (::1): No such file or directory: Untitled.ipynb/export/html
[W 10:10:11.017 NotebookApp] 404 GET /notebooks/Untitled.ipynb/export/html (::1) 4.88ms referer=http://localhost:8888/notebooks/Untitled.ipynb
[W 10:10:15.449 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20161104100928 (::1) 2.63ms referer=http://localhost:8888/notebooks/Untitled.ipynb
When I run the 3rd install command (after successfully running the first two commands) jupyter nbextension install --py hide_code
I get the following error:
ValueError: No JSON object could be decoded
with the following traceback:
Traceback (most recent call last):
File "/usr/local/bin/jupyter-nbextension", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/local/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python2.7/site-packages/notebook/nbextensions.py", line 988, in start
super(NBExtensionApp, self).start()
File "/usr/local/lib/python2.7/site-packages/jupyter_core/application.py", line 256, in start
self.subapp.start()
File "/usr/local/lib/python2.7/site-packages/notebook/nbextensions.py", line 896, in start
self.toggle_nbextension_python(self.extra_args[0])
File "/usr/local/lib/python2.7/site-packages/notebook/nbextensions.py", line 872, in toggle_nbextension_python
logger=self.log)
File "/usr/local/lib/python2.7/site-packages/notebook/nbextensions.py", line 483, in enable_nbextension_python
logger=logger)
File "/usr/local/lib/python2.7/site-packages/notebook/nbextensions.py", line 386, in _set_nbextension_state_python
for nbext in nbexts]
File "/usr/local/lib/python2.7/site-packages/notebook/nbextensions.py", line 351, in _set_nbextension_state
cm.update(section, {"load_extensions": {require: state}})
File "/usr/local/lib/python2.7/site-packages/traitlets/config/manager.py", line 85, in update
data = self.get(section_name)
File "/usr/local/lib/python2.7/site-packages/traitlets/config/manager.py", line 63, in get
return json.load(f)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 291, in load
**kw)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
It would be great if you could fix this.
Nice work creating this module. However I get an internal server error when I try to use the export to html button. I have all required modules installed and on the right version I think. Any ideas on why this fails?
Hi,
First off, thanks for sharing the great tool. I hope to be able to enjoy it to produce nice & clean pdf notes. However, I ran into problems. I've installed the extension with no issues, restarted both the jupyter session and the browser but the hide_code toolbar still doesn't appear in the menu. I'm on OS X, Safari, anaconda, Python 2.7, nbconvert 4.2. What can be the problem?
Thanks in advance. Cheers
Luke
Hi,
I'm trying to export to a notebook to a html file with codes hidden.
But, it returned an error message, "500: illegal multibyte sequence".
Can anyone help with this matter?
Many thanks in advance.
I can't seem to produce a HTML file with the output of a bash magic command.
My notebook only contains the following code cell.
%%bash
echo 'test'
Its output appears fine in the notebook, but disappears when I convert it to HTML. All hide_code tick-boxes are unchecked. Disabling the hide_code extension does show the output in the exported HTML file.
Much appreciated!
When I export the notebook using --to hide_code_html outputs for cells with print(variable) are not exported in the HTML, instead, there is black space in the HTML.
The problem persists even if I am not hiding the code for the cell.
Thanks for writing the very useful code.
I am using 4.1.36-44 kernel on Leap 42.1. I can get the code to hide within Jupyter, but cannot get the code to hide in the output to html or pdf, either through command prompt or using the buttons. I get the error:
404 : Not Found
You are requesting a page that does not exist!
I tried putting the notebook file in the root directory of Jupyter and that did not help either. I have conda updated, I am using python 2.7 and nbconvert is ver. 4.2.0.
Any help will be appreciated.
I successfully installed and run hide_code, however when exporting to pdf via Latex, the output pdf still show all code in cells.
My system is Windows 7 64-bit, and running Jupyter Notebook from Anaconda environment. hide_code was installed with pip.
Here is the output prompt:
[I 10:08:31.360 NotebookApp] hide_code: Starting Latex PDF export for /modelTrai
n.ipynb
[I 10:08:32.926 NotebookApp] Support files will be in
[I 10:08:32.944 NotebookApp] Writing 79518 bytes to notebook.tex
[I 10:08:32.949 NotebookApp] Building PDF
[I 10:08:32.956 NotebookApp] Running pdflatex 3 times: ['pdflatex', 'notebook.te
x']
[I 10:08:38.984 NotebookApp] Running bibtex 1 time: ['bibtex', 'notebook']
[W 10:08:39.107 NotebookApp] b had problems, most likely because there were no c
itations
[I 10:08:39.108 NotebookApp] PDF successfully created
[I 10:08:39.117 NotebookApp] hide_code: Finished Latex PDF export for /modelTrai
n.ipynb
It seems like there is an issue, but I don't know how to fix it.
Thank you!
I'm having trouble getting hide_code
to work correctly. The controls seem to work correctly in the UI, and the code cells toggle visibility as expected. However when clicking the "Export to HTML" button, the resulting HTML file always includes the code cells and makes them visible.
I've confirmed I'm using nbconvert 4.3.0, in case that matters.
The log shows
Warning: Failed to load file:///var/folders/kj/lwmmwfsd06vgf4vhxq0dc76jr802s3/T/custom.css (ignore)
Is it possible this is related to #18 ?
On Windows, I get a 404 error similar to what we saw here when I click html export on a notebook that is 4 layers deep: tree/folder1/folder2/folder3
. When the notebook is in folder1 or 2, things work. Thanks.
Thanks for your useful work! When exporting to HTML Jupyter 5.4.1 puts the correct title, however when exporting via the plugin button (I installed via pip) gives
<title>Notebook</title>
Also when using "Download as.." for a notebook named with spaces, e.g. "x y z.ipynb", it suggests a correct name "x y z.html", while the plugin suggests "x.html".
I get these warnings and the resulting file still shows the code.
Any suggestions?
$ jupyter nbconvert --to hide_code_html --execute ./MDT\ -\ prod.ipynb
[NbConvertApp] WARNING | Config option template_path
not recognized by HideCodeHTMLExporter
. Did you mean one of: template_extension, template_file
?
[NbConvertApp] Converting notebook ./MDT - prod.ipynb to hide_code_html
[NbConvertApp] Executing notebook with kernel: python3
[NbConvertApp] Writing 336217 bytes to ./MDT - prod.html
$
See #23. Need to update to support installation via nbextensions.
Hey, I love your code hiding tool. I works great in the Browser and I can also produce pdfs from the command line. But I would really like to have the tex-file as well. I used
jupyter nbconvert --to hide_code_latex notebook.ipynb
and
jupyter nbconvert --to hide_code_latexpdf notebook.ipynb
but this only spits out the following:
Traceback (most recent call last):
File "/usr/local/bin/jupyter-nbconvert", line 11, in
sys.exit(main())
File "/home/johanna/.local/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/johanna/.local/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/johanna/.local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 293, in start
self.convert_notebooks()
File "/home/johanna/.local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 446, in convert_notebooks
cls = get_exporter(self.export_format)
File "/home/johanna/.local/lib/python2.7/site-packages/nbconvert/exporters/export.py", line 188, in get_exporter
return entrypoints.get_single('nbconvert.exporters', name).load()
File "/home/johanna/.local/lib/python2.7/site-packages/entrypoints.py", line 77, in load
mod = import_module(self.module_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
ImportError: No module named HideCodeLatexPDFExporter
I'd really appreciate some help.
Hi,
I have installed hide_code 0.5. While exporting to html, I met an error as the following:
"500 : illegal multibyte sequence".
In the notebook, there are Chinese characters.
I'd really appreciate some help.
Clicking on the html export button gives a 404 not found. On the console:
[W 18:58:31.068 NotebookApp] 404 GET /notebooks/nalyze/testing-123.ipynb/export/html (127.0.0.1): No such file or directory: nalyze/testing-123.ipynb/export/html
As an utter jupyter newbie, I have no clue where to look for additional debug messages.
OS is Debian testing.
I'm experiencing an odd behavior where once I've a non-None
cell toolbar view selected, then toggle the hide/show code button, I can no longer switch cell toolbar view back to None
. Here is a gif of an example:
System info:
$ conda list | grep jupyter
jupyter 1.0.0 py35_1
jupyter-client 4.1.1 <pip>
jupyter-console 4.1.0 <pip>
jupyter-core 4.0.6 <pip>
jupyter_client 4.1.1 py35_0
jupyter_console 4.1.0 py35_0
jupyter_core 4.0.6 py35_0
$ conda list | grep ipython
ipython 4.0.3 py35_0
ipython-genutils 0.1.0 <pip>
ipython-notebook 4.0.4 py35_0
ipython-qtconsole 4.0.1 py35_0
ipython_genutils 0.1.0 py35_0
$ conda info
Using Anaconda Cloud api site https://api.anaconda.org
Current conda install:
platform : linux-64
conda version : 3.19.0
conda-build version : 1.18.2
python version : 3.5.1.final.0
requests version : 2.9.1
root environment : /home/ubuntu/anaconda3 (writable)
default environment : /home/ubuntu/anaconda3
envs directories : /home/ubuntu/anaconda3/envs
package cache : /home/ubuntu/anaconda3/pkgs
channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
https://repo.continuum.io/pkgs/free/noarch/
https://repo.continuum.io/pkgs/pro/linux-64/
https://repo.continuum.io/pkgs/pro/noarch/
config file : None
is foreign system : False
Very nicely done extension, thank you. Works great when viewing the notebook in Jupyter, but doesn't seem to work on export with the latest version of Jupyter.
First, it doesn't install; I think the location for extensions has moved to ~/.local/share/jupyter/nbextensions/
. I installed it manually.
The toolbar buttons show up in the viewer, and clicking the toggle button hides code; but all of the export buttons redirect to the wrong URL. They're trying to go to /notebooks/mynotebook.ipynb/export/html
, but it looks like the new location is /nbconvert/html/mynotebook.ipynb?download=true
. At least that's what I get when I use the File -> Download As menu.
Speaking of which, when I do Download As HTML, the inputs aren't hidden.
OK, I'll try the nbconvert command line. Same problem; no hidden inputs. Only if I View -> Cell Toolbar -> Hide Code and then manually check 'Hide Code' for each cell and then save the notebook does it work, and then only on the command line (not the in-viewer export).
Bonus issue: when I try jupyter-nbconvert --to hide_code_latexpdf
, I get ImportError: No module named HideCodeLatexPDFExporter
(which does seem to be nonexistent).
Here's what I'm running.
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
hide-code==0.3.0
ipykernel==4.3.1
ipython==5.0.0
ipython-genutils==0.1.0
ipywidgets==5.2.2
jupyter==1.0.0
jupyter-client==4.3.0
jupyter-console==5.0.0
jupyter-core==4.1.0
nbconvert==4.2.0
nbformat==4.0.1
notebook==4.2.2
widgetsnbextension==1.2.6
Seems like Jupyter is a fast moving target these days. I appreciate you trying to keep up!
This is not an issue but I want to know if we can include the table of content into the pdf conversion.
We have notebooks with TOC which is included in html format and interested to have that in the pdf format as well.
Hello, I cannot understand why it happen, but if I end a cell with a print('hello') for example and then export to html, I get error 500. Log shows:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/tornado/web.py", line 1467, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "/usr/local/lib/python3.6/site-packages/hide_code/hide_code.py", line 25, in get
output_html, resources = exporter.from_notebook_node(nb)
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/html.py", line 69, in from_notebook_node
return super(HTMLExporter, self).from_notebook_node(nb, resources, **kw)
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/templateexporter.py", line 222, in from_notebook_node
output = self.template.render(nb=nb_copy, resources=resources)
File "/usr/local/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/site-packages/hide_code/Templates/hide_code.tpl", line 1, in top-level template code
{%- extends 'full.tpl' -%}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/html/full.tpl", line 2, in top-level template code
{% from 'mathjax.tpl' import mathjax %}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/html/basic.tpl", line 1, in top-level template code
{%- extends 'display_priority.tpl' -%}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/skeleton/display_priority.tpl", line 1, in top-level template code
{%- extends 'null.tpl' -%}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/skeleton/null.tpl", line 26, in top-level template code
{%- block body -%}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/html/full.tpl", line 67, in block "body"
{{ super() }}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/skeleton/null.tpl", line 28, in block "body"
{%- block any_cell scoped -%}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/skeleton/null.tpl", line 30, in block "any_cell"
{%- block codecell scoped -%}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/html/basic.tpl", line 6, in block "codecell"
{{ super() }}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/skeleton/null.tpl", line 36, in block "codecell"
{%- block output_group -%}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/html/basic.tpl", line 19, in block "output_group"
{{ super() }}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/skeleton/null.tpl", line 38, in block "output_group"
{%- block outputs scoped -%}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/skeleton/null.tpl", line 40, in block "outputs"
{%- block output scoped -%}
File "/usr/local/lib/python3.6/site-packages/hide_code/Templates/hide_code.tpl", line 43, in block "output"
{% block execute_result -%} {{ super() }} {%- endblock execute_result %}
File "/usr/local/lib/python3.6/site-packages/hide_code/Templates/hide_code.tpl", line 43, in block "execute_result"
{% block execute_result -%} {{ super() }} {%- endblock execute_result %}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/html/basic.tpl", line 88, in block "execute_result"
{% block data_priority scoped %}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/html/basic.tpl", line 89, in block "data_priority"
{{ super() }}
File "/usr/local/lib/python3.6/site-packages/nbconvert/exporters/../templates/skeleton/display_priority.tpl", line 7, in block "data_priority"
{%- for type in output.data | filter_data_type -%}
File "/usr/local/lib/python3.6/site-packages/nbconvert/filters/datatypefilter.py", line 41, in __call__
mimetypes=output.keys())
jinja2.exceptions.UndefinedError: 'nbformat.notebooknode.NotebookNode object' has no attribute 'data'
it took me a while but at the end I figured it out: try yourself to print in a new notebook. As workaround I'm using display() or HTML() at the moment.
I just installed hide_code with pip3 and ran hide_code.hide_code.install() after creating an empty ~/.jupyter/custom/custom.js. The new </> button works as adversied, and is awesome. The individual cell toolbar option to hide code does nothing. I get a bunch of these errors in the javascript console:
Error in cell toolbar callback hide_code.hideCode TypeError: Cannot read property 'classname' of undefined
at toggleHideCode (http://localhost:8888/custom/hide_code.js:48:31)
at hideCodeGetter (http://localhost:8888/custom/hide_code.js:28:3)
at http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:15212:34
at CellToolbar.rebuild (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:15146:17)
at Function.CellToolbar.rebuild_all (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:15114:39)
at Function.CellToolbar.activate_preset (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:15098:25)
at HTMLSelectElement.<anonymous> (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:27242:45)
at HTMLSelectElement.x.event.dispatch (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:90:10006)
at HTMLSelectElement.y.handle (http://localhost:8888/static/notebook/js/main.min.js?v=40e10638fcf65fc1c057bff31d165e9d:90:6789)
I know nothing about javascript, but I can try going deeper if you need.
jupyter 4.0.6
ipython 4.0.0
Python 3.5.1
When I use the following to convert the notebook to PDF, all the pandas tables are not shown - no matter it's in pandas output directly or to_html or use Latex(df.to_latex()).
jupyter nbconvert --to hide_code_pdf notebook_to_convert.ipynb
Any idea how to fix this?
pip uninstall hide_code
does not uninstall the extension from jupyter
Hello,
I have python 2.7.11-1 on Ubuntu 16.04 and ipython-2.4.1-1 and jupyter (pip-installed).
I changed /home/user/.jupyter/jupyter_notebook_config.py
from:
c.NotebookApp.notebook_dir = u''
to
c.NotebookApp.notebook_dir = u'/home/user/Workspace/Python'
so that it starts in such folder automatically. However this seems to break hidecode. When exporting a notebook (for example, with html), it gives a 500 Internal Server Error in the browser and the following output:
[I 12:47:03.980 NotebookApp] hide_code: Starting HTML export for None
[E 12:47:03.981 NotebookApp] Uncaught exception GET /notebooks/Untitled.ipynb/export/html (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Untitled.ipynb/export/html', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzip, deflate', 'Host': 'localhost:8888', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0', 'Connection': 'keep-alive', 'Referer': 'http://localhost:8888/notebooks/Untitled.ipynb', 'Cookie': '_xsrf=2|4ef5945a|837a269c7a3908ca679866b46ba8453d|1490950765; username-localhost-8888="2|1:0|10:1490957216|23:username-localhost-8888|44:MmI5ODEzMzE0OGY4NDhkM2FlODE0NzRlM2Q3NGZiYjM=|79cb9ba85c1293bd5c057c4d5cc0bc903cf48a495567407a83bd95ec1e8d832a"', 'Upgrade-Insecure-Requests': '1'})
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/tornado/web.py", line 1413, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "/usr/local/lib/python2.7/dist-packages/hide_code/hide_code.py", line 23, in get
with open(ipynb_file_name(args)) as f:
IOError: [Errno 2] No such file or directory: u'Untitled.ipynb'
It seems that hidecode cannot find the notebook file, at the time of execution of /usr/local/lib/python2.7/dist-packages/hide_code/hide_code.py
. The argument args of the get method of HideCodeHTMLExportHandler does not seem to contain the full path to the notebook file, so I think that is the problem (the change applied to jupyter configuration file is not reflected here).
I don't know if this is intended behavior but I thought I would report it anyway, as it is a bit irksome. If there is anyway to fix it or a work around I would like to know.
Thank you. This extension is definitely useful.
I've installed hide_code
as instructed but ever since I am getting
nbconvert failed: '/home/sfalk/workspace/playground/notebook/Untitled.ipynb' exists but is not a directory
I am using Jupyter 4.4.0 and 0.5.0 of hide_code.
After the conda's pip install didn't work (didn't see any changes in the notebook UI):
I tried to the Installation Troubleshooting:
ubuntu@eve:~$ jupyter --config-dir
/home/ubuntu/.jupyter
ubuntu@eve:~$ which ipython
/home/ubuntu/anaconda3/bin/ipython
ubuntu@eve:~$ ipython
Python 3.5.1 |Anaconda 2.4.1 (64-bit)| (default, Dec 7 2015, 11:16:01)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.3 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import hide_code.hide_code as hc
In [2]: dir = "/home/ubuntu/.jupyter"
In [3]: hc.install(dir)
Starting hide_code.js install...
No config directories contain "custom" folder. Trying site-packages...
Using argument supplied path: /home/ubuntu/.jupyter
Copying hide_code.js to /home/ubuntu/.jupyter
Attempting to configure custom.js to auto-load hide__code.js...
Custom.js not in custom directory.
This didn't change anything, I assume from the directory issue above. So I tried installing from source
$ python setup.py install
running install
running build
running build_py
running install_lib
running install_egg_info
running egg_info
writing hide_code.egg-info/PKG-INFO
writing requirements to hide_code.egg-info/requires.txt
writing top-level names to hide_code.egg-info/top_level.txt
writing dependency_links to hide_code.egg-info/dependency_links.txt
reading manifest file 'hide_code.egg-info/SOURCES.txt'
writing manifest file 'hide_code.egg-info/SOURCES.txt'
removing '/home/ubuntu/anaconda3/lib/python3.5/site-packages/hide_code-0.1.4-py3.5.egg-info' (and everything under it)
Copying hide_code.egg-info to /home/ubuntu/anaconda3/lib/python3.5/site-packages/hide_code-0.1.4-py3.5.egg-info
running install_scripts
Running post install task...
Starting hide_code.js install...
No config directories contain "custom" folder. Trying site-packages...
Unable to install into /home/ubuntu/anaconda3/lib/python3./site-packages/notebook/static/custom
Directory doesn't exist.
Make sure Jupyter is installed.
Then I saw it was trying to access a python3.
directory that didn't exist, make a soft link for it pointing to python3.5
, re-ran the install, then it worked in jupyter just fine. Not sure if this is a bug or just an install note. Would've been nice it pip install behaved.
Hi, thanks for the plugin it seems nice but I can't get it working
Doesn't work on mac for me, I don't see any new icon, view menu:
pip install hide_code
run without an issue, is there any other step I need?
The version of the notebook server is 4.1.0-0949a69 and is running on:
Python 2.7.10 (default, Jul 13 2015, 12:18:59)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
Hi,
You have done an amazing job with hide_code. Thanks for that.
I am having 500 error whenever I try to export a notebook via the buttons on the notebook.
I am using nbconvert 4.3.0, python 3.6 and notebook 5.0.
I am able to export using the command below:
jupyter nbconvert --to hide_code_pdf notebook_to_convert.ipynb
It's just that I am unable to use the buttons on the notebook to export as a pdf or html.
I tried restarting and installed hide_code multiple times but I am unable to find a solution.
I tried the command "jupyter nbextension list"
My output is below:
Known nbextensions:
config dir: C:\Users\antho.jupyter\nbconfig
notebook section
nbextensions_configurator/config_menu/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/config_menu/m
contrib_nbextensions_help_item/main enabled
- Validating: ok
hide_input/main disabled
execute_time/ExecuteTime enabled
- Validating: ok
hide_code/hide_code enabled
- Validating: ok
tree section
nbextensions_configurator/tree_tab/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/tree_tab/main
tree-filter/index enabled
- Validating: ok
config dir: C:\ProgramData\Anaconda3\etc\jupyter\nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: ok
nbextensions_configurator/config_menu/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/config_menu/m
contrib_nbextensions_help_item/main enabled
- Validating: ok
tree section
nbextensions_configurator/tree_tab/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/tree_tab/main
config dir: C:\ProgramData\jupyter\nbconfig
notebook section
nbextensions_configurator/config_menu/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/config_menu/m
contrib_nbextensions_help_item/main enabled
- Validating: ok
tree section
nbextensions_configurator/tree_tab/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/tree_tab/main
Kindly guide where I am going wrong.
Thanks alot for your precious time and effort.
Hi,
I have upgraded to hide_code 0.5.
My problem still persists in that I am able to export my notebook to pdf via the terminal.
But, the buttons on the jupyter notebook doesn't seem to work.
I get 404 error now, where previously I used to get 500 Error.
The following is my output:
[W 00:28:37.636 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20171010002821 (::1) 16.01ms referer=http://localhost:8888/notebooks/Desktop/pythonx/notebooks/Python3_OOP.ipynb
[W 00:28:39.427 NotebookApp] 404 GET /notebooks/Desktop/pythonx/notebooks/Python3_OOP.ipynb/export/pdf (::1): No such file or directory: Desktop/pythonx/notebooks/Python3_OOP.ipynb/export/pdf
[W 00:28:39.434 NotebookApp] 404 GET /notebooks/Desktop/pythonx/notebooks/Python3_OOP.ipynb/export/pdf (::1) 8.51ms referer=http://localhost:8888/notebooks/Desktop/pythonx/notebooks/Python3_OOP.ipynb
Kindly advise.
I sue the following code to show images in pdf.
However they just come up as OUT[*] in the pdf following a blank space.
from IPython.display import Image
Image(filename="image.jpg")
I really appreciate if I can get help to fix this.
Also if there is anyway to align the image in centre.
Hello,
It gives me "You are requesting a page that does not exist!" after clicking the exporting icons.
Any suggestions?
Thanks!
Hi,
Thanks for the great plug-in. After I hide the code, the export to pdf still renders code cells. I am using "File" "Download As" "PDF" from the jupyter notebook browser.
Let me know if you have any suggestions. My goal is to render the notebook as a pdf without the code cells. Thanks!
Hi,
I installed jupyter from Anaconda, and installed hide_code from pip.
hide_code isn't showing in jupyer neither in nbextensions or in view -> cell_bar. When i tried to use it from nbconverter i've got import error:
ImportError: No module named 'hide_code.HideCodeLatexPDFExporter'
It would be great to have a Hotkey for code show/hide.
For now, I'm trying to use 'Keyboard shortcut editor' extension to assign a hotkey, yet I can't seem to find the command on the list.
Thanks again for great plugin!
Does this feature work? #36 is closed suggesting that it should be possible to export slides, but I get an error ModuleNotFoundError: No module named 'hide_code.HideCodeSlidesExporter'
when I try to run jupyter nbconvert --to hide_code_slides
OSx 10.10
python35
notebook 4.2.3
ipython 5.1
jupyter 1
Hi,
I tried the troubleshootings you suggested, but still get an 500 : Internal Server Error.
I want to uninstall hide_code, but I get another error message:
Starting hide_code.js removal...
No config directories contain "custom" folder. Trying Jupyter notebook module path...
Attempting to remove auto-loading for hide_code export handlers.
No hide_code server extensions to remove.
And in your wiki you state: hide_code.uninstall_bootrapped_files().
As I see from the attributes its: hide_code.uninstall_bootstrapped_files()
Looking forward to your help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.