The error says that
segment is an NSArray, not an segment as you expect.
I think the problem is that if any other script before yours is importing RoboFab, the path.segment is overloaded to return a list of
RSegments. Your college has no RoboFab, so the default implementation is used.
I highly recommend to use the
for path in Layer.paths:
index = -1
for node in path.nodes:
index++ # add the increment at the beginning that you dont need to worry about `continue` calls.
if node.type == LINE:
prefNode = path.nodes[index - 1]
tp0 = prefNode.position
tp1 = node.position
dist = math.hypot(tp1.x - tp0.x, tp1.y - tp0.y)
pathTotalLength += dist
straightlinepts = self.PointToPointSteps(tp0, tp1, spacebetween)
for sl in straightlinepts: allpointslist.append(sl)
elif node.type == CURVE: