By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,100 Members | 2,495 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,100 IT Pros & Developers. It's quick & easy.

Redirecting sys.stdin

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.