I am using PythonCaller and have wrote a script for it. I have tested my script outside of FME and it works.
Script creates a column and calculates value for it. When I run my fme, I am getting this error:
PythonFactory failed to load python symbol `processFeature(feature)'
Factory proxy not initialized
f_24(PythonFactory): PythonFactory failed to process feature
The PythonCaller Parameters:
Script:
import fme, fmeobjects
import arcpy
from collections import Counter
def processFeature(feature):
# The location of the destination geodatabase and feature class
feat_class = feature
# Add new field for new value
arcpy.AddField_management(feat_class, "countVehicle", "SHORT")
# add all values for brigade unique id to a list
all_values = list()
with arcpy.da.SearchCursor(feat_class, ["T_LOCATION_CODE"]) as cursor:
for row in cursor:
all_values.append(row[0])
# Calculate field
fields = ["T_LOCATION_CODE", "countVehicle"]
with arcpy.da.UpdateCursor(feat_class, fields) as cursor2:
for row2 in cursor2:
if row2[0] in Counter(all_values):
row2[1] = Counter(all_values)[row2[0]]
cursor2.updateRow(row2)