Hi,

I'm having problem loading a vector (shape) layer from python, (as
decribed in this document:
http://www.scribd.com/doc/56229514/4/Python-Applications , page 7)


Heres my code:


def main():
    pass

if __name__ == '__main__':
    main()

import sys, os

from qgis.core import *
import qgis.utils


QgsApplication.setPrefixPath("C:\OSGeo4W\apps\qgis", True)
QgsApplication.initQgis()



vlayer = QgsVectorLayer("C:\test_qgis\ROG_Kommuner.shp","test_layer","ogr")


if not vlayer.isValid():
    print "Layer failed to load!"




and the output reporting that my layer failed to load:

*** Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32
bit (Intel)] on win32. ***
>>>
Layer failed to load!



I'm using the OSGeo4W installation, on Windows 7, python 2.52, 32 bit.
I'm using pyscripter.

What am I doing wrong here?


Viktor Kalén
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to