# This file shows an example of getting the exception info if you # decide to catch 'except:' In general, you shouldn't do that, # catch the more specific types when you can. # # Much of this info is from: http://docs.python.org/lib/module-sys.html # # Dan Fleck # Spring 2008 def test(): valid = False # Is the number valid while not valid: try: myNum = input('Give me a number :') x = 10 / myNum valid = True except Exception, ex: # Catch any exception, but if you STILL want the info about it, # the easiest way is to just catch Exception (named) instead # of using except: print ex print '10 divided by your number is:', x valid = True test()