Does anyone know how to prevent the debugger from entering external code?
Yes, Dmitry Trofimov knows ;
(...) add modules that you do not want to trace to dict DONT_TRACE in <pycharm-distr>/helpers/pydev/pydevd.py
This is a hacker solution (...)
If you want this feature to be less hacked, you can vote for it by visiting the issue
PY-9101 Embed the Do Not Join Classes option for the Python debugger
Those using pdb may be interested to find out if there is such a function in pdb;
Starting in Python 3.1, the Pdb class has a new skip argument -
class pdb.Pdb(completekey='tab', stdin=None, stdout=None, skip=None, nosigint=False)
The skip argument, if given, should be an iterable module of glob-style name templates. The debugger will not enter frames that occur in a module that matches one of these patterns. one
1 Regardless of whether the frame is considered to be the source in a particular module, defined by __name__ in global frames.
The example in the docs shows how to skip Django packages -
import pdb; pdb.Pdb(skip=['django.*']).set_trace()
Piotr dobrogost
source share