cedadev / jasmin_scivm

9 stars 0 forks source link

GDAL Python scripts use system Python rather than 2.7 #57

Closed danclewley closed 8 years ago

danclewley commented 8 years ago

For example running gdal_merge.py on the JASMIN SCIVM (tested on cems-sci2.cems.rl.ac.uk) gives the following error:

Traceback (most recent call last):
  File "/usr/bin/gdal_merge.py", line 37, in <module>
    import gdal
ImportError: No module named gdal

The cause of this error is all the GDAL Python scripts have

#!/usr/bin/env python

so run using the system Python (2.6) rather than the Python GDAL was build for.

I think this could be fixed by adding the following line to the spec:

sed -i 's|/usr/bin/env python|/usr/bin/env python2.7|g' swig/python/scripts/*py
alaniwi commented 8 years ago

Python scripts all over the place. Trying with global search/replace

find . -name '*.py' -type f | xargs sed -i 's,^#!/usr/bin/env python$,#!/usr/bin/env python2.7,'
alaniwi commented 8 years ago

Seems to have fixed it. Ready for installation as part of next JAP release (hopefully next week).