Quantum GIS from the standard python shell - unable to load layer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Quantum GIS from the standard python shell - unable to load layer

baobazz
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!