MantisBT - ParaView
View Issue Details
0012725ParaView(No Category)public2011-11-13 13:122012-02-08 17:24
Pat Marion 
Sebastien Jourdain 
normalminorhave not tried
closedfixed 
 
3.14 
TBD
12725-regression-python-module
incorrect functionality
0012725: Regression in paraview.simple python module
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 "<console>", line 1, in <module>
  AttributeError: 'module' object has no attribute 'Sphere'



This is a regression that I tracked to commit 9f1626b. 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 9f1626b 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 a2e764e 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 9f1626b 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.
No tags attached.
patch paraview_simple_fix.patch (1,130) 2011-11-13 13:12
https://www.vtk.org/Bug/file/9070/paraview_simple_fix.patch
Issue History
2011-11-13 13:12Pat MarionNew Issue
2011-11-13 13:12Pat MarionFile Added: paraview_simple_fix.patch
2011-11-13 13:14Pat MarionNote Added: 0027689
2011-11-15 09:42Sebastien JourdainAssigned To => Sebastiennn Jourdain
2011-11-15 09:42Sebastien JourdainStatusbacklog => todo
2011-11-15 09:42Sebastien JourdainStatustodo => active development
2011-11-15 09:56Sebastien JourdainNote Added: 0027691
2011-11-15 11:12Sebastien JourdainStatusactive development => gatekeeper review
2011-11-15 11:12Sebastien JourdainResolutionopen => fixed
2011-11-15 11:13Sebastien JourdainTopic Name => 12725-regression-python-module
2011-11-15 11:31Pat MarionNote Added: 0027692
2011-11-15 12:06Sebastien JourdainNote Added: 0027693
2011-11-18 14:53Utkarsh AyachitFixed in Version => git-master
2011-11-18 14:54Utkarsh AyachitStatusgatekeeper review => customer review
2011-11-18 14:54Utkarsh AyachitNote Added: 0027717
2012-02-08 17:21Utkarsh AyachitFixed in Versiongit-master => 3.14
2012-02-08 17:24Utkarsh AyachitStatuscustomer review => closed
2012-02-08 17:24Utkarsh AyachitNote Added: 0028114

Notes
(0027689)
Pat Marion   
2011-11-13 13:14   
Utkarsh, could you take a look at this bug sometime? Maybe you could ask Sebastien why he did what he did :)
(0027691)
Sebastien Jourdain   
2011-11-15 09:56   
The reason why I did those changes, it is because the _add_function needed to happen after Connect and not at the import time as the Proxy definition come from the server now which was not the case previously. So your patch seems reasonable in the sense that with the GUI, we are already connected...
(0027692)
Pat Marion   
2011-11-15 11:31   
So what happens when the GUI disconnects from the builtin server and connects to a new remote server? Is it possible that the remote server has additional proxy definitions that will not make it into paraview.simple? What if the remote server has fewer proxy definitions? Is the only way to change the number of proxy definitions when there is a plugin loaded?
(0027693)
Sebastien Jourdain   
2011-11-15 12:06   
When you connect or disconnect from a server and you have a python shell open, that shell get totally reinitialized, therefore the simple get the proper latest proxy definitions. The only runtime update available so far was with plugin loading.

Although, I'm working in bringing support for multi-server connection, which exactly means that based on which server is active, the proxy definition available inside simple could be different. For that, I had to add a _remove_function method add clean up some of the previous code. That code already works great inside pvpython but I need to properly integrate it when python is used inside ParaView.
(0027717)
Utkarsh Ayachit   
2011-11-18 14:54   
merged to master.
(0028114)
Utkarsh Ayachit   
2012-02-08 17:24   
Closing bugs sitting in "customer review" for a long time.