Redirecting sys.stdin
andy at britishideas.com
andy at britishideas.com
Thu Nov 15 18:39:11 EST 2007
On Nov 15, 4:09 pm, a... at britishideas.com wrote:
> Can anyone tell me what I am doing wrong with the following code? When
> python 2.4 is embedded it crashes because of the assignment to stdin.
>
> import sys;
>
> class RedirectB:
> def readline(self):
> return "bar";
>
> sys.stdin = RedirectB();
Seems the interpreter didn't like me using one class to redirect
stdout and stderr and another class to redirect stdin. Sigh.
Andy
More information about the Python-list
mailing list