python - Using fidSet to test for existing selection not working for me -
very first post stack exchange. using argis desktop standard 10.4.1 python 2.7.11. self-taught python scripter.
i'm pulling hair out here, , there's precious little of begin with. i've researched extensively there doesn't appear newer 2014. trying test if feature layer has selection or not. i'm doing via own python script in arctoolbox. happening length of len(arcpy.describe(lyr).fidset.split(";")) when no features selected returning 1. below simple code:
arcpy.addmessage(len(arcpy.describe(lyr).fidset.split(";"))) arcpy.addmessage(arcpy.describe(lyr).fidset.split(";")) if len(arcpy.describe(lyr).fidset.split(";")) > 0: arcpy.addmessage("has selection") else: arcpy.addmessage("no selection") if 0 feature selected returns
1 [u''] has selection if 1 feature selected returns
1 [u'5'] has selection if more 1 feature selected returns
9 [u'1', u' 2', u' 3', u' 4', u' 5', u' 6', u' 7', u' 8', u' 9'] has selection i've tried testing returned string is none , putting not in front of length statement, still return has selection when no features selected. guidance here appreciated.
Comments
Post a Comment