import arcpy
import os
import re 

input_polygon = r"F:\wushenqi\tif\data\wushenqi_3\vci\d_8735"


arcpy.env.workspace = input_polygon
shps = arcpy.ListFiles("*.shp")


            
for shp in shps:
    catchment_name = shp[8:-4]
   
    print (catchment_name)
    
    date = int(catchment_name)

    # arcpy.DeleteField_management(shp,["LandId"])

    field_names = [f.name for f in arcpy.ListFields(shp)]
    if 'landId' not in field_names:
        if 'date' not in field_names:
            arcpy.AddField_management(shp, 'date', 'Long')
            arcpy.AddField_management(shp, 'landId', 'Short')
            arcpy.AddField_management(shp, 'landName','TEXT')
            arcpy.AddField_management(shp, 'crop','TEXT')
            # arcpy.AddField_management(shp, 'year','Short')
        arcpy.CalculateField_management(shp,'date',expression=date,expression_type="python", code_block="")
        arcpy.CalculateField_management(shp,'landId',expression=8735,expression_type="python")
PS F:\wushenqi> & C:/Python27/ArcGIS10.5/python.exe f:/wushenqi/py/dbf.py
 WARNING: Unable to load code page translation table c:\program files (x86)\arcgis\desktop10.5\\locale\codepage\936.txt.
 WARNING: Unable to load code page translation table c:\program files (x86)\arcgis\desktop10.5\\locale\codepage\936.txt.
 Code page conversion is off for writing data into files.
 Code page conversion is off for writing data into files.
 WARNING: Unable to load code page translation table c:\program files (x86)\arcgis\desktop10.5\\locale\codepage\936.txt.
 WARNING: Unable to load code page translation table c:\program files (x86)\arcgis\desktop10.5\\locale\codepage\936.txt.
 Code page conversion is off for reading data from files.
 Code page conversion is off for reading data from files.
20230401
Traceback (most recent call last):
    arcpy.CalculateField_management(shp,'landId',expression=8735,expression_type="python")
  File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\management.py", line 3663, in CalculateField
    raise e
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000728: Field landId does not exist within table
Failed to execute (CalculateField).

PS F:\wushenqi> & C:/Python27/ArcGIS10.5/python.exe f:/wushenqi/py/dbf.py
 WARNING: Unable to load code page translation table c:\program files (x86)\arcgis\desktop10.5\\locale\codepage\936.txt.
 WARNING: Unable to load code page translation table c:\program files (x86)\arcgis\desktop10.5\\locale\codepage\936.txt.
 Code page conversion is off for writing data into files.
 Code page conversion is off for writing data into files.
 WARNING: Unable to load code page translation table c:\program files (x86)\arcgis\desktop10.5\\locale\codepage\936.txt.
 WARNING: Unable to load code page translation table c:\program files (x86)\arcgis\desktop10.5\\locale\codepage\936.txt.
 Code page conversion is off for reading data from files.
 Code page conversion is off for reading data from files.
20230401
Traceback (most recent call last):
  File "f:/wushenqi/py/dbf.py", line 31, in <module>
    arcpy.CalculateField_management(shp,'landId',expression=8735,expression_type="python")
  File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\management.py", line 3663, in CalculateField
    raise e
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000728: Field landId does not exist within table
Failed to execute (CalculateField).
怎么解决