Trying to run this file in eclipse
class Try:
def __init__(self):
pass
def __del__(self):
print 1
a=Try()
raw_input('waiting to finish')
and pressing the stop button without letting the program finish doesn't print "1", i.e the del method is never called. If i try to run the script from the shell and do ctrl-c\sys.exit "1" does get printed i.e del is called. Same thing if I try to use wait():
class A:
def __enter__(self):
return None
def __exit__(self, type, value, traceback):
print 3
with A():
print 1
raw_input('Waiting')
print 2
If i press "stop" when prompted, "3" isn't printed
Why is that? Is there a way around it?
Thanks, Noam