[vtk-developers] Minimum Python requirement

Andrew Maclean andrew.amaclean at gmail.com
Sat Feb 15 17:40:05 EST 2014


Yep you're right!
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.

So if we are writing Python code for VTK what version should we use?
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.

Regards
   Andrew



On Sun, Feb 16, 2014 at 3:22 AM, David Gobbi <david.gobbi at gmail.com> wrote:

> On Fri, Feb 14, 2014 at 11:27 PM, Andrew Maclean
> <andrew.amaclean at gmail.com> wrote:
> >
> > From what I can see of newer Pythons the interpreter will not even look
> at
> > the else section of the above code.
>
> I'm going to nitpick here, because your statement here is not accurate.
> Python looks at all of the code, in fact it has to in order to
> byte-compile the
> code.  Take this code for instance:
>
> import sys
> if sys.hexversion >= 0x2060000:
>     with open("test.txt") as f:
>         print f.read()
> else:
>     print "unsupported keyword 'with'"
>
> This code tries to check for python >= 2.6 before using the "with" keyword.
> But if the code is run on python 2.5 it generates a syntax error regardless
> of the check.
>
> Python has nothing equivalent to "#if" or "#ifdef".
>
>   David
>
>
> >> ---------- Forwarded message ----------
> >> From: David Gobbi <david.gobbi at gmail.com>
> >> To: Ben Boeckel <ben.boeckel at kitware.com>
> >> Cc: VTK Developers <vtk-developers at vtk.org>
> >> Date: Thu, 13 Feb 2014 11:42:22 -0700
> >> Subject: Re: [vtk-developers] Minimum Python requirement
> >> For me, the dashboard should only show green if the test ran _and_
> >> gave a valid result.
> >>
> >> I  know that many of the current tests show green if the machine is
> >> incapable of producing a valid result (especially the ones that
> >> require specific GPU functionality), but that's because there isn't an
> >> easy way to check for the needed functionality until run time.
> >>
> >> On Thu, Feb 13, 2014 at 11:22 AM, Ben Boeckel <ben.boeckel at kitware.com>
> >> wrote:
> >> > On Thu, Feb 13, 2014 at 10:55:10 -0700, David Gobbi wrote:
> >> >> Actually, the check should probably be done in the CMakeLists.txt:
> >> >>
> >> >> if(${PYTHON_VERSION} VERSION_GREATER "2.6")
> >> >>   vtk_add_test_python(TestImageJSONWriter.py NO_VALID)
> >> >> endif()
> >> >
> >> > I don't see why. We can certainly *run* the test on older Python
> >> > versions, we just can't *validate* the test. In the absence of the
> >> > latter, I'd take segfault discovery of a simple run test :) .
> >> >
> >> > --Ben
>



-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20140216/2766571a/attachment-0002.html>


More information about the vtk-developers mailing list