Another option is to create you own Pdb object, and set there the stdin and stdout. My proof of concept involves 2 terminals, but for sure some work can be merged some kind of very unsecure network server.
-
Create two fifos:
mkfifo fifo_stdin mkfifo fifo_stdout
-
In one terminal, open stdout on background, and write to stdin:
cat fifo_stdout & cat > fifo_stdin
-
In your python code/console create the pdb object, and use it:
import pdb mypdb=pdb.Pdb(stdin=open('fifo_stdin','r'), stdout=open('fifo_stdout','w')) ... mypdb.set_trace() ...
-
Profit!
You should be able to use pdb on the first console.
The only drawback is having to use your custom pdb, but some monkey patching at init (PYTHONSTARTUP or similar) can help:
import pdb
mypdb=pdb.Pdb(stdin=open('fifo_stdin','r'), stdout=open('fifo_stdout','w'))
pdb.set_trace=mypdb.set_trace