[vtk-developers] Minimum Python requirement

Ben Boeckel ben.boeckel at kitware.com
Sun Feb 16 10:05:09 EST 2014


On Sun, Feb 16, 2014 at 09:40:05 +1100, Andrew Maclean wrote:
> 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.

Yeah, Python has to support all the syntax in the else block, but not
necessarily the APIs. The main syntax problems between various 2.x
versions that I've run across is exception catching ("except Foo as e"
is new in 2.5 IIRC) and 'with' (2.6?). In Python3, the metaclass
declaration is a syntax error in Python2 and vice versa. Python3 also
only supports "except Foo as e", not "except Foo, e"). The only way to
catch named exceptions from 2.4 through 3.x is:

    catch Foo:
        e = sys.exc_info()[1]

--Ben



More information about the vtk-developers mailing list