redirecting output

Steve Holden sholden at holdenweb.com
Wed Jan 31 19:18:59 EST 2001


"Jp Calderone" <jcaldero at ic.sunysb.edu> wrote in message
news:3A789343.48002B2C at ic.sunysb.edu...
>
>
>   I've attached the python interpreter to a server,
> essentially letting people connect to the given address
> and port and pump stuff into it.  What I can't figure out
> is how I might go about redirecting the output from some
> of the builtin functions - dir(), print, etc, to their
> socket.  Is this possible?
>
Interesting idea, with some interesting security aspects!
The dir() function doesn't do any output: it just produces a list.

"print", of course, isn't a statement... but you should be able to
redirect its output by binding sys.stdout to the socket for the duration
of the session.

>  Thanks in advance,
>    Jp
>
regards
Steve





More information about the Python-list mailing list