Have you tried the filter options? “These options may be repeated multiple times. --ignore-module=<mod> Ignore each of the given module names and its submodules (if it is a package). The argument can be a list of names separated by a comma. --ignore-dir=<dir> Ignore all modules and packages in the named directory and subdirectories. The argument can be a list of directories separated by os.pathsep<https://docs.python.org/3/library/os.html#os.pathsep>.”
From: Python-list <python-list-bounces+gweatherby=uchc....@python.org> on behalf of Peter Slížik <peter.sli...@gmail.com> Date: Wednesday, February 15, 2023 at 12:22 PM To: python-list@python.org <python-list@python.org> Subject: Python: How to use the 'trace' module programmatically? *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** Hello, I'm trying to analyze complex Python code. For some specific reasons, I decided to use tracing instead of a debugger. The first thing I tried was: python -m trace -t /path/to/file.py The output of this command turned out to be completely useless. The reason is that there was a thread running in the background, doing some work every *0.1 s* and this generated thousands of lines of tracing information. The useful information (a reaction to my interaction with app GUI) scrolled away in a blink. For this reason, I decided to limit the scope of tracing. I did the following. The original code: def caller(): print("I'm the caller.") callee() def callee(): print("Callee here.") Code modified for tracing: import trace tracer = trace.Tracer( count=0, trace=1, ) def outer(): print("I'm the caller.") tracer.runfunc(inner) def inner(): print("Callee here.") Now I launched the program and the tracer did not generate any output. I was hoping that this would provide complete tracing information, but only for the limited scope of inner(). No success with tracer.run() either. What I was able to do, when I set count=1, I was able to catch the coverage data with tracer.results() and write them to a file. But the tracing information was not generated even in this case. Am I doing anything wrong? Peter -- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!m_WsH0rFVMLw4RMkVvcu-ZoClOMWVTsdB8E99Qy5Sq7ZZF1iBw5_NpLvorEe3_hYvy2kdDwe2obDr1E2ZjFCM3Of$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!m_WsH0rFVMLw4RMkVvcu-ZoClOMWVTsdB8E99Qy5Sq7ZZF1iBw5_NpLvorEe3_hYvy2kdDwe2obDr1E2ZjFCM3Of$> -- https://mail.python.org/mailman/listinfo/python-list