After writing some code, I got this error message:
TypeError: MultiLineString geometry cannot be converted to a polyline. Only single line or curve types are permitted.
I wanted to write a script that would iterate over the vertices of what I thought was a "polyline" in QGIS, giving it the name "Polyline1." However, after typing out the following code into the console, I got back the error message that I received above:
import os
layer = QgsProject.instance().mapLayersByName("Polyline1")[0]
features = layer.getFeatures()
for feature in features:
geom = feature.geometry()
vertices = geom.asPolyline()
for vertex in vertices:
print(vertex.x(), vertex.y())