arcpy.CalculateField_management("GISMainFabric_Line_Clip_0","Bear",'[NUM1] & "°" & [NUM2]',"VB") File "C:\Users\Administrator\AppData\Local\ESRI\Desktop10.1\AssemblyCache\{7F12A0CE-D617-8330-5EBC-E045415D9345}\PlanTool_addin.py", line 105 SyntaxError: Non-ASCII character '\xb0'
Solved! Go to Solution.
Well this one you should be figuring out, since it tells you in the error what the problem is this time. You missed the underscore in "PYTHON_9.3" (You wrote "PYTHON 9.3")exp = 'str(!NUM1!) + "\xb0" + str(!NUM2!)' arcpy.CalculateField_management("GISMainFabric_Line_Clip_0","Bear", exp,"PYTHON_9.3")
If you want a space between the numbers and the minutes symbol after the second number, the expression should be:
exp = 'str(!NUM1!) + "\xb0 " + str(!NUM2!) + "'"'
# Process: Calculate Field arcpy.CalculateField_management("GISMainFabric_Line_Clip_0", "Bear", "str( !NUM1! ) + \"\\xb0 \" + str( !NUM2! ) + \"'\"", "PYTHON_9.3", "")
I tried to populate a field by using the line below in my script but I got the error message below. Please how can I represent the degree (°) & Minute (') symbols in my Python Script. Any suggestions?arcpy.CalculateField_management("GISMainFabric_Line_Clip_0","Bear",'[NUM1] & "°" & [NUM2]',"VB") File "C:\Users\Administrator\AppData\Local\ESRI\Desktop10.1\AssemblyCache\{7F12A0CE-D617-8330-5EBC-E045415D9345}\PlanTool_addin.py", line 105 SyntaxError: Non-ASCII character '\xb0'
Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\ESRI\Desktop10.1\AssemblyCache\{7F12A0CE-D617-8330-5EBC-E045415D9345}\PlanTool_addin.py", line 105, in onSelChange arcpy.CalculateField_management("GISMainFabric_Line_Clip_0","Bear",str[NUM1] + '\xb0' + str[NUM2] + "'","PYTHON 9.3") NameError: global name 'NUM1' is not defined
try:
arcpy.CalculateField_management("GISMainFabric_Line_Clip_0","Bear",str([NUM1]) + '\xb0' + str([NUM2]) + "'","PYTHON 9.3")
arcpy.CalculateField_management("GISMainFabric_Line_Clip_0","Bear",str([NUM1]) + '\xb0' + str([NUM2]) + "'","PYTHON 9.3") Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'NUM1' is not defined
("GISMainFabric_Line_Clip_0","Bear","'" + str([NUM1]) + '\xb0' + str([NUM2]) + "'" ,"PYTHON 9.3") Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'NUM1' is not defined
exp = 'str(!NUM1!) + \'\xb0\'' + str(!NUM2!)' Parsing error SyntaxError: invalid syntax (line 1)