[Beginner question] Error when converting raster to ASCII

Becky Kern kern.ra at gmail.com
Mon Nov 15 17:06:45 CET 2010

Hi again users,

This is in response to my post from 11/14/2010 (see below)

>* Hi users,
*>* I'm using Python 2.5 (in concert with ArcGIS 9.3) to convert a raster to
*>* an ASCII file. I used the code (listed below) several weeks ago to
*>* successfully do the conversion, but when I tried to replicate it a few
*>* days ago, I got an error message.
*>* import arcgisscripting
*>* gp = arcgisscripting.create(9.3)
*>* InRaster = "C:/data/raster1"
*>* OutAsciiFile = "C:/data/raster2ascii.asc"
*>* gp.RasterToASCII_conversion(InRaster, OutAsciiFile)
*>* The error message:
*>* arcgisscripting.ExecuteError: Failed to execute. Parameters are not
*>* valid. raster1 does not exist.
*>* My file path has not changed so I don't understand why Python can no
*>* longer recognize my raster file. Any ideas?
MRAB responded:
Just to make sure, does os.path.isfile(InRaster) return True?

When I tried os.path.isfile(InRaster), I received the following error
"NameError: name 'os' is not defined"

Does this shed any light on why my raster to ASCII conversion isn't working?

Thanks again.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101115/3ae52a5b/attachment.html>

More information about the Python-list mailing list