Redirecting sys.stdin

andy at andy at
Fri Nov 16 00:09:52 CET 2007

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

More information about the Python-list mailing list