[GIS] arcpy.RegionGroup fails with error 999999. Workspace or data source is read only

arcgis-10.0arcgis-desktoparcpyerror-999999spatial-analyst

outRegionGrp = RegionGroup(inRaster,"EIGHT", "WITHIN", "ADD_LINK", valToIgnore)

arcgisscripting.ExecuteError: ERROR 999999: Error executing function.
Workspace or data source is read only.
The table was not found. [VAT_RegionG_Con_1]
A column was specified that does not exist.
The table was not found. [VAT_RegionG_Con_1]
The operation was attempted on an empty geometry.
ERROR 010274: Error in writing to table.
ERROR 010067: Error in executing grid expression.
Failed to execute (RegionGroup).

While workspace is at c drive, this error occurs. But while workspace is at other drives, this error does not happen.

import arcpy
from arcpy import env
from arcpy.sa import *  

env.outputCoordinateSystem = spatialReferance
env.scratchWorkspace = workspacePath
env.workspace = workspacePath

try:
    checkExtensionStatus = arcpy.CheckExtension("Spatial")

    if checkExtensionStatus != "Available" :
        raise LicenseError(checkExtensionStatus)

    checkOutExtensionStatus = arcpy.CheckOutExtension("Spatial")

    if checkOutExtensionStatus != "CheckedOut" :
        raise CheckOutExtensionException(checkOutExtensionStatus)

    outRegionGrpRaster = RegionGroup(inRaster, "EIGHT", "WITHIN", "ADD_LINK", inputFalseConstantValue)
finally:
    arcpy.CheckInExtension("Spatial")

Best Answer

If this problem occurs for some raster files and others not, you might check the length of the name of the raster file. I remember also having that problem, but I don't remember if the magic name length was 8,11 or 13 characters. I know it sounds odd these days to have short names, but nevertheless might be worth to test.