How to print each line of a script as it is run only for the top-level script being run?
问题 python's trace module will allow you to run a script printing each line of code as it is run in both the script and all imported modules like so: python -m trace -trace myscript.py Is there a way to do the same thing, but only print the top-level calls, i.e. only print the lines in myscript.py as they are run? I am trying to debug an abort trap failure and I can't figure out where it's dying. Unfortunately, using the full --trace takes forever - the script normally takes 2-3 minutes to run,