Esri / arcgis-python-api

Documentation and samples for ArcGIS API for Python
https://developers.arcgis.com/python/
Apache License 2.0
1.89k stars 1.1k forks source link

Failed to execute (Clip) #1921

Closed domist07 closed 2 months ago

domist07 commented 2 months ago

Describe the bug I want to clip a raster by a geometry. The last days all works fine. Today I become this error.

To Reproduce I load a raster and a polygon. Both are valid. Afterward I execute:

import arcpy

raster.extent.contains(geom)  # True

clip_path = arcpy.CreateUniqueName(
    "clip",
    arcpy.env.scratchGDB,
)
arcpy.Clip_management(
    raster,
    "#",
    clip_path,
    geom,
    "0",
    "ClippingGeometry",
    "MAINTAIN_EXTENT",
)

error:

  File "", line 85, in clip
    arcpy.Clip_management(
  File "C:\Users\USERNAME\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcPy\arcpy\management.py", line 19512, in Clip
    raise e
  File "C:\Users\USERNAME\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcPy\arcpy\management.py", line 19509, in Clip
    retval = convertArcObjectToPythonObject(gp.Clip_management(*gp_fixargs((irgs((in_raster, rectangle, out_raster, in_template_dataset, nodata_valupping_e, clipping_geometry, maintain_clipping_extent), True)))
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USERNAME\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the the tool to fail. Contact Esri Technical Support (http://esriurl.com/s) to Rupport) to Report a Bug, and refer to the error help for potential solukarountions or workarounds.
Failed to execute (Clip).

Platform (please complete the following information):

Additional Information If I execute the code in ArcGIS Pro and not in the console (with activated arcgis env) all works fine.

achapkowski commented 2 months ago

Please reach out to support for arcpy issues. Thank you.