Skip to main content
Solved

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

  • August 29, 2016
  • 2 replies
  • 28 views

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

david_r
Celebrity
  • 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.


  • Author
  • August 31, 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.

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

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