Select to view content in your preferred language

Spatial ETL Tools won't run "AttributeError: 'module' object has no attribute, etc."

6129
17
07-15-2014 08:45 AM
ChrisRado
Occasional Contributor

I have a python script that runs 5 Spatial ETL tools that I wish to run as a scheduled task.

 

Each of the tools will run successfully from ArcCatalog and also from the ArcCatalog Command line.

 

If I try to run the tools from the DOS window, as would be done via python script for a scheduled task, arcpy cannot find the tools, although it does load the toolbox.

 

In the attached screenshot: 1) I open a cmd.exe window; 2) start python; 3) import arcpy; 4) Import my toolbox, which is verified as loaded on the next line; 5) Use arcpy.ListTools to see what tools are loaded. the result is "[]", meaning no tools are recognized from this tool box; 6) I use the same ListTools to show the Spatial Analyst tools that were loaded by import arcpy; 7) I attempt to execute one of the tools from my toolbox and forget a " (my mistake!); 😎 I attempt to execute one of the tools from my toolbox and receive the message "AttributeError: 'module' object has no attribute 'CopyFeatureClass_newgpetl'".

 

What is preventing my tools from being recognized from the DOS CMD.EXE window while ArcCatalog and ArcCatalog Command Line can run them?

 

ToolsNotLoaded.PNG

0 Kudos
17 Replies
ChrisRado
Occasional Contributor

Just for anyone who comes across this same problem and searches out this discussion:

The key thing that I am missing (in this case) that causes the "AttributeError: 'module' object has no attribute..." is that I forgot to check out the Data Interoperability extension, with this:

arcpy.CheckOutExtension("DataInteroperability")

This fixed the problem on my local machine, but it did not fix the problem on our server. When I figure that out, I'll add a note about what it was to this discussion.

0 Kudos
KristiBarry
Emerging Contributor

Please share any results you may have.  I am not able to make this work even after executing (and verifying) the arcpy.CheckOutExtension("DataInteroperability") has checked out the extension.  We are getting the same AttributeError everyone else seems to be seeing on this problem.

thanks,

Kristi

0 Kudos
ChrisRado
Occasional Contributor

Kristi,

This is why Spatial ETL Tools are NOT being recognized on the server- in our particular case.

NIM09073:

"When calling a model with Python that contains a Data Interoperability Spatial ETL tool, the script will not run successfully from IDLE when Esri Production Mapping 10.1 is installed."

Spatial ETL Tools will not run if you have Workflow Manager (aka Esri Production Mapping) installed on the same machine. If I uninstall Workflow Manager and try the tools again, they become visible at the Windows command line.

I'm assuming you have already been through:

1) Proper names for Toolbox Name (no spaces) and Toolbox Label (any crazy thing you want).

2) Adding an all lower case Toolbox Alias

3) Proper names for Tool Name (no spaces) and Tool Label (any crazy thing you want).

Chris

0 Kudos
SrijanaTuladhar
Occasional Contributor

Hi Chris,

I am getting the same attribute error, even after adding the arcpy.CheckOutExtension("DataInteroperability") into the script.

The error message.

Traceback (most recent call last):

  File "G:\....\Scripts\ETL_mb_test5.py", line 21, in <module>

    arcpy.SpatialETLTool_test("G:\\....\\Source42015.gdb")

AttributeError: 'module' object has no attribute 'SpatialETLTool_test'

>>>

Here is the python script:

# Import arcpy module
import arcpy

# Load required toolboxes
arcpy.ImportToolbox("G:/..../testETLtool.tbx")

# Check out extension

arcpy.CheckOutExtension("DataInteroperability")

# Local variables:
Source42015_gdb = "G:\\.....\\Source42015.gdb"

# Process: SpatialETLTool
arcpy.SpatialETLTool_test("G:\\.......\\Source42015.gdb")

Thanks for your help.

Sri

0 Kudos
BruceHarold
Esri Regular Contributor

Hi

Do you have the Workflow Manager extension installed?  There is a known incompatibility fixed in 10.3.1 that results in Data Interoperability tools not being licensed when Workflow Manager is present.

Regards

0 Kudos
SrijanaTuladhar
Occasional Contributor

Hi Bruce,

No, I do not have Workflow Manager extension installed.

Thanks

Sri

0 Kudos
BruceHarold
Esri Regular Contributor

Please check you have an alias 'test' set for the Toolbox containing your ETL tool - that is the value indicated by your Python code.  If you do then you need to log a support call because something else is wrong.

Thanks

0 Kudos
SrijanaTuladhar
Occasional Contributor

Ok thanks. Yes, I just double checked, I have an alias 'test' for the Toolbox that contains the ETL tool.

0 Kudos
ChrisBlinn1
Regular Contributor

Also having this issue.

Workflow Manager and Production Mapping are not installed.

Checked out extension.

Toolbox has alias, and model has name.

Runs from ModelBuilder and from python console in ArcCatalog 10.2.2

# Import arcpy module
import arcpy

class LicenseError(Exception):
   pass

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)

# Load required toolboxes
arcpy.ImportToolbox("C:/.../ETL.tbx")

# Script arguments
Source = arcpy.GetParameterAsText(0)
if Source == '#' or not Source:
  Source = "C:\\...\\Source.gdb" # provide a default value if unspecified

Destination = arcpy.GetParameterAsText(1)
if Destination == '#' or not Destination:
  Destination = "C:\\...\\Destination.gdb" # provide a default value if unspecified

FeatureTypes = arcpy.GetParameterAsText(2)
if FeatureTypes == '#' or not FeatureTypes:
  FeatureTypes = "Parcel_Project" # provide a default value if unspecified

# Local variables:

# Process: WalworthETL
arcpy.WalworthETL_ETL(Destination, Source, FeatureTypes)
0 Kudos