I know that I can use this to trace the command execution:
python -m trace -t script.py
But I want to reduce the output: Only files which are in my src/ (pip install -e ...) should be shown.
How can I do this?
If you are running script from bash
you can use something like:
python -m trace --ignore-dir=$(python -c 'import sys ; print ":".join(sys.path)[1:]') -t ./script.py
for python3:
python -m trace --ignore-dir=$(python -c 'import sys ; print(":".join(sys.path)[1:])') -t ./script.py
In this way you can ignore if you are or not in a virtual environment or a more esoteric scenario.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With