[Paraview] Problem with disconnecting from the builtin server in pvpython

pat marion pat.marion at kitware.com
Wed Sep 15 15:49:19 EDT 2010


If your intention is to just clear the pipeline, try this code, copied from
the paraview coprocessor template:

def GetProxiesToDelete():
    iter = servermanager.vtkSMProxyIterator()
    iter.Begin()
    tobedeleted = []
    while not iter.IsAtEnd():
      if iter.GetGroup().find("prototypes") != -1:
         iter.Next()
         continue
      proxy = servermanager._getPyProxy(iter.GetProxy())
      proxygroup = iter.GetGroup()
      iter.Next()
      if proxygroup != 'timekeeper' and proxy != None and
proxygroup.find("pq_helper_proxies") == -1 :
          tobedeleted.append(proxy)

    return tobedeleted

# explicitly delete the proxies -- we do it this way to avoid problems with
prototypes
tobedeleted = GetProxiesToDelete()
while len(tobedeleted) > 0:
   Delete(tobedeleted[0])
   tobedeleted = GetProxiesToDelete()


On Wed, Sep 15, 2010 at 3:21 PM, pat marion <pat.marion at kitware.com> wrote:

> I'm afraid your use case is not well supported.  There is logic in the
> paraview gui application that ensures a clean disconnect, which includes a
> hard reset of the python interpreter context.  Using only python modules,
> there is manual clean up required after a disconnect that is not yet
> supported.
>
> You might find that your script still works, you'll just be be spammed with
> those error messages.  Also, try calling Connect() instead of
> servermanager.Disconnect(...).  This will disconnect & reconnect a little
> more cleanly, but still not perfect.
>
> Pat
>
>
>
> On Wed, Sep 15, 2010 at 2:52 PM, logari81 <logari81 at googlemail.com> wrote:
>
>> In the meanwhile I have realized that the error occurs only when I
>> include a Delete() statement in my script. Thus the following very
>> simple script reproduces the error:
>>
>> import sys
>> sys.path.append('/usr/lib/paraview')
>> from paraview.simple import *
>> cone = Cone()
>> Delete(cone)
>> servermanager.Disconnect(servermanager.ActiveConnection)
>>
>> Hopefully someone can explain this behavior.
>>
>> Best Regards
>>
>> Kostas
>>
>>
>> On Wed, 2010-09-15 at 18:59 +0200, logari81 wrote:
>> > Hi,
>> >
>> > actually I have the same question as in this previous email:
>> >
>> > http://www.paraview.org/pipermail/paraview/2008-March/007506.html
>> >
>> > I use the python interface in an application that I am developing and I
>> > import paraview with:
>> >
>> > from paraview.simple import *
>> >
>> > During the import a connection to the builtin server is also established
>> > silently. Though, in my application I need to clear the pipeline
>> > occasionally in order to begin with a new output, so I tried
>> > disconnecting from the server with:
>> >
>> > servermanager.Disconnect(servermanager.ActiveConnection)
>> >
>> > but I receive the error:
>> >
>> > ERROR:
>> > In
>> /build/buildd/paraview-3.8.0/Servers/Common/vtkProcessModuleConnectionManager.cxx,
>> line 175
>> > vtkProcessModuleConnectionManager (0x1d33240): Invalid connection ID: 5
>> >
>> > This behavior is tested with ParaView 3.8.0 on Ubuntu 10.04.
>> >
>> > I would be glad for any hints.
>> >
>> > Kind Regards
>> >
>> > Kostas
>> >
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100915/eb4d08d5/attachment-0001.htm>


More information about the ParaView mailing list