Fix Python – Showing the stack trace from a running Python application

I have this Python application that gets stuck from time to time and I can’t find out where.
Is there any way to signal Python interpreter to show you the exact code that’s running?
Some kind of on-the-fly stacktrace?
Related questions:

Print current call stack from a method in Python code
Check what a running process is doing: print stack trace….

Fix Python – Get exception description and stack trace which caused an exception, all as a string

I’ve seen a lot of posts about stack trace and exceptions in Python. But haven’t found what I need.
I have a chunk of Python 2.7 code that may raise an exception. I would like to catch it and assign to a string its full description and the stack trace that caused the error (simply all we use to see on the console). I need this string to print it t….