[Qgis-developer] Quantum GIS from the standard python shell - unable to load layer

baobazz baobazz at hotmail.fr
Fri May 7 11:47:45 EDT 2010


Hi,

I'm trying to launch QGIS from the standard python shell.
But I'm unable to load a test layer which is very simple, as consisting in
only 2 polygons..

Here is what I write in the standard python shell
>>> from qgis.core import *
>>> QgsApplication.setPrefixPath("C:/Program Files/Quantum GIS Enceladus")
>>> QgsApplication.initQgis()
>>> vlayer=QgsVectorLayer("C:/testpol.shp","macouche","ogr")
Failed to load

But if i write the same lines of code in QGIS python console:
>>> vlayer=QgsVectorLayer("C:/testpol.shp","macouche","ogr")
>>>print vlayer.isValid()
True

it works...

Anything dealing with the prefix path?
Any idea?

Thanks in advance! 
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Quantum-GIS-from-the-standard-python-shell-unable-to-load-layer-tp5019950p5019950.html
Sent from the qgis-developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list