2

I am trying to move my plugin from QGIS 1.8 to QGIS2.0. However, the gdal module cannot use under QGIS2.0.
I try to use Python console, typing:

    import gdal  #it's OK
    gdal.GetDriverByName( 'GTiff' ) # dosen't work, got an AttributeError

But the 'smart spelling' give 'GetDriverByName' attribute.(and has 'two'?! one for method and another one for attribute?? )
I also typing:

    dir(gdal)

But No these methods or attributes found

What can I do?? Please help me.

1 Answer 1

1

You need to use:

import osgeo.gdal
osgeo.gdal.GetDriverByName

Doing import gdal returns the gdal module in the processing toolbox.

1
  • Thanks, I use import osgeo.gdal as gdal in my script, then it works.
    – SCKU
    Jan 15, 2014 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.