level of the python process and run python' default exception-handling logic ( python terminates the running program and prints standard error messageto illustraterunning the following module filebad pygenerates divide-by-zero exceptiondef gobad(xy)return def gosouth( )print(gobad( )gosouth( because the program ignores the exception it triggerspython kills the program and prints messagepython bad py traceback (most recent call last)file "bad py"line in gosouth( file "bad py"line in gosouth print(gobad( )file "bad py"line in gobad return zerodivisionerrordivision by zero ran this in shell window with python the message consists of stack trace ("traceback"and the name of and details about the exception that was raised the stack trace lists all lines active when the exception occurredfrom oldest to newest note that because we're not working at the interactive promptin this case the file and line number information is more useful for examplehere we can see that the bad divide happens at the last entry in the trace--line of the file bad pya return statement because python detects and reports all errors at runtime by raising exceptionsexceptions are intimately bound up with the ideas of error handling and debugging in general if you've worked through this book' examplesyou've undoubtedly seen an exception or two along the way--even typos usually generate syntaxerror or other exception when file is imported or executed (that' when the compiler is runby defaultyou get useful error display like the one just shownwhich helps you track down the problem oftenthis standard error message is all you need to resolve problems in your code for more heavy-duty debugging jobsyou can catch exceptions with try statements as mentioned in the prior the text of error messages and stack traces tends to vary slightly over time and shells don' be alarmed if your error messages don' exactly match mine when ran this example in python ' idle guifor instanceits error message text showed filenames with full absolute directory paths the try/except/else statement