What is the Python equivalent of `set -x` in shell?

debugging, python, shell

Solution

You can use the trace module:

python -m trace -t your_script.py

The command line above will display every line of code as it is executed.

Problem

Please suggest Python command which is equivalent of `set -x` in shell scripts. Is there a way to print/log each source file line executed by Python?

Original source

Related problems