Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Using the Data Interoperability tool, Quick Export, from Python

$
0
0
Hi,

I'm writing a Python script to work with ArcGIS 9.3.1 and when I try to use the "Quick Export" data interoperability tool in Python, I can only get it to export to the file types that don't require the data interoperability licence, e.g. GMLSF. When I try any of the licensed file types I get this error message:

FME API version of module 'MITAB' matches current internal version (3.4 20081031)
Module 'MITAB' is not licensed for use with this FME edition

Has anyone had a similar problem? I've applied suggestions made in other posts on the web that relate to similar issues - I'm checking out the licence and setting the toolbox - but it still doesn't work:

Code:

import arcgisscripting, string
gp = arcgisscripting.create(9.3)

# Check out the Data Interoperability Extension
gp.SetProduct("ArcInfo")
gp.AddToolbox("C:\Program Files\ArcGIS\ArcToolBox\Toolboxes\Data Interoperability Tools.tbx")
gp.Toolbox = "interop"

# Put in error trapping in case an error occurs when running tool
try:
    # Check for the data interoperability licence
    if gp.CheckExtension("DataInteroperability") == "Available":
        print gp.CheckExtension("DataInteroperability")
        gp.CheckOutExtension("DataInteroperability")
        print "Data Interoperability licence available and checked out"
    else:
        raise "LicenseError"

    # Variables
    FC_workspace = "***"
    FC_name = "***"
    FC_path = FC_workspace + FC_name
    FL_name = "***"
    Output_FC = "***"
    Export_output = "mitab,C:\\temp\\Scripts\\" + Output_FC
    FC_query = "***"

    # Make a feature layer from the feature class
    gp.MakeFeatureLayer(FC_path, FL_name)
    print "Feature layer created"

    # If a query exists, run it against the feature layer
    if len(FC_query)!=0:
        gp.SelectLayerByAttribute(FL_name, "NEW_SELECTION", FC_query)
        print "Selection completed"
    else:
        print "No query run"

    # Write the selected features to a new TAB file
    gp.QuickExport_interop(FL_name, Export_output)
    print "TAB export completed"

    gp.CheckInExtension("DataInteroperability")
    print "Data Interoperability extension checked in"
   
except "LicenseError":
    print "Data Interoperability license is unavailable" 

except:
    # If an error occurred, print the message to the screen
    print "==ERROR=="
    print gp.GetMessages()

Any help would be greatly appreciated.

Thanks,
Dave

Viewing all articles
Browse latest Browse all 2485

Trending Articles