[Qgis-user] QgsVectorLayer causes "Failed to load" error
Brian J. Stults
bstults at fsu.edu
Fri Jun 3 21:47:34 PDT 2011
Hello,
I know this problem has been discussed many times, but the usual
remedies are not working.
First I run the following commands from the shell:
export LD_LIBRARY_PATH=/usr/local/qgis/lib
export PYTHONPATH=/usr/local/qgis/share/qgis/python
Then I run the following program:
from qgis.core import *
qgis_prefix = '/usr/local/qgis/'
QgsApplication.setPrefixPath('/usr/local/qgis/', True)
QgsApplication.initQgis()
vlayer=QgsVectorLayer('./tl_2009_09001_faces.shp','tl_2009_09001_faces','ogr')
print vlayer.isValid()
I get the error message "Failed to load".
I am using the 1.18 debian packages. It works fine if I run these
commands from the python console in qgis. Any suggestions? Thanks.
More information about the Qgis-user
mailing list