<div dir="ltr">Yep you're right!<div>In fact I now remember that I came across this problem developing on Python 2.6 for an embedded pc that only had Python 2.3. It was very frustrating.</div><div><br></div><div>So if we are writing Python code for VTK what version should we use? </div>
<div>I am currently using 2.7 and am pretty sure everything works in 2.6. But I can't guarantee things will work in 2.5.</div><div><br></div><div>Regards</div><div>   Andrew</div><div> </div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sun, Feb 16, 2014 at 3:22 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">On Fri, Feb 14, 2014 at 11:27 PM, Andrew Maclean<br>
<<a href="mailto:andrew.amaclean@gmail.com">andrew.amaclean@gmail.com</a>> wrote:<br>
><br>
> From what I can see of newer Pythons the interpreter will not even look at<br>
> the else section of the above code.<br>
<br>
</div>I'm going to nitpick here, because your statement here is not accurate.<br>
Python looks at all of the code, in fact it has to in order to byte-compile the<br>
code.  Take this code for instance:<br>
<br>
import sys<br>
if sys.hexversion >= 0x2060000:<br>
    with open("test.txt") as f:<br>
        print f.read()<br>
else:<br>
    print "unsupported keyword 'with'"<br>
<br>
This code tries to check for python >= 2.6 before using the "with" keyword.<br>
But if the code is run on python 2.5 it generates a syntax error regardless<br>
of the check.<br>
<br>
Python has nothing equivalent to "#if" or "#ifdef".<br>
<span class="HOEnZb"><font color="#888888"><br>
  David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
>> ---------- Forwarded message ----------<br>
>> From: David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
>> To: Ben Boeckel <<a href="mailto:ben.boeckel@kitware.com">ben.boeckel@kitware.com</a>><br>
>> Cc: VTK Developers <<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a>><br>
>> Date: Thu, 13 Feb 2014 11:42:22 -0700<br>
>> Subject: Re: [vtk-developers] Minimum Python requirement<br>
>> For me, the dashboard should only show green if the test ran _and_<br>
>> gave a valid result.<br>
>><br>
>> I  know that many of the current tests show green if the machine is<br>
>> incapable of producing a valid result (especially the ones that<br>
>> require specific GPU functionality), but that's because there isn't an<br>
>> easy way to check for the needed functionality until run time.<br>
>><br>
>> On Thu, Feb 13, 2014 at 11:22 AM, Ben Boeckel <<a href="mailto:ben.boeckel@kitware.com">ben.boeckel@kitware.com</a>><br>
>> wrote:<br>
>> > On Thu, Feb 13, 2014 at 10:55:10 -0700, David Gobbi wrote:<br>
>> >> Actually, the check should probably be done in the CMakeLists.txt:<br>
>> >><br>
>> >> if(${PYTHON_VERSION} VERSION_GREATER "2.6")<br>
>> >>   vtk_add_test_python(TestImageJSONWriter.py NO_VALID)<br>
>> >> endif()<br>
>> ><br>
>> > I don't see why. We can certainly *run* the test on older Python<br>
>> > versions, we just can't *validate* the test. In the absence of the<br>
>> > latter, I'd take segfault discovery of a simple run test :) .<br>
>> ><br>
>> > --Ben<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>___________________________________________<br>Andrew J. P. Maclean<br><br>___________________________________________
</div>