for fc in arcpy.ListFeatureClasses():
    outfc = fc + "_l"
    arcpy.PointsToLine_management(fc, outfc)

it comes up with the error "Output Feature Class: Same as input". Looks like it didn't convert at all, and added an "l" in the case of one file Bacon.shpl instead of what I want (Bacon_l.shp)

I am really bad with for loops and iterators, and I'd do this in ArcMap if I didn't have to manually enter a billion files using the batch feature.

1 Answer 1


It's probably because you're just appending "_l" to the feature class path , rather than inserting it. And when the feature class is a shapefile, you end up with "filepath.shp" + "_l" which == "filepath.shp_l"


import os.path
import arcpy

for fc in arcpy.ListFeatureClasses():
    name, ext = os.path.splitext(fc)
    outfc = name + "_l" + ext
    arcpy.PointsToLine_management(fc, outfc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.