Redirecting sys.stdin

A

andy

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
 
A

andy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,661
Latest member
FloridaHan

Latest Threads

Top