I'm trying to do intersect with 2 shapes, but it's not working because it can't read my shapefiles... I don't know why, because when i ran it with my other script, it works perfectly!

Traceback (most recent call last): File "Z:\04 - Temp\Charles\Teste_python\new toolbox.tbx#Script_newtoolbox.py", line 106, in File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\analysis.py", line 335, in Intersect raise e File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\analysis.py", line 332, in Intersect retval = convertArcObjectToPythonObject(gp.Intersect_analysis(*gp_fixargs((in_features, out_feature_class, join_attributes, cluster_tolerance, output_type), True))) File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing_base.py", line 506, in return lambda *args: val(*gp_fixargs(args, True)) arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Features: Dataset 'Z:\04 - Temp\Charles\NDVI_tempo\NAL\Zonalpoly.shp' #;MA02ASEZ3S.shp # does not exist or is not supported Failed to execute (Intersect). Failed to execute (Script).

NDVI_tiff = Divide (Rastdiv1, Rastdiv2)

            Per_tiff = Times (NDVI_tiff, 100)

            fc_rast = 'Z:\\04 - Temp\\Charles\\NDVI_tempo\\NAL\\fc_rast.tif'

            Zonal_tif = ZonalStatistics(fc_rast, "ID_TALHAO", Per_tiff, "MEAN", "DATA")

            Zonalint = Int (Zonal_tif)

            arcpy.RasterToPolygon_conversion (Zonalint, 'Z:\\04 - Temp\\Charles\\NDVI_tempo\\NAL\\Zonalpoly', "SIMPLIFY", "VALUE")

            Zonalpoly = 'Z:\\04 - Temp\\Charles\\NDVI_tempo\\NAL\\Zonalpoly.shp'

            inFeatures = [Zonalpoly, fc]

            arcpy.Intersect_analysis(inFeatures, 'Z:\\04 - Temp\\Charles\\NDVI_tempo\\NAL\\intershp.shp', "","", "")

This is the script, where "fc" is each shapefile in my workspace... It reads the name of the file (MA02ASEZ3S.shp), but the error 000732 seems to warn that something is wrong...

And this is how the fc variable is declared

down = 'Z:\04 - Temp\Charles\NDVI_tempo\NAL_PL' image_server = 'Y:\E - IMAGEM SERVER\IMAGEM_SERVER.gdb\F02_RAPIDEYE'

arcpy.env.workspace = 'Z:\04 - Temp\Charles\NDVI_tempo\NAL_PL' fcs = arcpy.ListFeatureClasses()

for fc in fcs:

    arcpy.DownloadRasters_management (image_server, down, "", fc, "CLIPPING", "CONVERT_AS_REQUIRED", "TIFF", "NONE", "", "NO_MAINTAIN_FOLDER")

    arcpy.PolygonToRaster_conversion (fc, "ID_TALHAO", 'Z:\\04 - Temp\\Charles\\NDVI_tempo\\NAL\\fc_rast.tif')
  • Show how you declare the fc variable – BERA Oct 2 '17 at 19:44
  • Updated, i used the fc in the beginning, i didn't paste it here because my script has 120 lines – Charlera Oct 2 '17 at 19:52
  • Try adding r in front of workspace path: arcpy.env.workspace = r'Z:\04 - Temp\Charles\NDVI_tempo\NAL_PL'. Have you printed out fcs to make sure it looks ok (print fcs)? – BERA Oct 2 '17 at 19:55

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.