Is there a solution to some versions of glyphs2 without the attribute segment.type

paths is no longer a list in Glyphs 3. Instead, use layer.shapes[0]

Note that the shapes list also contains other shape types like components.

See here for details: