0

This error has puzzled me for days, as I can run this on my raster within Arcmap with no issues. My snippet of code is:

   # Process: Average FFPI cells to sub basins using Zonal Average technique 
   global workingdir workingdir = ("N:\\FFPI\\tempdir") if not
   os.path.exists(workingdir): os.makedirs(workingdir) 
   workingdir =  '/'.join(workingdir.split('\\')) + '/' global savingdir 
   savingdir = ("N:\\FFPI\\FFPIrasters") 
   savingdir = '/'.join(savingdir.split('\\')) + '/' 
   arcpy.env.workspace = arcpy.env.scratchWorkspace = workingdir
   print "Averaging FFPI grid to sub basins weighting scheme #1"

   avgFFPI1 = (ZonalStatistics(inZoneData, "PFAF_ID", (savingdir + "FFPIfinal1.tif"), "MEAN"))
   avgFFPI1.save("InitialBasinFFPI1.tif")
   FFPIasc = (r"N:\FFPI\FFPI.asc")
   BasinFFPIreclass = ReclassByASCIIFile("InitialBasinFFPI1.tif", FFPIasc)
   BasinFFPIreclass.save (savingdir + "BasinFFPI1.tif")

This is my error:

Traceback (most recent call last):
File "N:\FFPI\FFPIAutomationtest.py", line 260, in <module>
BasinFFPIreclass = ReclassByASCIIFile(workingdir + "InitialBasinFFPI1.tif", FFPIasc)
File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\sa\Functions.py", line 5651, in ReclassByASCIIFile
missing_values)
File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\sa\Utils.py",  line 53, in swapper
result = wrapper(*args, **kwargs)
File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\sa\Functions.py", line 5646, in Wrapper
missing_values)
File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\geoprocessing\_base.py", line 510, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 999999: Error executing function.
Failed to execute (ReclassByASCIIFile).
  • 1
    Unfortunately error 99999 means that something has happened that the developer didn't anticipate enough to write an error message for, not very helpful. Can you show us what's in (r"N:\FFPI\FFPI.asc") file? You say that it works in ArcMap but not in catalog, is this the case? It could be a problem with your workspace as the full path isn't given, try BasinFFPIreclass = ReclassByASCIIFile(avgFFPI1, FFPIasc) and see if that helps. – Michael Stimson Apr 22 '18 at 10:58
  • It works in ArcMap but not through outside python script. The .asc file looks like this: 0 1.4 : 1 1.4 2.4 : 2 2.4 3.4 : 3 3.4 4.4 : 4 4.4 5.4 : 5 5.4 6.4 : 6 6.4 7.4 : 7 7.4 8.4 : 8 8.4 9.4 : 9 9.4 20 : 10 It seems to choke up on float point values within the raster. If it change it to an integer based raster and re run it, it works fine. – Nick W Apr 23 '18 at 8:01
  • What is the value of workingdir? It seems your code doesn't match your error message.. there is a possibility that the intermediate '\\' is missed, consider using os.path.join(workingdir, "InitialBasinFFPI1.tif"), this should be intelligent enough that if the terminating backslash exists it won't add another but will ensure a backslash (or forward slash depending on OS) exists between the path components... still, I wouldn't run it on the file, I would use the existing raster avgFFPI1 - you may have already saved it but it still exists as a raster object ready to use! – Michael Stimson Apr 23 '18 at 22:06
  • I've included my working and saving dir paths in my code above. – Nick W Apr 24 '18 at 10:29
  • Try it without your path chaos. Starting from avgFFPI1 =... and specify correct paths manually, does it work then? – BERA Apr 24 '18 at 10:43

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.