Skip to content

Make the "Reset" button actually reset the python env

Ghost User requested to merge (removed):reset-globals-python into master

Requires vtk/vtk!8119 (closed)

Issue

The Reset button that sits next to the Python shell currently does nothing to the Python environment. The code for it is over here. It calls vtkPythonInterpreter::Initialize(), runs the preamble (from paraview.simple import *... this has no effect since it's already imported) and prints a bunch of strings. If you have a look at the content of vtkPythonInterpreter::Initialize() (here) it also appears that it does nothing to an interpreter that is already initialized (the case here).

This is annoying and very confusing as it displays the shell header "Python 3.9.1 GCC..." to make it seem like it got reset when it actually didnt.

This PR

  • displays a warning when clicking Reset to address concerns by @utkarsh.ayachit that this behavior would not be understood.
  • calls Finalize() when clicking Reset. You need vtk/vtk!8119 (closed) for VTK to properly reset

I tested this change (Ubuntu) and it seems to work just fine. Feel free to tell me if there's something obvious I missed that makes this not viable.

(Original issue: https://discourse.paraview.org/t/paraviews-python-reset-button-doesnt-actually-reset/7432/6)

Edited by Ghost User

Merge request reports