I'm trying convert my old plugin to QGIS3 and one part is to create a shapefile, and afterwards load it to the Layer menu like this:
from qgis.core import QgsVectorLayer, QgsProject
layer = QgsVectorLayer('c:/dev/test.shp', 'test', "ogr")
print(layer.isValid())
QgsProject.instance().addMapLayer(layer)
The python console returns True and the Layer appears in the layer list, hence I can't add features to it when I have toggled editing:
However, if I remove the layer from layer list and add the layer with the same code in the Python console I have no problem with adding a feature.
Any suggestions for what I can try?
QGIS 33ca8fcb69
)? Is this the latest build you are using? – Joseph Feb 20 '18 at 10:27