[FWTools] Opening ENVI file in python using FWTools 2.10

Frank Warmerdam warmerdam at pobox.com
Tue Mar 4 07:09:57 EST 2008

Jeff Ruby wrote:
> Hi,
> I'm using FWTools 2.10 on Windows.  I'm trying to access an ENVI file
> through Python.  I have two files:  my_file.envi and my_file.envi.hdr
> Here's a code snippet:
> if __name__ == '__main__':
>     input_file = "my_file.envi"
>     gdal.AllRegister()
>     argv = gdal.GeneralCmdLineProcessor( sys.argv )
>     dataset = gdal.Open(input_file, GA_ReadOnly)
> When I do this I get a message saying "my_file.envi" is not a supported file
> format.  If I try to use "my_file.envi.hdr" I get a message telling me to
> use "my_file.envi"  If I strip off the .envi everything works fine.  Is
> there a way to make gdal.Open() work correctly with the .envi in the
> filenames?


I tried renaming the .dat file from an envi fileset to .envi and did a gdalinfo
on the .envi file and it worked fine for me.  I also tried opening it with a
python script.  So, I'm not sure why you are running into problems.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

More information about the FWTools mailing list