PythonWin; ArcGIS 10.3
I'm trying to implement an exit function that was posted on another site (http://gis.stackexchange.com/questions/1015/how-to-have-a-python-script-self-terminate-in-arcmap10), but it's not working...
# Create function to exit script
def finish(arg=None):
try:
sys.exit(arg)
except SystemExit:
pass
# Check for nodata (Note: Shapefiles don't support nodata - ArcGIS turns them into zeroes)
if pHx10 == 0:
print "The point you selected is water or otherwise undefined"
finish()
else:
print "Point's data is defined"
When I input a point that's associated with nodata (i.e. pHx10==0)... the script doesn't exit.
Also... there must be a way to end the else statement without using a print statement. Break and continue are used in while and for statements. So what do you use for an if statement?
I'm new to ArcGIS and don't know Python.