enthought/mayavi

cannot run example with x3d backend

Opened this issue · 0 comments

beew commented

Hi, I am trying to run the example notebook https://github.com/enthought/mayavi/blob/master/examples/mayavi/mayavi_jupyter.ipynb

But running the cells

mlab.init_notebook(backend='x3d', local=True) 
mlab.figure()

Note the use of the figure here to create a new visualization.
s = mlab.test_points3d()
s

produces an error

ttributeError                            Traceback (most recent call last)
File ~/lib/python3.10/site-packages/IPython/core/formatters.py:922, in IPythonDisplayFormatter.__call__(self, obj)
    920 method = get_real_method(obj, self.print_method)
    921 if method is not None:
--> 922     method()
    923     return True

File ~/lib/python3.10/site-packages/mayavi/tools/notebook.py:31, in _ipython_display_(self)
     22 def _ipython_display_(self):
     23     '''Method attached to Mayavi objects.
     24 
     25     Note that here `self` is the Mayavi object that is going to be
   (...)
     29 
     30     '''
---> 31     return _backend.display(self)

File ~/lib/python3.10/site-packages/mayavi/tools/notebook.py:208, in X3DBackend.display(self, obj)
    205 elif hasattr(obj, 'scene'):
    206     scene = obj.scene
--> 208 return idisplay(HTML(self.scene_to_x3d(scene)))

File ~/lib/python3.10/site-packages/mayavi/tools/notebook.py:228, in X3DBackend.scene_to_x3d(self, scene)
    226 def scene_to_x3d(self, scene):
    227     ex = tvtk.X3DExporter()
--> 228     ex.input = scene.render_window
    229     lm = scene.light_manager.light_mode
    230     # The default raymond mode is too bright so switch back to vtk mode.

AttributeError: 'NoneType' object has no attribute 'render_window'

<mayavi.modules.glyph.Glyph at 0x725f0e0ea250>

OS Ubuntu 22.04
Python3.10.9
Mayavi 4.8.2
vtk9.3.1