1

I have been trying to use TableToDBASE without success. I looked at this help link: http://desktop.arcgis.com/en/arcmap/10.3/tools/conversion-toolbox/table-to-dbase.htm. The code runs fine but it does not output anything. I can see in outLocation folder that something with the same name is being created, but when the code finishes running, the folder is empty. Here is my code:

import arcpy  
workspace = r"C:\data\"  
outLocation = r"C:\output"
arcpy.TableToDBASE_conversion("table", outLocation)

The output in IDLE is:

<Result 'C:\\Users\\Ariel Gomez\\Desktop\\todbf'>

What am I doing wrong? Why am I not getting a dbf file in the folder?

  • What is "table"? Is it a file in the c:\data folder? Or a shapefile table? either way it would usually have an extension. Does "table" contain any rows? From the sounds of it you're running from IDLE, avoid doing that it is known to cause problems, copy and paste into the python console of ArcCatalog for most reliable results (no need to import arcpy, it's already done). – Michael Stimson Dec 19 '18 at 3:36
  • Sorry, "table" is a shapefile. So yes, it has rows and variables/fields. I can always export to dbf manually in ArcMap but its really buggy and crashes easily and frequently. But point taken on IDLE, thanks. – glipglop Dec 19 '18 at 3:50
  • 2
    "table" should then be "table.shp", not "table.dbf" - it's not wise to try to access the attribute table of a shapefile directly, proceed via the shapefile but don't worry the OGC spec ensures that FeatureClass implements Table (every feature class is also a table but a table may not necessarily be a feature class) though if you're having problems try shutil.copyfile to copy the DBF as long as you're not in an edit session, if you are editing it is important not to try, you could break things. – Michael Stimson Dec 19 '18 at 3:52
  • I did not give table.dbf, but table.shp returns a syntax error. Doing this in ArcCatalog does the same as in IDLE. Michael, thanks for your comment though it is a bit hard to follow. What exactly is your suggestion? – glipglop Dec 19 '18 at 4:00
  • Hmm, that could be because shapefile isn't a supported input format according to the docs desktop.arcgis.com/en/arcmap/10.3/tools/conversion-toolbox/… try table select desktop.arcgis.com/en/arcmap/10.3/tools/analysis-toolbox/…, that's an older tool and less likely to contain bugs. – Michael Stimson Dec 19 '18 at 4:03

Your Answer

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

Browse other questions tagged or ask your own question.