[vtkusers] python vtk BadRequest

David Gobbi david.gobbi at gmail.com
Tue Jul 19 12:46:33 EDT 2011


Hi Eleftherios,

You are re-using the vtkRenderer but constantly re-creating
the vtkRenderWindow and the interactor?  You should call
window.RemoveRenderer(ren) to disconnect the window from
the renderer once you are finished with the window.  I suspect
that, because you are not doing this, you are ending up with a
whole bunch of render windows that are closed but not destroyed,
because they are still associated with the renderer.

 - David


On Tue, Jul 19, 2011 at 10:21 AM, Eleftherios Garyfallidis
<garyfallidis at gmail.com> wrote:
> Dear vtk users,
>
> I am getting the following error for some time using python-vtk with
> libvtk5.4 in ubuntu 10.10
>
> X Error of failed request: BadRequest (invalid request code or no such
> operation)
> Major opcode of failed request: 0 ()
> Serial number of failed request: 30
> Current serial number in output stream: 32
>
> This crashing error comes randomly usually after I have executed the
> following function for a few times.
>
> def show(ren,title='dipy.viz.fvtk',size=(300,300),png_magnify=1):
>     ''' Show window
>     '''
>
>     ren.ResetCamera()
>     window = vtk.vtkRenderWindow()
>     window.AddRenderer(ren)
>     window.SetWindowName(title)
>     window.SetSize(size[0],size[1])
>     style=vtk.vtkInteractorStyleTrackballCamera()
>     iren = vtk.vtkRenderWindowInteractor()
>     iren.SetRenderWindow(window)
>     iren.SetPicker(picker)
>
>     def key_press(obj,event):
>
>         key = obj.GetKeySym()
>         if key=='s' or key=='S':
>             print('Saving image...')
>             renderLarge = vtk.vtkRenderLargeImage()
>             renderLarge.SetInput(ren)
>             renderLarge.SetMagnification(png_magnify)
>             renderLarge.Update()
>             writer = vtk.vtkPNGWriter()
>             writer.SetInputConnection(renderLarge.GetOutputPort())
>             writer.SetFileName('fvtk.png')
>             writer.Write()
>             print('Look for fvtk.png in your current working directory.')
>
>
>     iren.AddObserver('KeyPressEvent',key_press)
>     iren.SetInteractorStyle(style)
>     iren.Initialize()
>     picker.Pick(85, 126, 0, ren)
>     window.Render()
>     iren.Start()
>
> I would appreciate very much any help on that issue. Please let me know if
> you have any ideas.
>
> Best wishes,
> Eleftherios



More information about the vtkusers mailing list