Ascii to Raster Conversion help

Discussion created by parsonz on Oct 24, 2011
Latest reply on Oct 11, 2012 by wkirkendall
Hope someone can help - I've written this script several times in the past but unfortunately my laptop is being serviced and I forgot to backup my python scripts directory - ~DOH :o

Anyway, this should be really simple - I'm looping through some ascii files in a directory and converting them to a raster.  However, Python returns the error - Failed to execute (ASCIIToRaster).
I know the ascii file is there as I have manually converted in toolbox and its fine.  I've posted the code below.

# Import arcpy module
import arcpy
from arcpy import env

# Local variables:
env.workspace = "C:/Data/asc"
outputraster = raster.rstrip("dtm.asc")
datatype = "FLOAT"

#Get a list of ascii files
rasterList = arcpy.ListRasters()

for raster in rasterList: