I use a 3rd party software that exports the name of JPEG as I collect points, in this case street signs. I know the names stay static and are all unique but different features may have the same JPEG (which I think wont be a problem). So the issue I am having, as my update cursor is running it seems to crash and often times skip over fields (they do exist and are still being skipped over). When I run my codes again sometimes I will get this "Too many outputs to process". Here is my Code:
I am using Pycharm, I have some theories to why it keeps crashing, not enough memory, data too large, or the program is clunky when processing large data. If anyone has some suggestions or more efficient programs for processing python code for my large data sets that would be awesome.
Here is my Code:
import arcpy
from arcpy import management
arcpy.env.workspace = r'F:\Compton LTI Imagery\Imagery'
folders = arcpy.ListWorkspaces("*")
for folder in folders:
arcpy.env.workspace = folder
rasters = arcpy.ListRasters("*")
for raster in rasters:
desc = arcpy.Describe(raster)
input = r'C:\Users\ferna\Desktop\Compton_Signs\Compton_Signs.shp'
management.AddField(input,"Direct_R", "TEXT", "","", 100)
fields = ['Right_Img', 'Direct_R']
with arcpy.da.UpdateCursor(input, fields)as cursor:
for row in cursor:
name = desc.baseName
if row[0] == name:
row[1] = folder + "\\" + raster
cursor.updateRow(row)
print raster + " " + "Directory_R Copied"
management.AddField(input,"Direct_L", "TEXT", "","", 100)
fields_2 = ['Left_Img', 'Direct_L']
with arcpy.da.UpdateCursor(input, fields_2)as cursor:
for row in cursor:
name = desc.baseName
if row[0] == name:
row[1] = folder + "\\" + raster
cursor.updateRow(row)
print raster + " " + "Directory_L Copied"
print "Operation Completed"
Direct_R
. I noticed the indentation is off throughout your script. Also, avoid using the variableinput
as this is a reserved Python variable.