Hello! Python by Anthony Briggs
Author:Anthony Briggs
Language: eng
Format: epub
Publisher: Manning Publications
But handling exceptions on servers doesn’t give you a lot of information about what went wrong. Especially in the case of critical production systems, it’s extremely helpful to know where the error occurred and in what file. You’d like to be able to see tracebacks as if you were running the program locally. Fortunately, there’s a Python module that can help you to print out detailed debugging messages and find out what when wrong: the traceback module.
The traceback module
The traceback module gives you a number of functions for handling exceptions as well as formatting and extracting tracebacks and error messages. The two key ones are print_exc() and format_exc(), which print out a traceback and return a traceback as a string, respectively. You can extract this information from the sys module, via sys.exc_type, sys.exc_value, and sys.exc_traceback, but it’s much more straightforward to use traceback. Let’s extend the error handling in the last section to print out a nice traceback if you get an unknown error, as shown in the following listing.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9654)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9575)
The Mikado Method by Ola Ellnestam Daniel Brolund(9553)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8080)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7597)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7596)
Grails in Action by Glen Smith Peter Ledbrook(7511)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7325)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6224)
Windows APT Warfare by Sheng-Hao Ma(5259)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(4985)
Kotlin in Action by Dmitry Jemerov(4864)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(4832)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4171)
Functional Programming in JavaScript by Mantyla Dan(3882)
Solidity Programming Essentials by Ritesh Modi(3132)
Mastering Python for Finance by Weiming James Ma;(2979)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(2968)
Learning Java by Patrick Niemeyer & Daniel Leuck(2958)