I get this error using Python while I'm trying to label a shapefile. The strange thing is that for other shapefiles the code works.
There is a table (relates.dbf) that has the data to be used for labelling and it has the fields: Schacht (string), Auswahl (short integer), max_Übers (double) and Max_Wieder (double).
The problem shouldn't be there.
NB: The SQL for this labelling class is [TN_UEB] > 0 and I use ArcGIS 10.3.1. The code is a variation of http://support.esri.com/technical-article/000012230
Any clues? What does it mean "line 0"! Where's the problem?
def FindLabel ([Name], [TN_UEB]):
import arcpy
key1 = [Name]
key2 = "Schacht"
key3 = "Auswahl"
L = "<FNT size = '10'><BOL>" + [Name] + "\n" + " Ta = " + [TN_UEB] + " a" + "</BOL></FNT>" + "\n"
L2 = "max_Übers"
L3 = "Max_Wieder"
myDataTable = r"P:\Duesseldorf\50009\FOG\Bestand_pz\Vergleich_Ergebnisse\KOSTRA_Auswertung\Variante_1_D_neuneu\relates.dbf"
cur = arcpy.da.SearchCursor(myDataTable, [key2, L2, L3, key3])
for row in cur:
if str(key1) == str(row[0]) and row[3]>0:
L = L + str(round(float(row[1]),1)) + " m" + "<SUP>"+"3"+"</SUP>" + " (T=" + str(round(float(row[2]),1)) + "a)" + "\n"
return L
str
is only synonymous with Unicode at Python 3.x. If your field contains UTF-8 data you must process it differently.