No 3rd party stuff...I found this simple code reproduces the issue:import arcpy
inLayer = arcpy.GetParameterAsText(0)
oidFieldName = arcpy.Describe(inLayer).oidFieldName
oidDict = dict([(r[0], -1) for r in arcpy.da.SearchCursor(inLayer, ["OID@"])])
arcpy.MakeFeatureLayer_management(inLayer, "fl1")
try:
nextOidSeedValue = (key for key,value in oidDict.items() if value == -1).next()
except:
pass
arcpy.SelectLayerByAttribute_management("fl1", "NEW_SELECTION", oidFieldName + " = " + str(nextOidSeedValue))
selectedSet = set([r[0] for r in arcpy.da.SearchCursor("fl1", ["OID@"])])
arcpy.AddMessage("Selected set is: " + str(selectedSet))
When this is set up as a script tool and is run "in-process" or as a stand alone script with a hardcoded inLayer variable it works fine...However, if it is not run as a script tool "out-of-process" if will fail on the line:selectedSet = set([r[0] for r in arcpy.da.SearchCursor("fl1", ["OID@"])])
With the error:Python Traceback Info: File "C:\csny490\temp\ideas\selection_reprod.py", line 20, in <module>
selectedSet = set([r[0] for r in arcpy.da.SearchCursor("fl1", ["OID@"])])
Python Error Info: <type 'exceptions.RuntimeError'>: cannot open 'fl1'