I'm using ListFeatureClasses to list all the layers in the GDB that I created and added layers to from a previous step. I then create another list and split the "\\" out and am left with a list of serials that I want. But when I add the two lists to the MakeFeatureLayer tool I get an error?
arcpy.env.workspace = r'\\FilePath\Tracks.gdb'
GDB = arcpy.env.workspace
full_fcs = []
for fc in arcpy.ListFeatureClasses():
full_fcs.append(os.path.join(GDB,fc))
print(full_fcs)
serials = []
for i in full_fcs:
serials.append(i.split("\\")[-1])
print(serials)
['T07JDD9C00100DP', 'T095XH6K002006B', 'T0K1CF8W3AH5FKP', 'T1WNBH3K00201QB', 'T3N3BHBA012024T', 'T3NZCJ9L0146GRK', 'T3NZSHAP00304LW']
arcpy.management.MakeFeatureLayer(full_fcs, serials)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9395, in MakeFeatureLayer
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9392, in MakeFeatureLayer
retval = convertArcObjectToPythonObject(gp.MakeFeatureLayer_management(*gp_fixargs((in_features, out_layer, where_clause, workspace, field_info), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool