[Gdal-dev] Re: AttributeError: Driver instance has no attribute
'has_key'
Paulick Consult
stefan.paulick at urbeli.com
Mon Aug 15 11:22:27 EDT 2005
Yes, now it works. Thank you very much!
Maybe you can correct the given python example code?
It lives at "Techniques for Creating Files" in
http://www.gdal.org/gdal_tutorial.html
/Stefan
Frank Warmerdam schrieb:
> 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
Mit freundlichen Grüßen / With kindest regards
Stefan Paulick
http://www.urbeli.com
mailto://stefan.paulick@urbeli.com
/*----------------------*/
More information about the Gdal-dev
mailing list