Why not something like-<br><br><br>import subprocess<br><br>for f in filenames:<br>  subprocess.call([&quot;/path/to/pvpython&quot;, &quot;process_single_dataset.py&quot;, f])<br><br><br>Pat<br><br><div class="gmail_quote">
On Wed, Sep 15, 2010 at 5:35 PM, Milos Ilak <span dir="ltr">&lt;<a href="mailto:ilak@mech.kth.se">ilak@mech.kth.se</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br><br>I have a related question. I would like to use the Python interface to create movies of large datasets from .png files. Having the .pngs gives me flexibility in encoding them. I know that ParaView can export animations as .pngs files, but I would like to do this in offscreen mode and without running the animation in ParaView first.<br>

<br>I haven&#39;t been able to figure out how to run a single instance of ParaView during every iteration of a loop over file names (or, say, camera angles) within a Python script, i.e. open ParaView, work on one file, output a .png, and then close ParaView. <br>

<br>The fix below with clearing the pipeline each time seems to work, but I was wondering if it would be possible to invoke ParaView &#39;from scratch&#39; during each call and how. Also, would there be any disadvantages to doing that, as opposed to having a single instance of ParaView during the entire loop and clearing the pipeline as below?<br>

<br>I apologize if this has been discussed, but I haven&#39;t been able to find any of those discussions if so. <br><br>Milos<div><div></div><div class="h5"><br><br><br><br><br><br><div class="gmail_quote">On Wed, Sep 15, 2010 at 10:12 PM, logari81 <span dir="ltr">&lt;<a href="mailto:logari81@googlemail.com" target="_blank">logari81@googlemail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Thank you for the quick response. You are right, what I actually need is<br>
to clear the pipeline. Your snippet seems to work well except some<br>
naming counters which are not reset but in my use case this isn&#39;t very<br>
important.<br>
<br>
Thanks a lot for your help.<br>
<br>
Best Regards<br>
<br>
Kostas<br>
<div><div></div><div><br>
On Wed, 2010-09-15 at 15:49 -0400, pat marion wrote:<br>
&gt; If your intention is to just clear the pipeline, try this code, copied<br>
&gt; from the paraview coprocessor template:<br>
&gt;<br>
&gt; def GetProxiesToDelete():<br>
&gt;     iter = servermanager.vtkSMProxyIterator()<br>
&gt;     iter.Begin()<br>
&gt;     tobedeleted = []<br>
&gt;     while not iter.IsAtEnd():<br>
&gt;       if iter.GetGroup().find(&quot;prototypes&quot;) != -1:<br>
&gt;          iter.Next()<br>
&gt;          continue<br>
&gt;       proxy = servermanager._getPyProxy(iter.GetProxy())<br>
&gt;       proxygroup = iter.GetGroup()<br>
&gt;       iter.Next()<br>
&gt;       if proxygroup != &#39;timekeeper&#39; and proxy != None and<br>
&gt; proxygroup.find(&quot;pq_helper_proxies&quot;) == -1 :<br>
&gt;           tobedeleted.append(proxy)<br>
&gt;<br>
&gt;     return tobedeleted<br>
&gt;<br>
&gt; # explicitly delete the proxies -- we do it this way to avoid problems<br>
&gt; with prototypes<br>
&gt; tobedeleted = GetProxiesToDelete()<br>
&gt; while len(tobedeleted) &gt; 0:<br>
&gt;    Delete(tobedeleted[0])<br>
&gt;    tobedeleted = GetProxiesToDelete()<br>
&gt;<br>
&gt;<br>
&gt; On Wed, Sep 15, 2010 at 3:21 PM, pat marion &lt;<a href="mailto:pat.marion@kitware.com" target="_blank">pat.marion@kitware.com</a>&gt;<br>
&gt; wrote:<br>
&gt;         I&#39;m afraid your use case is not well supported.  There is<br>
&gt;         logic in the paraview gui application that ensures a clean<br>
&gt;         disconnect, which includes a hard reset of the python<br>
&gt;         interpreter context.  Using only python modules, there is<br>
&gt;         manual clean up required after a disconnect that is not yet<br>
&gt;         supported.<br>
&gt;<br>
&gt;         You might find that your script still works, you&#39;ll just be be<br>
&gt;         spammed with those error messages.  Also, try calling<br>
&gt;         Connect() instead of servermanager.Disconnect(...).  This will<br>
&gt;         disconnect &amp; reconnect a little more cleanly, but still not<br>
&gt;         perfect.<br>
&gt;<br>
&gt;         Pat<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;         On Wed, Sep 15, 2010 at 2:52 PM, logari81<br>
&gt;         &lt;<a href="mailto:logari81@googlemail.com" target="_blank">logari81@googlemail.com</a>&gt; wrote:<br>
&gt;                 In the meanwhile I have realized that the error occurs<br>
&gt;                 only when I<br>
&gt;                 include a Delete() statement in my script. Thus the<br>
&gt;                 following very<br>
&gt;                 simple script reproduces the error:<br>
&gt;<br>
&gt;                 import sys<br>
&gt;                 sys.path.append(&#39;/usr/lib/paraview&#39;)<br>
&gt;                 from paraview.simple import *<br>
&gt;                 cone = Cone()<br>
&gt;                 Delete(cone)<br>
&gt;                 servermanager.Disconnect(servermanager.ActiveConnection)<br>
&gt;<br>
&gt;                 Hopefully someone can explain this behavior.<br>
&gt;<br>
&gt;                 Best Regards<br>
&gt;<br>
&gt;                 Kostas<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;                 On Wed, 2010-09-15 at 18:59 +0200, logari81 wrote:<br>
&gt;                 &gt; Hi,<br>
&gt;                 &gt;<br>
&gt;                 &gt; actually I have the same question as in this<br>
&gt;                 previous email:<br>
&gt;                 &gt;<br>
&gt;                 &gt;<br>
&gt;                 <a href="http://www.paraview.org/pipermail/paraview/2008-March/007506.html" target="_blank">http://www.paraview.org/pipermail/paraview/2008-March/007506.html</a><br>
&gt;                 &gt;<br>
&gt;                 &gt; I use the python interface in an application that I<br>
&gt;                 am developing and I<br>
&gt;                 &gt; import paraview with:<br>
&gt;                 &gt;<br>
&gt;                 &gt; from paraview.simple import *<br>
&gt;                 &gt;<br>
&gt;                 &gt; During the import a connection to the builtin server<br>
&gt;                 is also established<br>
&gt;                 &gt; silently. Though, in my application I need to clear<br>
&gt;                 the pipeline<br>
&gt;                 &gt; occasionally in order to begin with a new output, so<br>
&gt;                 I tried<br>
&gt;                 &gt; disconnecting from the server with:<br>
&gt;                 &gt;<br>
&gt;                 &gt;<br>
&gt;                 servermanager.Disconnect(servermanager.ActiveConnection)<br>
&gt;                 &gt;<br>
&gt;                 &gt; but I receive the error:<br>
&gt;                 &gt;<br>
&gt;                 &gt; ERROR:<br>
&gt;                 &gt;<br>
&gt;                 In /build/buildd/paraview-3.8.0/Servers/Common/vtkProcessModuleConnectionManager.cxx, line 175<br>
&gt;                 &gt; vtkProcessModuleConnectionManager (0x1d33240):<br>
&gt;                 Invalid connection ID: 5<br>
&gt;                 &gt;<br>
&gt;                 &gt; This behavior is tested with ParaView 3.8.0 on<br>
&gt;                 Ubuntu 10.04.<br>
&gt;                 &gt;<br>
&gt;                 &gt; I would be glad for any hints.<br>
&gt;                 &gt;<br>
&gt;                 &gt; Kind Regards<br>
&gt;                 &gt;<br>
&gt;                 &gt; Kostas<br>
&gt;                 &gt;<br>
&gt;<br>
&gt;<br>
&gt;                 _______________________________________________<br>
&gt;                 Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt;                 Visit other Kitware open-source projects at<br>
&gt;                 <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt;                 Please keep messages on-topic and check the ParaView<br>
&gt;                 Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
&gt;<br>
&gt;                 Follow this link to subscribe/unsubscribe:<br>
&gt;                 <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br><font color="#888888"><div>
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div>

<div><span>Miloš Ilak</span></div><div>Linné Flow Centre</div><div>KTH 
Mechanics, Stockholm </div><div>+46(0) 8 790-7152</div><div><a href="http://www2.mech.kth.se/%7Eilak/" target="_blank">www2.mech.kth.se/~<span>ilak</span></a><br><br></div></div></span></span>
</div></font><br>
</font></blockquote></div><br>