1

I have created a Data Interoperability Spatial ETL tool. I do have a Data Interoperability license.

I want to create a nightly batch process to run this tool.

As suggested, I have created a python script.

import arcpy,ConfigParser

# Read Config file
Config = ConfigParser.RawConfigParser()
Config.read('Config.txt')
TOOLBOXPATH=Config.get('ETL_Spatial','ToolboxPath')


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)

# Import custom toolbox
arcpy.ImportToolbox(TOOLBOXPATH,'DataInterop')
arcpy.SpatialETLTool()

The value of TOOLBOXPATH is C:\Data Interoperability Tools\TransmissionDataRefresh\TransmissionDataRefresh.tbx.

But again I am getting below mentioned error while executing the script:-

Checked out "DataInteroperability" Extension Traceback (most recent call last): File "C:\Data Interoperability Tools\TransmissionDataRefresh.py", line 24, in <module> arcpy.ImportToolbox(TOOLBOXPATH,'DataInterop') File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\__init__.py", line 125, in ImportToolbox return import_toolbox(input_file, module_name) File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\toolbox_code.py", line 434, in import_toolbox toolbox = gp.createObject("Toolbox", tbxfile) File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\geoprocessing\_base.py", line 381, in createObject self._gp.CreateObject(*gp_fixargs(args, True))) IOError: The toolbox file C:\Data Interoperability Tools\TransmissionDataRefresh\TransmissionDataRefresh.tbx was not found.

Please help

2

You can call that tool in a python script that you run every night.

In order to run that python script every night, you need to use Windows Task Scheduler.

You can get the python code snippet by running your tool in ArcGIS, open the Result Window (accessible from ArcGIS Desktop Menu --> Geoprocessing --> Results), and then right-click --> Copy as Python Snippet.

In response to the edit:

When calling the toolbox, follow this pattern:

arcpy.ImportToolbox(TOOLBOXPATH,'DataInterop')
arcpy.YourToolName_DataInterop()

If your tool expects any parameters, then add them within the brackets at arcpy.YourToolname_DataInterop(param1, param2).

You can get the tool name by right clicking on it in ArcGIS Desktop and access the properties. Use the tool name, not the tool label.

Here is an example of some of my code to call a tool called AttributeChecker in a some of my toolbox:

# Import my toolbox and give an alias DataInterop
arcpy.ImportToolbox(input_toolbox_path, 'DataInterop')
# Call the tool AttributeChecker
arcpy.AttributeChecker_DataInterop()
  • In python, do not forget to import your custom toolbox first. For example: arcpy.ImportToolbox(input_toolbox_path, 'DataInterop'). Full documentation is here: pro.arcgis.com/en/pro-app/arcpy/functions/importtoolbox.htm – Fabien Ancelin Feb 2 '17 at 17:24
  • When I am trying to copy it as a python snippet and pasting it in a python IDE then it only show arcpy.SpatialETLTool() – Snehil Kandpal Feb 3 '17 at 10:05
  • 1
    I am getting an error while using ImportToolbox() function IOError: The toolbox file C:\Data Interoperability Tools\TransmissionDataRefresh\TransmissionDataRefresh.tbx was not found I have my arcGIS toolbox there but still it gives this error – Snehil Kandpal Feb 3 '17 at 14:03
  • Are you checking out the data interop extension first: arcpy.CheckOutExtension('DataInteroperability')? – Fabien Ancelin Feb 3 '17 at 16:18
  • Please check out the code. I have edited the question. Thanks – Snehil Kandpal Feb 3 '17 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.