Redirecting sys.stdin

andy at britishideas.com andy at britishideas.com
Thu Nov 15 18:09:52 EST 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