Con in arcPy fails where the Con tool  in ArcMap succeeds

Discussion created by tooniron on Sep 26, 2013
Latest reply on Sep 26, 2013 by tooniron

I'm new to python, so apologies if i'm missing something obvious.

I have a raster that was created from a text file, using MakeXYEventLayer_management (using British National Grid Spatial Reference) and FeatureToRaster_conversion (1000m cell size).  It displays fine in ArcMap.

Using the Con tool (ArcToolbox - Spatial Analyst Tools - Conditional) in ArcMap, with the raster mentioned above as the input, "VALUE >= 150" as the Expression, 1 as the true value, the false value left blank, and just accepting the default output raster, it works, the cells over 150 have value of 1 and the other cells are not included in the output raster.

In my arcPy script, which has worked with other raster files (one noteable difference is these other rasters were integer rasters, whereas the raster created above is a floating point raster), the following line is failing:

MaskRaster = Con(Raster(RasterLayer),1,"", "VALUE>={0}".format(ThresholdValue))

I get the following error
ERROR 010416: Error in setting raster table filter

Any help would be gratefully received