Ascii Menu I/O redirection

2008-09-20 Thread Hendrik van Rooyen
I am writing a small application with a simple ascii based menu. The menu is used to test individual functions, and to change some timings. Otherwise the application just runs automatically, depending on command line options. I want to be able to redirect the menu. The console, a serial port,

Re: Ascii Menu I/O redirection

2008-09-20 Thread Steven D'Aprano
On Sat, 20 Sep 2008 23:14:26 +0200, Hendrik van Rooyen wrote: class console(object): This spoofs a single file like object, using stdout - in (Minimalistic proof of concept implementation) def __init__(self): self.read = sys.stdin.read self.readline =

Re: Ascii Menu I/O redirection

2008-09-20 Thread Hendrik van Rooyen
Steven D'Aprano [EMAIL PROTECTED] wrote: I'm not sure that closing stdin and stout are a good idea. This could have side-effects for other parts of your program, and will almost certainly end badly if you're running in the interactive interpreter. Its a very simple thingy - there will only