[Tutor] Telnetlib
alan.gauld@bt.com
alan.gauld@bt.com
Mon, 5 Aug 2002 12:25:34 +0100
> > > default to sys.stdout. Is there a way to redirect to a
> file? I can't find this in the documentation. Perl's Telnet module
> allows to do this
If you are on *nix you can use the normal shell
redirection when you invoke the script:
Bash/Ksh:
$ python myscript.py 2> errors.txt
[t]csh is a tad more difficult - ie I can't remember ;-)
However if you want to do it in a more consistent/controllable
manner Danny's advice aboput changing sys.stderr is probably
the way to go.
> Yes, there's a way of redirecting standard error. One way is to
> temporarily set 'sys.stderr' out to another file, like this:
Alan G.