[Gdal-dev] AttributeError: Driver instance has no attribute
'has_key'
Frank Warmerdam
fwarmerdam at gmail.com
Mon Aug 15 10:56:27 EDT 2005
On 8/15/05, Paulick Consult <stefan.paulick at urbeli.com> wrote:
> Hello list,
>
> when working trough http://www.gdal.org/gdal_tutorial.html,
> this error came up:
>
> Traceback (most recent call last):
> if metadata.has_key(gdal.DCAP_CREATE) \
> AttributeError: Driver instance has no attribute 'has_key'
>
> Did I miss something or is has_key not longer available?
>
> code was:
>
> import gdal
> from gdalconst import *
>
> filename= 'c:\data\ueb.bild'
> dataset = gdal.Open( filename, GA_ReadOnly )
> if dataset is None:
> print "bild nicht angelegt:",filename
> format = "GTiff"
> metadata = gdal.GetDriverByName( format )
> if metadata.has_key(gdal.DCAP_CREATE) \
Stefan,
I believe the problem is that you fetch the driver by name, but
don't request the driver metadata. Try changing:
metadata = gdal.GetDriverByName(format)
to:
driver = gdal.GetDriverByName(format)
metadata = driver.GetMetadata()
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 | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list