I'm looking for a way to execute a workbench from a python script. I came across a sample py code from the fme knowledge center and I tried it (see py code below). It first gave me a win 32 error. My python is 32 bit. So, I downloaded python 64 bit, but still can't access the fmeobjects. see error message below. The fmeobjects does exist in the path below. What am I missing? How to execute a fme workbench from python?
Â
........error message running the py script.....
Â
import fmeobjects
ImportError: DLL load failed: The specified procedure could not be found.
Â
.......... py code...........
import sys
sys.path.append(r"C:\\Program Files\\FME\\fmeobjects\\python27")
import fmeobjects
# initiate FMEWorkspaceRunner Class
runner = fmeobjects.FMEWorkspaceRunner()
# Full path to Workspace, example comes from the FME 2014 Training Full Dataset
workspace = 'C:\\Program Files\\FME\\fme.exe" C:\\...myworkbench.fmw'
# Set workspace parameters by creating a dictionary of name value pairs
parameters = {}
parameterse'Input'] ='C:\\...my input txt file'
parameterse'COORDSYS'] = 'LL-WGS84'
parameterse'Output_Name'] = 'My output filename'
# Use Try so we can get FME Exception
try:
# Run Workspace with parameters set in above directory
runner.runWithParameters(workspace, parameters)
# or use promptRun to prompt for published parameters
#runner.promptRun(workspace)
except fmeobjects.FMEException as ex:
# Print out FME Exception if workspace failed
print ex.message
else:
#Tell user the workspace ran
print('The Workspace %s ran successfully'.format(workspace))
# get rid of FMEWorkspace runner so we don't leave an FME process running
runner = None