Hi everybody,
i need some help about the arcpy expression CalculateField_management.
So wrote a py program to correct some field in a layer.
so wrote my py prog like this
import arcpy
# Recherche de la gdb pour correction
ma_table = R"C:\représentation parcelaire\cadpmm_vierge.gdb"
# rappatriment des champs utilises dans la fonction
expression = "ma_fonction(param_ccogrm=!ccogrm!, param_ddenom=!ddenom!)"
print("environnement charge")
# correction du champ ccogrm
code_block: str = """def ma_fonction(param_ccogrm, param_ddenom):
if param_ccogrm == 1 and ddenom == "COPROPRIETAIRES DU LOTISSEMENT LE COTEAU":
return 7
return None"""
arcpy.CalculateField_management(
in_table=ma_table,
field="ccogrm",
expression=expression,
expression_type="PYTHON3",
code_block=code_block
)
so when i execute the program, i've got an error message
Traceback (most recent call last):
File "C:/Users/d.rouffart/PycharmProjects/pythonProject/2021_07_08_ReplaceValue.py", line 60, in <module>
code_block=code_block
can you help me to resolve my problem please. I don't see xhere is the problem .
thanks