There is a nice tutorial on WebGL at this link:
http://learningwebgl.com/blog/?p=571
and I am using this example as my starting point for this question:
http://learningwebgl.com/lessons/lesson06/index.html
So it runs nicely on my browser. I copied the source and required libaries:
- glMatrix.html
- webgl-utils.js
on my pc. Now I can run them again on my browser nicely.
In the source html, these libaries are referred to as external libraries like this:
<script type="text/javascript" src=".\glMatrix.js"></script>
<script type="text/javascript" src=".\webgl-utils.js"></script>
They are located in the same directory as my source html, namely, kvBox.html.
Now I want to run this html within from the notebook cell. I enter:
from IPython.core.display import HTML
def putHTML():
source = open("kvBox.html", "rb").read().decode()
return HTML(source)
putHTML()
Same screen is there, without the box and the canvas. No error messages on the output line on the notebook.
When I look at the Notebook Server console I see these errors:
[I 21:56:51.077 NotebookApp] 302 GET /notebooks/.%5CglMatrix.js?_=1454010913066
(::1) 15.64ms
[I 21:56:51.077 NotebookApp] Refusing to serve hidden file, via 404 Error
[W 21:56:51.077 NotebookApp] 404 GET /files/.%5CglMatrix.js (::1) 0.00ms referer
=http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=python3
[I 21:56:51.093 NotebookApp] 302 GET /notebooks/.%5Cwebgl-utils.js?_=14540109130
67 (::1) 0.00ms
[I 21:56:51.093 NotebookApp] Refusing to serve hidden file, via 404 Error
[W 21:56:51.093 NotebookApp] 404 GET /files/.%5Cwebgl-utils.js (::1) 0.00ms refe
rer=http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=python3
I have googled and looked throgh SO for including external libraries to notebook. Mostly I found noteook extensions given at github. I need a solution for my own additions.
The nearest question was this item:
How to add external javascript file in Ipython notebook
So I tried to use %%html commands for the above mentioned external libraries. No erro on the output line, but same refusal error on the console.
EDIT:
After reading and trying so many different suggestions which have not worked, I had a workaround. I wrote a simple include routine myself. I merge the library code into my source html, in the "source" string above, and everything works fine.