1

I'm trying to convert tab to shape files. When I run the code, I see the tab files(list) but I get the error using QuickImport.. Can somebody suggest a fix? My tab files are located in folders undernealth archive.

import arcpy
import env
import os

workspace = "Z:/STAGING/archive"

#returns @string list of feature classes
walk = arcpy.da.Walk(workspace, datatype="Any", type="All")

for dirpath,dirnames, filenames in walk:
    print filenames
#Set local variables for QuickImport
tabfiles = "Z:/STAGING/archive/**/*.TAB"
output_gdb = "c:/Temp/results.gdb"

# Execute Quick Import
arcpy.QuickImport_interop(tabfiles,output_gdb)

Traceback (most recent call last): File "C:\polygeo\Scripts\tab to shape.py", line 42, in arcpy.QuickImport_interop(tabfiles,output_gdb) File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\interop.py", line 104, in QuickImport raise e ExecuteError: NULL pointer check failed. File: geodbfeatureclass.cpp Line #: 985 A fatal error has occurred. Check the logfile above for details Tool execution failed.

Failed to execute (QuickImport).


This is a minimal code snippet that I think will illustrate the same error:

import arcpy
tabfiles = "Z:/STAGING/archive/**/*.TAB"
output_gdb = "c:/Temp/results.gdb"
arcpy.QuickImport_interop(tabfiles,output_gdb)
  • I'm unfamiliar with the syntax that you are using with QuickImport and I think it would be easier to use FeatureClassToFeatureClass rather than QuickImport. If you want to persevere with QuickImport then I think your code snippet can be reduced a lot. I'll do this as an edit to your question. – PolyGeo Aug 28 '16 at 23:48
1

I don't think your parameters are valid.

Try running a single file conversion with this syntax:

arcpy.QuickImport_interop(r"MITAB, C:\GIS\VancouverLandBoundary.tab", r"C:\Van.gdb")

and you are supposed to get the error:

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. An input dataset must be given.

However, adding a data format will let the code to be executed properly:

arcpy.QuickImport_interop(r"MITAB, C:\GIS\VancouverLandBoundary.tab", r"C:\Van.gdb")

However, using a wildcard syntax doesn't work for me either. When running this line:

arcpy.QuickImport_interop(r"MITAB, C:\GIS\MapInfo\**\*.tab",r"C:\VanAll.gdb")

I also get the error message:

arcgisscripting.ExecuteError: NULL pointer check failed. File: geodbfeatureclass.cpp Line #: 1010 A fatal error has occurred. Check the logfile above for details Tool execution failed. Failed to execute (QuickImport).

It might be a conflict with other FME installations I have on the same machine.

So, if your single run conversion works (as mine does), you could use the Python os.walk to find all .tab files and then run this conversion for each of the files.

  • Thanks for your answer. In my code above da.walk() successfully lists all tab files in my workspace but QuickImport converts only the first tab file in the list and doesn't touch the remaining tab files in the list. How can I get QuickImport to convert all the tab files in the list and not just the first one in the list? – Tony Bonomo Aug 30 '16 at 4:17
  • The single file conversion you mentioned worked too for me but I had to remove MITAB from it. So yes its working on a single tab file only.. arcpy.QuickImport_interop(r"C:\GIS\VancouverLandBoundary.tab", r"C:\Van.gdb") How can I get it to convert multiple tab files? – Tony Bonomo Aug 30 '16 at 4:30
  • 1
    Use Python for loop and replace the path to the file with r"C:\GIS\{0}​".format(path) – Alex Tereshenkov Aug 30 '16 at 6:52
  • Could you expand please on your last comment about the for loop? What should it look like and where should it go in my code to convert tab files? – Tony Bonomo Aug 30 '16 at 22:53
  • 1
    Please refer to the Python help to learn about using the for loop wiki.python.org/moin/ForLoop. You create a list of paths to your tab files and then run in the for loop every .tab file conversion. – Alex Tereshenkov Aug 31 '16 at 5:49
0

Got the same error with MIF/MIDs.

Looks like your parameters are almost valid and problem is with hidden additional parameters. If you try to run Quick Import directly from toolbox and give it your wild-card (**.TAB) and take a look at full script line you will see something like this:

MITAB Path\To\Source.TAB "RUNTIME_MACROS,""FME_TABLE_PASSWORD,,_MITAB_FULL_ENHANCED_GEOMETRY,YES,ENCODING,,EXPOSE_ATTRS_GROUP,,MITAB_EXPOSE_FORMAT_ATTRS,,USE_SEARCH_ENVELOPE,NO,SEARCH_ENVELOPE_MINX,0,SEARCH_ENVELOPE_MINY,0,SEARCH_ENVELOPE_MAXX,0,SEARCH_ENVELOPE_MAXY,0,CLIP_TO_ENVELOPE,NO,_MERGE_SCHEMAS,YES"",META_MACROS,""SourceFME_TABLE_PASSWORD,,Source_MITAB_FULL_ENHANCED_GEOMETRY,YES,SourceENCODING,,SourceEXPOSE_ATTRS_GROUP,,SourceMITAB_EXPOSE_FORMAT_ATTRS,,SourceUSE_SEARCH_ENVELOPE,NO,SourceSEARCH_ENVELOPE_MINX,0,SourceSEARCH_ENVELOPE_MINY,0,SourceSEARCH_ENVELOPE_MAXX,0,SourceSEARCH_ENVELOPE_MAXY,0,SourceCLIP_TO_ENVELOPE,NO"",METAFILE,MITAB,COORDSYS,,IDLIST,,__FME_DATASET_IS_SOURCE__,true" Path\To\Gdb.gdb

So if you want to run Quick Import from python, try the following:

add_line = '"RUNTIME_MACROS,...copy everything here...,__FME_DATASET_IS_SOURCE__,true"'
tab_files = "MITAB Z:/STAGING/archive/**/*.TAB"
output_gdb = "c:/Temp/results.gdb"
arcpy.QuickImport_interop(tab_files + ',' + add_line, output_gdb)

Hope this helps.

0

The ArcGIS Help Suggests using the Quick Import GP tool in ArcMap/ArcCatalog and copying the syntax to a python snipit once working.

arcpy.QuickImport_interop(Input='MITAB,E:\Temp\Road_Centrelines.TAB,"RUNTIME_MACROS,""FME_TABLE_PASSWORD,,_MITAB_FULL_ENHANCED_GEOMETRY,YES,ENCODING,,EXPOSE_ATTRS_GROUP,,MITAB_EXPOSE_FORMAT_ATTRS,,USE_SEARCH_ENVELOPE,NO,SEARCH_ENVELOPE_MINX,0,SEARCH_ENVELOPE_MINY,0,SEARCH_ENVELOPE_MAXX,0,SEARCH_ENVELOPE_MAXY,0,SEARCH_ENVELOPE_COORDINATE_SYSTEM,,CLIP_TO_ENVELOPE,NO,_MERGE_SCHEMAS,YES"",META_MACROS,""SourceFME_TABLE_PASSWORD,,Source_MITAB_FULL_ENHANCED_GEOMETRY,YES,SourceENCODING,,SourceEXPOSE_ATTRS_GROUP,,SourceMITAB_EXPOSE_FORMAT_ATTRS,,SourceUSE_SEARCH_ENVELOPE,NO,SourceSEARCH_ENVELOPE_MINX,0,SourceSEARCH_ENVELOPE_MINY,0,SourceSEARCH_ENVELOPE_MAXX,0,SourceSEARCH_ENVELOPE_MAXY,0,SourceSEARCH_ENVELOPE_COORDINATE_SYSTEM,,SourceCLIP_TO_ENVELOPE,NO"",METAFILE,MITAB,COORDSYS,,IDLIST,,__FME_DATASET_IS_SOURCE__,true"', Output="E:/Temp/Road_Centrelines.gdb")

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.