AnsweredAssumed Answered

If statement not working

Question asked by ledwith on Dec 1, 2010
Latest reply on Dec 6, 2010 by csny490
I've written a script to extract (via clip) data from a database. As part of the script I want to delete the outputs that are empty. The outputs are feature classes that are in a feature dataset that's in a personal gdb.

I had a script that worked in 9.3 and updated it to 10.0 but it doesn't seem to work. Here's the relevant part of the script:

initial statements etc.
...
for inObj in inObjs:
    some more processing and irrelevant code
    ...
    arcpy.Clip_analysis(inDBF, clipFile, outDBF)
    result = arcpy.GetCount_management(outDBF)
    if result == 0:
        print outDBF + " is empty."
        arcpy.Delete_management(outDBF)
    ...
    more processing and irrelevant code

The entire script works fine except that the empty outputs don't get deleted. I've debugged a little and can confirm that the values in the variable "result" are indeed from 0 to [whatever]. But the "if" statement doesn't run. Am I missing something?

Any help or tips are greatly appreciated.

/Michael

Outcomes