Select to view content in your preferred language

arcpy.Describe bug when called on GRID raster from Script tool

748
2
07-25-2012 09:36 AM
LT
by
Regular Contributor
Hi Folks,

I just came across a problem with arcpy.Describe.  It's in a simple script to list the files in a directory and summarize the content.  I use arcpy.Describe to determine the data type for each file.

When I run the script as stand-alone, all is fine.  It describes every file.  But when I add it to a toolbox and call it as a script tool, I get the error below if the directory contains a raster ESRI GRID file.  It seems to do okay on other raster types, like jpg.

This line of code throws the error: 
desc = arcpy.Describe(f)


  File "C:\Users\xxxxxxxx\DOCUME~1\EXAMPL~1\inventory.py", line 32, in
<module>
    desc = arcpy.Describe(f)
  File "c:\program files (x86)\arcgis\desktop10.1\ArcPy\arcpy\__init__.py", line
1190, in Describe
    return gp.describe(value)
  File "c:\program files (x86)\arcgis\desktop10.1\ArcPy\arcpy\geoprocessing\_bas
e.py", line 374, in describe
    self._gp.Describe(*gp_fixargs(args, True)))
RuntimeError: ERROR 999999: Error executing function.

The file that broke it is the first ESRI GRID file in the directory.  Have tested a number of other types which work.

Has anyone else seen this problem?    Is somebody working on fixing this?

Thanks!
0 Kudos
2 Replies
MathewCoyle
Honored Contributor
It depends how you listed your files and passed your variable to the describe tool. If you used anything but arcpy.ListRasters() or arcpy.ListDatasets it won't work as Esri Grids are stored as folders not files. I'm not sure why it would work as stand alone and not in a script tool.
0 Kudos
LT
by
Regular Contributor
Hi Mathew,

I still don't know why it didn't work, but I ran it again on the same machine a few days later and it did. 
In fact, I would probably doubt my memory if I hadn't documented the problem in this posting. 
Maybe a locking issue?  I changed nothing in the script!

thanks for the response. It's nice to hear from someone. 🙂
0 Kudos