[GIS] Loading Vector Layer using python console in qgis

pyqgispython-2.7qgisvector

I am using qgis2.6 version and new to pyQGIS. I tried to load a vector file using python console in qgis. I don't know where I am wrong. The layer was not loaded and does not show any error too. Help would be appreciated.The code which i tried is below.

wb = QgsVectorLayer('C:\Users\new\Desktop\PyQGIS\pyqgis_data\world_borders.shp', 'world_borders', 'ogr')
QgsMapLayerRegistry.instance().addMapLayer(wb)

enter image description here

enter image description here

Best Answer

I don't have a Windows OS to test it, but I'm pretty sure the problem is in the path to your ShapeFile. Make sure the path is correct and try with slashes (/) or double back slashes (\\).

Related Question