I am trying to export a table from a mxd using arcpy. I need a comma delimited .txt file. I believe the CopyRows_management function should work, however I always get a cannot create output error number 000210.
# new 6_ export script
import arcpy, os
finalFolder = r"C:\workspace\CRAI_outside_finalDeliv\SectionA"
# intermediate variables:
GISMXD = os.path.join(finalFolder, "4_ArcGIS_Map_Documents\SectionA.mxd")
folder6_hvl = os.path.join(finalFolder, "6_GPS_Horizontal_Vertical_Location")
txtFilePath = os.path.join(folder6_hvl, "SectionA_SiteMarker_WGS84_DD.txt")
GISMapDoc = arcpy.mapping.MapDocument(GISMXD)
DF = arcpy.mapping.ListDataFrames(GISMapDoc)[0]
GsMPLay = arcpy.mapping.ListLayers(DF)[0]
# I consistently get an error 000210 cannot create output on the next line. Can't figure out why.
arcpy.CopyRows_management(GsMPLay, txtFilePath)
del DF
del GISMapDoc
Ultimately I want to be able to do something like what is done in this question: Copy, not export, a table from Arcmap but using arcpy. The full error message is:
Runtime error Traceback (most recent call last): File "<string>", line 15, in <module> File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 15215, in CopyRows raise e ExecuteError: ERROR 000210: Cannot create output C:\workspace\CRAI_outside_finalDeliv\SectionA\6_GPS_Horizontal_Vertical_Location\SectionA_SiteMarker_WGS84_DD.txt Failed to execute (CopyRows).
I'm using Arc 10.3, python 2.7.