Before compiling paraview on windows, you might try this-<br><br>You can prevent processEvents from being called by taking the python console widget out of the loop. Paraview sets sys.stdout and sys.stderr to a helper object that directs the output to the widget (where processEvents is called):<br>
<br>
<style type="text/css">p, li { white-space: pre-wrap; }</style>
<style type="text/css">p, li { white-space: pre-wrap; }</style>
<p style="margin: 0px; text-indent: 0px;"><span style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">>>> import sys</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 0, 0);">>>> sys.stdout.__class__</span></p>
<p style="margin: 0px; text-indent: 0px;"><span style="font-family: 'Courier'; font-size: 9pt; color: rgb(0, 150, 0);"><type 'vtkPVPythonInterpretorWrapper'></span></p><br>So you can reroute output to disk:<br>
<br>sys.stdout = open("stdout.txt", "w")<br>sys.stderr = open("stderr.txt", "w")<br><br>Now you won't see any output in the paraview gui, it will be written to those files instead. The output isn't flushed on every write, so you might not see anything in the files until you quit paraview. You could define your own stdout object that calls write on a file followed by flush.<br>
<br>Pat<br><br><div class="gmail_quote">On Sun, Oct 17, 2010 at 3:35 PM, <span dir="ltr"><<a href="mailto:m.c.wilkins@massey.ac.nz">m.c.wilkins@massey.ac.nz</a>></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;">
<br>
Hi,<br>
<div class="im"><br>
> Are you working from a paraview installer, or compiling paraview yourself? I<br>
<br>
</div>downloaded stock standard 3.8.1 for Windows.<br>
<div class="im"><br>
> was able to reproduce the linux bug (by putting a 'print "hello"' at the end)<br>
> and then solve it by commenting out two lines in ParaView/Qt/Python/<br>
> pqPythonShell.cxx. Just search for the lines with "processEvents" and comment<br>
> them out and then recompile.<br>
<br>
</div>thanks. Windows is not my platform of choice, i've never successfully<br>
compiled up paraview with visual studio before. anyway now I have a<br>
lot more motivation, and i do have the Paraview Guide with<br>
instructions, so I will give it a go.<br>
<div class="im"><br>
> I'll try to explain it why this fixes the problem-<br>
><br>
> Before paraview executes the python script it acquires a lock. The lock is<br>
> part of the python C api to help make things thread safe ( http://<br>
> <a href="http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock" target="_blank">docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock</a> ).<br>
> Paraview doesn't use threads, but it uses multiple python interpreters, and<br>
> each interpreter has its own "thread state". So before any code is executed by<br>
> the paraview python shell, the shell acquires the lock to activate its<br>
> interpreter.<br>
><br>
> Next, the python script hits a print statement which sends an output string to<br>
> the paraview python shell. The shell calls processEvents so that the widget<br>
> has an opportunity to repaint itself (make the text appear on your screen)<br>
> without having to wait for the entire python script to complete execution. The<br>
> problem is that during processEvents, the events generated by calling show on a<br>
> PyQt widget are also processed. While processing these events, PyQt tries to<br>
> acquire the lock itself, fails, and then waits- paraview hangs because this all<br>
> happens in the same thread. The fix is either to comment out the processEvents<br>
> call in pqPythonShell.cxx, or release the lock before calling processEvents and<br>
> then reacquire it afterward.<br>
<br>
</div>Thanks Pat. I think I follow. Although I'm not sure what affect not<br>
calling processEvents will have on my widget. Will it never have a<br>
chance to update?<br>
<div class="im"><br>
> I have never tested PyQt+Paraview on Windows, there may be further bugs. Also,<br>
> there could be other scenarios where the paraview python shell and PyQt fight<br>
> over the lock.<br>
<br>
</div>Ok, thanks.<br>
<div class="im"><br>
> Hope this helps a bit!<br>
<br>
</div>Indeed it does, it is nice to know I'm not trying to figure this out<br>
all by myself.<br>
<br>
Matt<br>
<br>
</blockquote></div><br>