Skip to main content
Solved

How to fix an TypeError: descriptor 'runWithParameters' error?


Hi,

I have just tried to use the snippet supplied by Safe to run a Workbench from python and i get the following error

TypeError: descriptor 'runWithParameters' requires a 'fmeobjects.FMEWorkspaceRunner' object but received a 'str'

This is my code so far up to the point where these is the error:

#initiate FMEWorkspaceRunner Class

 

runner = fmeobjects.FMEWorkspaceRunner

 

 

#Full path to Workbench

 

workspace = r'C:\\Avoidance_Areas\\shape2acad2016.fmw'

 

 

#Set workspace parameters by creating a dictionary of name value pairs

 

parameters = {}

 

parameters['SourceDataset_SHAPE'] = Avoidance_Area_shp

 

parameters['DestDataset_ACAD'] = r'C:\\Avoidance_Areas\\Avoidance_Areas.dxf'

 

 

# Use Try so we can get FME Exception

 

try:

 

# Run Workspace with parameters set in above dictionary

 

runner.runWithParameters(workspace, parameters)

Can anyone tell me why its having this issue as im following the supplied code template.

Best answer by david_r

Try with paranthesis at the end:

runner = fmeobjects.FMEWorkspaceRunner()

They are the difference between returning a class reference (without paranthesis), and returning an instance of the class (with paranthesis).

Notice the paranthesis here as well.

View original
Did this help you find an answer to your question?

2 replies

david_r
Evangelist
  • Best Answer
  • August 29, 2016

Try with paranthesis at the end:

runner = fmeobjects.FMEWorkspaceRunner()

They are the difference between returning a class reference (without paranthesis), and returning an instance of the class (with paranthesis).

Notice the paranthesis here as well.


david_r wrote:

Try with paranthesis at the end:

runner = fmeobjects.FMEWorkspaceRunner()

They are the difference between returning a class reference (without paranthesis), and returning an instance of the class (with paranthesis).

Notice the paranthesis here as well.

Thanks David - looks like that helped but now im getting the 

FMEException: 896902 ... i will have to inveistgate why this is the case. 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings