I am used to the following in Java:
try {
// something bad happens here
} catch (SomeException se) {
se.printStackTrace(); // let's me print the stack trace
System.out.println(se); // let's me print and inspect the exception
throw se; // I can re-throw it or wrap it and throw it
}
I am having a really hard time linking this to Pythons
try:
pass # do something
except ExceptionClass1:
print("OK I know I caught an ExceptionClass1 type exception")
# but how do I get to the stack trace
# how do I get to the object of the exception
python print exception stack traceinto a search engine, orpython exception handling tutorial.python print exception stack trace. The second result was the official documentation for thetracebackstandard library module, as in the answer you accepted. The first result is from a tutorial site with worked examples and detailed explanation. How did any of those fail to help you?