I'm guessing from the description, you are running python in the shell buffer? It might make more sense to run python as a synchronous command, or at least use compile
to run python.
If you use compile
, I think it's easier to just bind a key to that, and then using C-x ` (command-next-error
) or M-g n, M-g p (next-error
, previous-error
) to jump through errors with the built in error parsing.
I just tested using the builtin python-mode
, and C-c C-c runs python-shell-send-buffer
which starts python and sends the buffer to it. The python shell appears to be error aware so repeatedly calling C-x ` will jump to each line with an error.
I'm not quite following what you mean by it "killing the previous output"? Are you trying to step through errors while simultaneously running the program again?