I'm building a plugin in QGIS, one of its part is processing algorithm: intersection. I want to save the result as memory layer, and then work on it. Following code was working fine, nothing changed (I changed nothing), and: boom! it stopped working. The problem is in the 2nd line:
processing.runandload("qgis:intersection",selectedLayer,selectedLayer_2, "memory:temp_layer")
layer = QgsMapLayerRegistry.instance().mapLayersByName("memory:temp_layer")[0]
The memory layer is created (I can see it in QGIS) but I can't define 'layer'. I'm getting an error:
IndexError: list index out of range.
Why? :(