I have a function called by the main program:
try:
someFunction()
except:
print \"exception happened!\"
but in the middle of the ex
You usually should not catch all possible exceptions with try: ... except
as this is overly broad. Just catch those that are expected to happen for whatever reason. If you really must, for example if you want to find out more about some problem while debugging, you should do
try:
...
except Exception as ex:
print ex # do whatever you want for debugging.
raise # re-raise exception.