On Wed, Apr 18, 2012 at 12:59 AM, Edward d'Auvergne <edw...@nmr-relax.com> wrote: > Hi, > > Thanks for the incredibly quick responses! The os.isatty() call (and > sys.std*.isatty() calls as suggested by Chris Angelico at > http://mail.python.org/pipermail/python-list/2012-April/1291048.html) > work perfectly for this job! I might have to do some testing later on > Windows though to see what happens when the ansi escape characters are > not supported.
isatty() is supported on Windows (the underlying C API is different, but the beauty of a high-level language is that you no longer need to care), but the standard Windows console doesn't support ANSI sequences. I think there is a way to enable them, but I don't recall it off hand. However, if you can pipe your output through a socket connection, a MUD client can be your console. There are plenty around; RosMud [1] is a quite light-weight one that I wrote some years ago, and use constantly. Going for a MUD connection may feel a little weird, but it's pretty easy, and it gives you instant cross-platform networking capabilities. ChrisA [1] http://www.kepl.com.au/esstu/rosmud.html -- http://mail.python.org/mailman/listinfo/python-list