Select to view content in your preferred language

Error code 000229 after running script

1258
4
09-26-2018 08:35 AM
JimFritz
Regular Contributor

In the attached script I'm getting an "ERROR 000229".  I have attached the script.  Please note that the line of code to run the clip to raster is not part of the script yet.

Thanks,

Jim

import arcpy
arcpy.env.overwriteOutput = 1
arcpy.env.workspace = r"S:\General-Offices-GO-Trans\SLR-Mapping\GIS_Projects_2018\Smart_T_Line_Model\geodata\TEST_LINES.gdb"
outbufferpath = r"S:\General-Offices-GO-Trans\SLR-Mapping\GIS_Projects_2018\Smart_T_Line_Model\geodata\TEST_BUFFER.gdb"
outrasterpath = r"S:\General-Offices-GO-Trans\SLR-Mapping\GIS_Projects_2018\Smart_T_Line_Model\geodata\TEST_RASTERCLIP.gdb"
raster = r"S:\General-Offices-GO-Trans\SLR-Mapping\GIS_Projects_2018\Smart_T_Line_Model\geodata\STLM_NSP.gdb\MN_DEM3second"
featureClassList = arcpy.ListFeatureClasses()
for featureClass in featureClassList:
    arcpy.Buffer_analysis(featureClass, outbufferpath, "1250 Feet", "FULL", "ROUND")
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\analysis.py", line 1098, in Buffer
    raise e
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\analysis.py", line 1095, in Buffer
    retval = convertArcObjectToPythonObject(gp.Buffer_analysis(*gp_fixargs((in_features, out_feature_class, buffer_distance_or_field, line_side, line_end_type, dissolve_option, dissolve_field, method), True)))
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 496, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 000229: Cannot open T_0517__BRI_DJS_TP_34_5_1
Failed to execute (Buffer).
0 Kudos
4 Replies
JoshuaBixby
MVP Esteemed Contributor

Add an

import os

at the beginning on your script and change line 9 to:

arcpy.Buffer_analysis(os.path.join(arcpy.env.workspace, featureClass), outbufferpath, "1250 Feet", "FULL", "ROUND")

 

0 Kudos
JimFritz
Regular Contributor

Joshua,

The script ran without an error but I did not see new features created in the outbufferpath folder.

Thanks,

Jim

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Buffer is expecting a feature class path, not a file geodatabase path.  You have to give a path that includes the name of a feature class in your file geodatabase.

arcpy.Buffer_analysis(os.path.join(arcpy.env.workspace, featureClass), os.path.join(outbufferpath, featureClass + "_buffer"), "1250 Feet", "FULL", "ROUND")
JoshuaBixby
MVP Esteemed Contributor

Jim Fritz‌, if my follow-up comment addressed your issue, please mark the comment as the correct answer to close out this thread.