The “line” variable yielded by layeriter was added in Nazca-0.5.7, based on among others a request for a polyline option in a xsection rather than polygons: creating paths. See also xsections and layersfor the polyline usage.
For Nazca<0.5.7, indeed use
for lay, grow, acc in nd.layeriter(xs, layer): to loop over all layers in a xsection, as you did. Note that the Viper would need a minor upgrade for “edge” defined layers, rather than ‘width’ defined layers, but that is not relevant in this example.
Note that 0.5.8 needs to be released at the time of writing of this post, so you have to remark out anglei and angleo for now.