I am having trouble loading a raster (.asc) file to PostGIS 2.0.1 using the plugin Database - PostGIS Raster - Load raster to postgis in QGIS 1.8.0 on Win Vista 64 bit. I get the following error message:

Ett fel har inträffat vid Pythonexekvering:

Traceback (most recent call last): File "C:/Users/Magnus/.qgis//python/plugins\wktraster\DlgRasterLoader.py", line 126, in browseRaster self.getMetadata(str(fileName)) File "C:/Users/Magnus/.qgis//python/plugins\wktraster\DlgRasterLoader.py", line 163, in getMetadata ds=gdal.Open(filename) AttributeError: 'module' object has no attribute 'Open'

Python version: 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

QGIS version: 1.8.0-Lisboa Lisboa, 6416f38

Python sökväg: ['C:/Users/Magnus/.qgis//python/plugins\sextante', 'C:/PROGRA~2/GIS/QGIS/apps/qgis/./python', 'C:/Users/Magnus/.qgis//python', 'C:/Users/Magnus/.qgis//python/plugins', 'C:/PROGRA~2/GIS/QGIS/apps/qgis/./python/plugins', 'C:\PROGRA~2\GIS\QGIS\bin\python27.zip', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\DLLs', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\lib', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\lib\plat-win', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\lib\lib-tk', 'C:\PROGRA~2\GIS\QGIS\apps\qgis\bin', 'C:\PROGRA~2\GIS\QGIS\apps\Python27', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\lib\site-packages', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\lib\site-packages\win32', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA~2\GIS\QGIS\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\Users\Magnus\.qgis\python\plugins\mmqgis/forms', 'C:\PROGRA~2\GIS\QGIS\apps\qgis\python\plugins\fTools\tools']

QGIS opens the file just fine.

Any suggestions on what to do?

1 Answer 1


I have two hypothesis: 1) It seems that there is a problem with your PYTHON_PATH environmental variable. The variable used to tell Python where the installed modules and libraries are. I think you have to define an environmental variable pointing to that path. 2) It could be also that you have not installed the GDAL wrapper. Try to import it in a standard python console (using: import osgeo.gdal) if some error happens it means that you need to install gdal python wrappers.

  • Thank you for the reply. I didn´t manage to solve this using QGIS, so I used FME instead.
    – johnrobot
    Commented Mar 2, 2013 at 10:06

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.