Search Cursor python functionality in gp package

Discussion created by shaun_weston-eagle-co-nz-esridist on Jun 25, 2012
Latest reply on Jun 27, 2012 by shaun_weston-eagle-co-nz-esridist
So, I'm trying to run a gp package, which has arcpy.searchcursor functionality in it.

When I run the gp package through the REST interface it runs fine - http://localhost.:50000/arcgis/rest/services/calculatestrategy/GPServer/Calculate%20Strategy/execute

owever running it in the application of built with the runtime produces this error:

"error":{"code":400,"message":"Unable to complete operation.","details":["Error executing tool.: \nTraceback (most recent call last):\n File \"C:\Documents\ArcGIS\Packages\CalculateStrategy2\v101\data\\", line 62, in \u003cmodule\u003e\n arcpy.SetParameterAsText(1, float(Before_Loss))\nNameError: name 'Before_Loss' is not defined\n\nFailed to execute (CalculateStrategy).\nFailed to execute (Calculate Strategy).\nFailed to execute (Calculate Strategy)."]}}

Now it's linked to this line of code I've got here:

rows = arcpy.SearchCursor(SelectedStrategy_Loss)
for row in rows:
Before_Loss = row.Before_nLoss
After_Loss = row.After_nLoss

Because if I take it out, it runs fine through the application. So It's obviously to do with the arcpy.SearchCursor functionality. Is this supported with the runtime? or am I doing something wrong here?