[x3d-public] Repairing this Jupyter Notebook is a pain!

Vincent Marchetti vmarchetti at kshell.com
Mon Jun 19 06:21:52 PDT 2023


John

Your statement that "Sometimes the packages fail to import" along with the tbe console report "Control comm did not respond in time" make me think this is a problem of a slow server, or slow netrwork, which
is running up against a timeout limit. I don't think it's an intrinsic failure of Mojo. On the other hand, I don't know a workaround, sounds like the Mojo playground needs more capacity.

Vince


> On Jun 19, 2023, at 8:20 AM, John Carlson <yottzumm at gmail.com> wrote:
> 
> Vincent, I am trying to duplicate this with Mojo Python in Mojo Playground JupyterHub.  Sometimes the packages fail to import.  Here's my python code:
> 
> 
> from IPython import display, HTML
> import x3d
> from x3d import X3D
> from x3d import metaDiagnostics
> 
> # snip, add newModel to context instead of this comment.
> 
> str = newModel.Scene.HTML5()
> 
> x3dnode = """
> <script type='text/javascript' charset="UTF-8" src='https://x3dom.org/release/x3dom-full.debug.js'> </script> 
> <link rel='stylesheet' type='text/css' href='https://x3dom.org/release/x3dom.css'></link> 
> <style>
>  x3d {
>      width:720px;
>      height:720px;
>      border:2px solid black;
> }
> </style><x3d>"""+str+"""
> </x3d>
> <script>
> window.x3dom.reload()
> </script>"""
> 
> HTML(x3dnode)
> 
> 
> # not sure what I'm doing wrong???
> 
> Could this console problem mean something?
> 
> Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason: Control comm did not respond in time
> _loadFromKernel @ 150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1
> 
> Search for Mojo Playground in google, if you are already enrolled.
> 
> Thanks!
> 
> John
> 
> 
> 
> On Wed, Dec 21, 2022 at 3:16 PM Vincent Marchetti <vmarchetti at kshell.com> wrote:
> A problem with the Jupyter notebook attached in this email was that the entire XML document, including the <xml...> declaration, was inserted into the <x3d> node for X3DOM to interpret, and that failed.
> 
> There seem to be as many ways of inserting an <x3d> node for X3DOM into an notebook as there are authors, but the method I use is illustrated at
> 
> https://github.com/vincentmarchetti/web3d2021_jupyter_tutorial/blob/main/HelloWorld.ipynb 
> 
> which is an attempt at illustrating the intent of John's notebook, to prepare the HelloWorld scene using the X3D python module, and then to render it in the notebook.
> 
> I did note two problems in fully rendering the HelloWorld scene, pertaining to loading the image texture from the web3d.org site
> 1. X3DOM only tries the first URL in the ImageTexture url field
> 2. Even if the web3d.org url is put first, the web3d.org server is not configured to support the strict CORS protocol. As a result, the Firefox brower will retrieve the the image from web3d.org, but will not allow the x3dom code to see that data.
> 
> The notebook referenced above from github will render the earth as a sphere and show the text in the X3D scene.
> 
> Vince Marchetti
> 
> 
> 
> 
> 
> > On Dec 21, 2022, at 5:08 AM, John Carlson <yottzumm at gmail.com> wrote:
> > 
> > 
> > <HelloWorld.ipynb>_______________________________________________
> > x3d-public mailing list
> > x3d-public at web3d.org
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> 




More information about the x3d-public mailing list