Disable or Catch VTK warnings in vtkOutputWindow when embedding Mayavi

I don't know whether this will work in the Mayavi environment, but this works for Python wrappings to VTK

# pipe vtk output errors to file
errOut = vtk.vtkFileOutputWindow()
errOut.SetFileName("VTK Error Out.txt")
vtkStdErrOut = vtk.vtkOutputWindow()
vtkStdErrOut.SetInstance(errOut)

I guess this partially answer your question, but you could implement an error observer in python as explained here http://public.kitware.com/pipermail/vtkusers/2012-June/074703.html and add it to the vtk class you are interested.

In c++ I find much simpler to redirect the output to stderr (this example is for windows):

vtkSmartPointer<vtkWin32OutputWindow> myOutputWindow = vtkSmartPointer<vtkWin32OutputWindow>::New(); 
myOutputWindow->SetSendToStdErr(true);
vtkOutputWindow::SetInstance(myOutputWindow);

In python I tried

ow = vtk.vtkOutputWindow()
ow.SendToStdErrOn()

it sends the error to console, but I still see the vtk window and it doesn't really seem catching the errors.

Another option could be to recompile vtk with VTK_USE_DISPLAY turned off ( http://osdir.com/ml/python-enthought-devel/2009-11/msg00164.html). I am not going to try this because I am using the vtk distribution already compiled in paraview