To open a debugger 'post mortem', after an error hits the top level: When running interactively: call patdb.debug() after the error has returned you to the REPL. (Or ...