Hello,
I would like to run a workbench via Python. The workflow within the script is always the same. Only the input and output directories change.
For this purpose I have written a function and call it accordingly.
def fme_workbench(workbench, argument):
FME_command = '"C:\Program Files\\FME\\fme.exe" ' + workbench + ' ' + argument
result = subprocess.Popen(FME_command)
result.wait()
argument = '--Name_Veg4m_umhuellend "' + str(kachelnummer) + '_veg4m_hull" --Name_Veg4m_Loecher "' + str(kachelnummer) + '_veg4m_holes" --SourceDataset_ESRISHAPE_5 "' + os.path.join(output_dir, str(Mission), 'Lidar_RAW', str(kachelnummer), 'Output\\*.shp') + '" --FEATURE_TYPES "" DestDataset_ESRISHAPE "' + os.path.join(output_dir, str(Mission), 'Lidar_RAW', str(kachelnummer), 'Output') + '"'
fme_workbench(os.path.join(script_dir, 'EB_0_Aufbereitung_klassierte_Vegetation.fmw'), argument)
the following variables are dynamic and can change:
- kachelnummer
- Mission
calling the Workbench from Python works without problems. Only the dynamic variables are not considered. Thus the same data is always calculated, which was last calculated with the workbench, started directly from FME. My question now is, how do I define the Published Parameters in the script, so that it interprets the arguments provided from Python correctly. Unfortunately I cannot leave them empty - I get the error message "Parameter 'DestDataset_ESRISHAPE' must be given a value.