1. Error: arcgisscripting.ExecuteError : ERROR 000539: Invalid field one_1
analysis:
This problem occurs if the field referenced in the python expression does not exist or is misspelled.
solve:
Change the name of the field in the expression to the correct name.
2. Catch exception
try :
arcpy.Union_analysis (inFeatures, outFeatures, "ALL")
except arcpy.ExecuteError:
arcpy.GetMessages()
3. Syntax error: cannot assign to literal
solve:
Change to condition = '"change" = 0'
4. Error: object: create object layer invalid data source
This is arcpy.mapping.Layer Interface error:
- Check whether the file corresponding to the address passed into the interface exists. (if it is in the file geographic database, the extension does not include. SHP).
-
-
- Note that in the process of spelling address, /and \, do not mix. Generally, \
is used
-
supplement
1. Python gets the file names of all specified suffixes in the specified directory
os.path.splitext():Separate filename and extension
os.path.splitext(file)[0] gets the file name
os.path.splitext(file)[1] get file extension
2. Python template string
from string import Template
query='''
hi,%{name}this is a ${test}
'''
t = Template(query)
query = t.substitute({'name': 'Newber', 'test':'Test'})