Open bassio opened 6 years ago
Testing this on a clean virtualenv
Successfully installed MarkupSafe-1.0 Send2Trash-1.5.0 bleach-2.1.2 decorator-4.2.1 entrypoints-0.2.3 html5lib-1.0.1 ipykernel-4.8.2 ipython-6.2.1 ipython-genutils-0.2.0 ipywidgets-7.1.2 jedi-0.11.1 jinja2-2.10 jsonschema-2.6.0 jupyter-1.0.0 jupyter-client-5.2.2 jupyter-console-5.2.0 jupyter-core-4.4.0 mistune-0.8.3 nbconvert-5.3.1 nbformat-4.4.0 notebook-5.4.0 pandocfilters-1.4.2 parso-0.1.1 pexpect-4.4.0 pickleshare-0.7.4 prompt-toolkit-1.0.15 ptyprocess-0.5.2 pygments-2.2.0 python-dateutil-2.6.1 pyzmq-17.0.0 qtconsole-4.3.1 simplegeneric-0.8.1 six-1.11.0 terminado-0.8.1 testpath-0.3.1 tornado-4.5.3 traitlets-4.3.2 wcwidth-0.1.7 webencodings-0.5.1 widgetsnbextension-3.1.4
Maybe you want this:
from IPython.display import IFrame
IFrame(local_html_file, width=400, height=300)
@takluyver for some reason this does not work for me (the html file displays, but if there are images or javascript embedded then they are broken)
Can you put a minimal example of that problem somewhere we can investigate? (Using the IFrame, I mean - I don't expect it to work with HTML()
).
Helllo @takluyver , nevermind I found my bug.
@bassio maybe this helps ?
I had the same problem see example below
in the notebook
path = ./precomp/
raw_html = """
<table border=1>
<tr>
<th>Number</th>
<th>Square</th>
</tr>
<indent>
<% for i in range(10): %>
<tr>
<td><%= i %></td>
<td><%= i**2 %></td>
</tr>
</indent>
</table>
"""
with open(path + "precomputed.html","w") as fp:
fp.write(raw_html)
from IPython.display import IFrame
IFrame(path+"precomputed.html", width=500, height=1000)
in bash
nbconvert --to html my_notebook.ipynb
--> HTML shows perfectly on the machine were the html was created and on any other machine as well :)
Best, Ivo
Hello,
Say I want to display a local HTML file (e.g. "/tmp/data/overview.html") which itself includes tags pointing to image files in same or child folder.
This file for example contains this
<img src="demultiplex-summary.png">
Observed behaviour: This does not resolve correctly, as it resolves it relative to the working directory of the current notebook server.
[W 16:36:03.125 NotebookApp] 404 GET /notebooks/testing/demultiplex-summary.png (127.0.0.1): No such file or directory: testing/demultiplex-summary.png
Expected behaviour: It should resolve to the file relative to the html file loaded, with the image (or other iframe or video or css etc) loading/displaying correctly.