hbouckaertesriaustralia-com-au-esridist

Cannot access FME workbenches in Toolbox with arcpy

Discussion created by hbouckaertesriaustralia-com-au-esridist Employee on Sep 19, 2011
Hi

I have a problem with accessing Data Interoperability (FME) workbenches version 10.0 from python (arcpy) using ArcGIS Desktop 10, service pack 1.

The purpose is to run several FME translators as batch scripts without having to open ArcCatalog.

It should be possible to import the ArcGIS toolbox in the arcpy environment and then run the workbenches in the toolbox. For example I have a toolbox named "SDE Loads.tbx" which contains several FME workbenches. To import in arcpy then would do the following:

arcpy.ImportToolbox("D:/FME/SDE Loads.tbx")

A toolbox has a name alias and each FME workbench in the toolbox also has an alias. The way that python is supposed to call an FME workbench (to execute the FME translation) is with the following format:

FMEworkbenchAlias_ToolboxAlias(input parameters)

However for me this rarely works as most times, the workbench aliases in the toolbox cannot be found. If other objects are created in the toolbox, such as models, they can always be found. This proves that both the toolbox as well as tools in the toolbox can be found by arcpy, with the exception of FME workbenches.

Note that the way I check whether models, scripts or FME workbenches can be found in the toolbox is with the following code (necessary python indents may disappear when uploading this message):

tools = arcpy.ListTools("*_ToolboxAlias")
for tool in tools:
     print tool
     print arcpy.Usage(tool)

Sometimes (and it is not known why) the workbench tools are listed in the ???print tool??? and print arcpy.Usage(tool) enumeration, but almost all cases, they are not listed at all, only other model tools in the toolbox. When FME workbenches are not listed, the workbenches cannot be executed as they cannot be found.

There seems to be no discernable pattern when FME workbenches cannot be found using arcpy (in most cases), or can be found (rarely). Closing and reopening the toolbox, ArcCatalog or even the Windows login account on the computer where this is run from makes no difference.

Note that in all cases, in arcpy, I am checking out the date interoperability license extension and include a message that I have successfully obtained the license extension. This is the code :

try:
  if arcpy.CheckExtension("DataInteroperability") == "Available":
    arcpy.CheckOutExtension("DataInteroperability")
    print "Checked out \"DataInteroperability\" Extension"
else:
  raise LicenseError
  except LicenseError:
  print "Data Interoperability license is unavailable"
except:
  print arcpy.GetMessages(2)

Hence not having a license extension is not the cause of not finding the workbench aliases. It must be something else. Would someone be able to help?

Thanks very much.

Hugo

Outcomes