Hy there !
I’m using FME 2022.2 and ArcGISpro 3.1.1, Python Compatibility is set to Esri ArcGIS Python 3.6+
I want to test arcpy in FME with the following script, it works but throws this error:
Python Exception <TypeError>: clip_shapefile() missing 2 required positional arguments: 'clip_features' and 'output_shapefile'
Clip works well and the shapefile is valid, but the pythoncaller ends up with this error.
The Script:
import fme
import fmeobjects
import arcpy
import os
# Overwrite
arcpy.env.overwriteOutput = True
# Function
def clip_shapefile(input_shapefile, clip_features, output_shapefile):
arcpy.Clip_analysis(input_shapefile, clip_features, output_shapefile)
return output_shapefile
# Source
input_shapefile = 'D:/TEMP/SHP/VWG_KAT_GEM.shp'
print("Quelle gelesen !")
#Clip Features
clip_features = 'D:/TEMP/SHP/VWG_POLGEM_OBERGRAFENDORF.shp'
print("Clip Features gelesen !")
# Dest
output_shapefile = 'D:/TEMP/_TEMP/VWG_POLGEM_OBERGRAFENDORF.shp'
print("Ausgabepfad festgelegt !")
# Function
clip_shapefile(input_shapefile, clip_features, output_shapefile)
print("Clippen läuft ...")
# PythonCaller-Output
fmeobjects.FMELogFile().logMessageString("Ergebnis: " + output_shapefile)
Regards
al