Select to view content in your preferred language

arcpy.TableToTable_conversion CSV to DBF help

5749
12
Jump to solution
02-03-2016 01:19 PM
DannyLackey
New Contributor II

Using this page as my resource: ArcGIS Help (10.2, 10.2.1, and 10.2.2)

I came up with this:

import arcpy
from arcpy import env

env.workspace = "C:\"

inTable = "c:\test.csv"
outLocation = "c:\test.dbf"
outTable = "test"

arcpy.TableToTable_conversion(inTable, outLocation, outTable)

However, it's failing:

Traceback (most recent call last):

  File "c:\test.py", line 4, in <module>

    arcpy.TableToTable_conversion("c:\test.csv", "c:\test.dbf", "test")

  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\conversion.py", line 1904, in TableToTable

    raise e

ExecuteError: Failed to execute. Parameters are not valid.

ERROR 000732: Input Rows: Dataset c:\test.csv does not exist or is not supported

ERROR 000732: Output Location: Dataset c:\test.dbf does not exist or is not supported

Failed to execute (TableToTable).

Is it clear where I'm going wrong?

Tags (3)
0 Kudos
12 Replies
AdrianWelsh
MVP Honored Contributor

Thanks for mentioning where "r\" doesn't work. Python is a lot deeper than I once thought! (and a deal more complicated)

0 Kudos
DanPatterson_Retired
MVP Emeritus

The debate .... the options ....

Filenames and file paths in Python

DannyLackey
New Contributor II

This is related to the same effort, but specifically to the output...  If need to start a new post, let me know...

In the resulting .dbf file, its creating a decimal with trailing zeroes:

750050

becomes

750050.00000000000

How can I avoid this?

0 Kudos