hsiddique

Script to convert ASCII to raster not working

Discussion created by hsiddique on Jun 20, 2011
Latest reply on Jun 21, 2011 by lpinner
Hi all,

I have a bunch of asc file in a folder, and have written python to go though each .asc and convert it but nothing seems to happen.

Code is below
import arcgisscripting
gp = arcgisscripting.create(9.3)

inFolder = "C:/asc/DSM_2m_ASC//"
outRast = "C:/asc/"

try:
    
    for ascii in inFolder:
        if ascii.endswith(".asc"):
            outRast = ascii[:-4]
            gp.ASCIIToRaster_conversion(ascii, outRast, "INTEGER")
            print ascii
            print outRast
except:
    print gp.getmessages()



Any ideas on where i am going wrong, I'm a  beginner in python but also haven't done it for a few months.

Cheers

Outcomes