Workflow manager Get Job AOI

2139
10
06-10-2011 04:50 AM
HenkZwols
Occasional Contributor
Hello,

I created a model and included the tool Get Job AOI from the Workflow Manager Tool toolbox.
Then i created a script from the model:
# ---------------------------------------------------------------------------
# GetAOI.py
# Created on: 2011-06-10 14:43:14.00000
#   (generated by ArcGIS/ModelBuilder)
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("JTX")


# Local variables:
AOI = "AOI"

# Process: Get Job AOI
arcpy.GetJobAOI_WMX("114298", AOI, "")



The model runs without any problems, but the script gives me this error:
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'GetJobAOI_WMX'

What am i missing?

Greeting, Henk
Tags (2)
0 Kudos
10 Replies
HenkZwols
Occasional Contributor
Anyone an idea?
0 Kudos
ChrisMathers
Occasional Contributor III
How did you add that tool to the model? Did you drag it out of a toolbox? I cant find any documentation on that tool. If you got it from a toolbox you should be able to right click on the tool and see its help docs. The help doc will have the proper syntax for it in python. The error you are getting is that the tool, as it is in your code, doesnt exist in the arcpy site package.
0 Kudos
RDHarles
Occasional Contributor
I also see that error quite often when I'm running a 9.x script in 10.x.  Do you have the case (upper/lower) correct? - GetJobAOI_WMX
0 Kudos
HenkZwols
Occasional Contributor
How did you add that tool to the model? Did you drag it out of a toolbox? I cant find any documentation on that tool. If you got it from a toolbox you should be able to right click on the tool and see its help docs. The help doc will have the proper syntax for it in python. The error you are getting is that the tool, as it is in your code, doesnt exist in the arcpy site package.

I also see that error quite often when I'm running a 9.x script in 10.x.  Do you have the case (upper/lower) correct? - GetJobAOI_WMX


Thanks for your replies. I drag it out of the Workflow Manager Tool toolbox indeed. This helptext is shown after right click:

Get Job AOI (Workflow Manager) ArcGIS 10
Summary
Gets the job's area of interest layer as a feature layer. This layer can be used to perform other analysis by plugging the output into other geoprocessing tools in a model.

Usage
The input job id must be for a job that currently exists and has an AOI defined. If an AOI doesn't exist, an empty output will be generated.

Syntax
GetJobAOI_wmx (Input_JobID, aoi_Layer, {Input_DatabasePath})
Parameter Explanation Data Type
Input_JobID The ID for the job's AOI retrieved.
String
aoi_Layer The layer name for the AOI retrieved.
Feature layer
Input_DatabasePath
(Optional) The Workflow Manager database connection file for the input job.
connection file (.jtc)
Code Sample

Get Job AOI

# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("JTX")

# Script arguments
Input_DatabasePath = arcpy.GetParameterAsText(0)
Input_JobID = arcpy.GetParameterAsText(1)

# Local variables:
AOI_Layer = "AOILayer_Job1"

# Process: Get Job AOI
arcpy.GetJobAOI_WMX(Input_JobID, AOI_Layer, Input_DatabasePath)

Environments
This tool does not use any geoprocessing environments
Licensing Information
ArcView: No
ArcEditor: Requires Workflow Manager
ArcInfo: Requires Workflow Manager


It just not runs in a script ...
0 Kudos
ChrisMathers
Occasional Contributor III
Ah! MB exported with _WMX and it should be _wmx. In the 9.3 and older geoprocessor capitalization didnt matter. At 10 it started mattering.
0 Kudos
HenkZwols
Occasional Contributor
Ah! MB exported with _WMX and it should be _wmx. In the 9.3 and older geoprocessor capitalization didnt matter. At 10 it started mattering.


It still gives me <type 'exceptions.AttributeError'>: 'module' object has no attribute 'GetJobAOI_wmx' 😞
0 Kudos
ChrisMathers
Occasional Contributor III
Well the doc you posted says syntax should be arcpy.GetJobAOI_wmx (Input_JobID, aoi_Layer, {Input_DatabasePath}). I wonder if anyone from esri would be willing to chime in on this. I dont see anything in the python help either.
0 Kudos
TopeBello
Occasional Contributor III
Hi Henk,

Thanks for reporting this issue, there is a problem with the way the Workflow Manager toolboxes were added to the system toolbox so import Arcpy is no longer sufficient to get access to the tools within.
We are working on correcting this at a later release, but the workaround for this is to explicitly import/add the Workflow Manager toolbox after you have imported Arcpy.
For example
arcpy.importToolbox(r"C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Workflow Manager Tools.tbx")

Adding this line to your code should resolve this issue.

Thanks,
Tope
0 Kudos
HenkZwols
Occasional Contributor
Thanks Tope, thats the trick (when using arcpy.GetJobAOI_WMX)

# Import arcpy module
import arcpy
arcpy.ImportToolbox(r"C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Workflow Manager Tools.tbx")

# Check out any necessary licenses
arcpy.CheckOutExtension("JTX")

# Process: Get Job AOI
arcpy.GetJobAOI_WMX(234567, "AOI")


Greetings, Henk
0 Kudos