python setup.py install fails on (my) ubuntu 8.04
|Reported by:||Even Rouault||Owned by:||hobu|
The linking of _gdal.so fails with python 2.4 and 2.5 because get_gdal_config('prefix') returns a unicode string ( for example u'/home/even/gdal' ), which once appended to the gcc command line is expanded to / h o m e / e v e n / g d a l (spaces between each character), thus the failure.
the decode('ascii') in p.stdout.readline().decode('ascii') is necessary for python 3.X, since p.stdout.readline() returns content in python 3.x, thus decode('ascii') returns a unicode string. So my fix consists in only appending decode('ascii') for python 3.X and removing it for python 2.X.
The strange thing is that the fix is not necessary on all platforms running python 2.x
(The failure was unseen until recently since when I introduced python 3.x compatibility, the try except first tried with 'import popen2' and only fell back to 'import subprocess' with python 3.x)