Regression in paraview.simple python module
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
The CreateObject functions are not correctly added to paraview.simple
In paraview 3.10:
paraview.simple.Sphere <function CreateObject at 0x128bcade8>
In parview 3.12:
paraview.simple.Sphere Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'Sphere'
This is a regression that I tracked to commit 9f1626ba. The commit message says:
"Also fixed servermanager.py to create module functions only after a server connection was made."
Previously, this statement was executed by simple.py when it was imported:
_add_functions(globals())
But commit 9f1626ba moves that statement into the Connect() function, which is never called by the GUI, it is only called by pvpython. A 'hack' was added in commit a2e764e0 which adds c++ code to explicitly execute the statement after paraview.simple is imported, but this is wrong, because the globals() passed to _add_functions() is the globals of the main context, not the globals of paraview.simple.
Attached is a patch that fixes the issue, but I don't clearly understand why commit 9f1626ba needed to make the change that it did in the first place. It seems that my attached patch is roughly equivalent to reverting the change.