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

Discussion in 'Python' started by carl.dhalluin@gmail.com, Jul 25, 2007.

  1. Guest

    Hi

    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
    startRemoteDebugging()

    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, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jan Knop
    Replies:
    4
    Views:
    1,116
    Jan knob
    Nov 24, 2003
  2. Matthew Thorley

    Redirecting stdout and stdin

    Matthew Thorley, Mar 4, 2004, in forum: Python
    Replies:
    2
    Views:
    774
    Donn Cave
    Mar 4, 2004
  3. Michael McGarry
    Replies:
    1
    Views:
    646
    Michael Fuhr
    Dec 16, 2004
  4. Replies:
    2
    Views:
    691
    velle
    Jan 5, 2006
  5. Elad
    Replies:
    0
    Views:
    437
Loading...

Share This Page