jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
942 stars 188 forks source link

`Error displaying widget` for ImageTexture in Textures example with JupyterLab #165

Closed elPistolero closed 6 years ago

elPistolero commented 6 years ago

The two ImageTexture objects checker_tex and earth_tex cannot be rendered with jupyterlab. data_tex can be rendered correctly.

With a jupyter notebook everything works as expected.

The console gives the following output:

future.js:155 Uncaught (in promise) Error: Canceled
    at t.dispose (future.js:155)
    at default.js:385
    at Map.forEach (<anonymous>)
    at e.dispose (default.js:384)
    at e.dispose (default.js:244)
    at index.js:241
    at <anonymous>
checkerboard.png Failed to load resource: the server responded with a status of 404 (Not Found)
ImageTexture.js:22 Error loading texture: img/checkerboard.png
bluebird.js:1545 Warning: a promise was rejected with a non-error: [object Event]
    at U (http://localhost:8889/lab/static/main.75a01e1….js:1:109001)
    at A.t._warn (http://localhost:8889/lab/static/main.75a01e1….js:1:103042)
    at A._rejectCallback (http://localhost:8889/lab/static/main.75a01e1….js:1:144410)
    at http://localhost:8889/lab/static/main.75a01e1….js:1:144677
    at http://localhost:8889/lab/static/main.75a01e1….js:1:2017011
    at HTMLImageElement.<anonymous> (http://localhost:8889/lab/static/main.75a01e1….js:1:1368742)
From previous event:
    at A.R [as _captureStackTrace] (http://localhost:8889/lab/static/main.75a01e1….js:1:107952)
    at A._resolveFromExecutor (http://localhost:8889/lab/static/main.75a01e1….js:1:144554)
    at new A (http://localhost:8889/lab/static/main.75a01e1….js:1:137678)
    at i.constructThreeObjectAsync (http://localhost:8889/lab/static/main.75a01e1….js:1:2016837)
    at i.createThreeObjectAsync (http://localhost:8889/lab/static/main.75a01e1….js:1:949721)
    at initialize (http://localhost:8889/lab/static/main.75a01e1….js:1:947950)
    at i.t.Model (http://localhost:8889/lab/static/main.75a01e1….js:1:1900366)
    at i.t [as constructor] (http://localhost:8889/lab/static/main.75a01e1….js:1:2212313)
    at i [as constructor] (http://localhost:8889/lab/static/main.75a01e1….js:1:1918529)
    at i [as constructor] (http://localhost:8889/lab/static/main.75a01e1….js:1:1918529)
    at i [as constructor] (http://localhost:8889/lab/static/main.75a01e1….js:1:1918529)
    at new i (http://localhost:8889/lab/static/main.75a01e1….js:1:1918529)
    at t.<anonymous> (http://localhost:8889/lab/static/main.75a01e1….js:1:2491868)
    at l (http://localhost:8889/lab/static/main.75a01e1….js:1:2487926)
    at Object.next (http://localhost:8889/lab/static/main.75a01e1….js:1:2487257)
    at a (http://localhost:8889/lab/static/main.75a01e1….js:1:2486784)
    at <anonymous>
vidartf commented 6 years ago

Thanks for the report. I'm looking into it, but got side tracked by something else. Which version of jupyterlab and which version of pythreejs are you using?

elPistolero commented 6 years ago

I'm using jupyterlab version 0.31.8 and pythreejs version 1.0.0b6.

I also tried using absolute paths for the png files but that didn't fix the issue.

vidartf commented 6 years ago

Good find! I need to make it a routine to also check all the examples in lab. This best solution to this follows https://github.com/jupyter-widgets/ipywidgets/pull/1993.

elPistolero commented 6 years ago

Interesting. Do you know why absolute paths don't work? Or are relative paths always assumed?

vidartf commented 6 years ago

Do you know why absolute paths don't work?

The texture is supposed to be a URL, so you might have success with an absolute URL.

elPistolero commented 6 years ago

The problem with not displaying absolute URLs seems to be a browser security related issue.

vidartf commented 6 years ago

This is now fixed in master, and will be available with the next release (requires latest version of ipywidgets lab extension).