471,353 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,353 software developers and data experts.

Redirecting sys.stdin

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

Thanks! Andy
Nov 15 '07 #1
1 1791
On Nov 15, 4:09 pm, a...@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

Nov 15 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jan Knop | last post: by
5 posts views Thread by Jon Arter | last post: by
1 post views Thread by aurora | last post: by
reply views Thread by Christophe HELFER | last post: by
6 posts views Thread by Christophe Helfer | last post: by
3 posts views Thread by Jan Danielsson | last post: by
8 posts views Thread by Morpheus | last post: by
4 posts views Thread by DyslexicAnaboko | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.