mwbeckumn

grid output in python script

Discussion created by mwbeckumn on Feb 10, 2011
Greetings,

I've recently updated to v10 and have been changing a python model to accommodate some of the new(?) arcpy geoprocessor formats (was previously using arcgisscripting in v9.2).  I'm having some issues with some of the functions that require a separate command for saving output.  Such as...

extout = ExtractByMask(....)
extout.save(....)

The second command that specifies the output has been temperamental.  In my model, I use concatenated strings to specify the output, such as...

extout.save(path + label + "_1")

...where, for example, path = "C:/files/GIS/", label = "file", therefore path + label + "_1" returns "C:/files/GIS/file_1".  Sometimes this works, sometimes it doesn't.  When I type out the full path and file name and use that as the output argument it works fine but I don't want to do this this since I'm running the model in a for loop with different files each time.

The most common error message I receive is some complaint about the output file being longer than the allowed length for grid files.  For example...

Executing: ExtractByMask "C:/Projects/GIS data/OBIA nearshore/Docks/130027" "C:/Projects/GIS data/OBIA nearshore/Docks/13002700_temp3.shp" "C:\Projects\GIS data\OBIA nearshore\Docks\Extract_13001"
Start Time: Thu Feb 10 20:25:18 2011
Failed to execute. Parameters are not valid.
ERROR 000879: Output raster: The length of the stack base name in C:\Projects\GIS data\OBIA nearshore\Docks\Extract_13001 is longer than 9.
Failed to execute (ExtractByMask).

The geoprocessor tries to make its own name for the output file since it doesn't recognize my input, which of course fails because it's longer than 9.  Is there anything I'm doing wrong here? How can I make this work without typing out the full path name?

Thanks,

Marcus

Outcomes