[gdal-dev] print throw a SyntaxError with Python 2.6

Even Rouault even.rouault at mines-paris.org
Mon Mar 22 15:09:55 EDT 2010


Gilles,

Yes this is a known regression of GDAL 1.7.0. See 
http://trac.osgeo.org/gdal/ticket/3441 that contains the fix. You can grab a 
working version of gdal_retile.py from latest gdal-svn-stable archive from 
http://download.osgeo.org/gdal/daily/

Best regards,

Even

Le Friday 19 March 2010 14:47:16 Gilles Bassière, vous avez écrit :
> Hi,
>
> I got the following error with gdal_retile.py (fresh GDAL 1.7.1 install
>
> on an Ubuntu jaunty box):
> >   File "/home/gba/Apps/usr/bin/gdal_retile.py", line 273
> >     print("Building internal Index for %d tile(s) ..." % len(inputTiles),
> > end=' ') ^ SyntaxError: invalid syntax
>
> My Python verstion is:
> > $ python -V
> > Python 2.6.2
>
> I think the problem comes from the use of print as a function instead of
> a statement. Indeed, as long as print is considered a statement, the
> parenthesis delimits a tuple (not function arguments) and a tuple
> doesn't accept named arguments, hence the SyntaxError.
>
> I've been able to work around this by adding:
> > from __future__ import print_function
>
> at the beginning of the script, as suggested in
> http://docs.python.org/release/2.6.2/library/functions.html#print.
>
> Regards




More information about the gdal-dev mailing list