kazendar

Uunable to use 'arcpy.env.workspace' properly !

Discussion created by kazendar on Apr 1, 2012
Latest reply on Apr 11, 2012 by dkwiens
arcpy.env.workspace doest not work when we use barename for input file ?

# arcpy10.py
# CPython 2.6, ArcGIS 10, IDLE, windows_XP

import arcpy, sys
import arcpy.mapping
from arcpy import env
arcpy.env.overwriteOutput = True

arcpy.env.workspace = "d:\\test"

# Fullpath of input file.
arcpy.FloatToRaster_conversion(
"d:\\test\\14605430.flt",
"14605430.tif")

try:
# No fullpath of input file.
arcpy.FloatToRaster_conversion(
"14605430.flt",
"14605430.img")

except:
print arcpy.GetMessages()
sys.exit()


"""
Converting floating point file to grid ...
Executing: FloatToRaster 14605430.flt d:\test\14605430.img
Start Time: Sun Apr 01 12:58:49 2012
Failed to execute. Parameters are not valid.
ERROR 000865: Input floating point raster file: 14605430.flt does not exist.
Failed to execute (FloatToRaster).
Failed at Sun Apr 01 12:58:49 2012 (Elapsed Time: 0.00 seconds)
"""

Outcomes