470,620 Members | 1,504 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,620 developers. It's quick & easy.

Interactive remote debugging by redirecting sys.stdin and sys.stdout to a socket or pipe


I want a simple way to interactively remote debug a running python
script which has no tty terminal attached to it. The scripts are
running standalone (i.e. they are automatically started and have no
terminal) and very infrequently come into error conditions which i
want to understand and debug. The idea is that I do the debugging as
shown below.

Is that a good way of solving my problem? Do I need anything special
for terminal emulation? What type of client should I use? I want
things like tab completion and syntax coloring of ipshell (or similar)
to work.

if <condition>:
# If I come here I did something wrong. Send an event or email
that the failure has happened

def startRemoteDebugging():
# open a TCP listen socket and start listening
# as soon as someone connects to the socket, do authentication
check (e.g. username/pwd)
# redirect sys.stdin and sys.stdout to the socket
# start interactive python e.g. ipython ipshellembed()
# put sys.stdin and sys.stdout back to what they were
# debugging session is done

Jul 25 '07 #1
0 1176

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Avi Berkovich | last post: by
3 posts views Thread by David Douard | last post: by
1 post views Thread by Pravin Prabhu | last post: by
8 posts views Thread by Jim B. Wilson | last post: by
2 posts views Thread by Diez B. Roggisch | last post: by
reply views Thread by Gabriel Genellina | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.