[Gdal-dev] AttributeError: Driver instance has no attribute 'has_key'

Paulick Consult stefan.paulick at urbeli.com
Mon Aug 15 10:39:21 EDT 2005


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) \
      and metadata[gdal.DCAP_CREATE] == 'YES':
       print 'Driver %s supports Create() method.' % format
   if metadata.has_key(gdal.DCAP_CREATECOPY) \
      and metadata[gdal.DCAP_CREATECOPY] == 'YES':
       print 'Driver %s supports CreateCopy() method.' % format 

 

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