[pypy-dev] pypy sandbox

Marius Gedminas marius at pov.lt
Tue Feb 24 17:18:33 CET 2009


On Sun, Feb 22, 2009 at 09:57:22PM +0200, Dalius Dobravolskas wrote:

> Here is diff how I have avoided this problem:
> 
> --- io/terminalwriter.py    (revision 62015)
> +++ io/terminalwriter.py    (working copy)
> @@ -31,7 +31,7 @@
>      if file is None:
>          file = sys.stderr
>      text = text.rstrip()
> -    if esc and sys.platform != "win32" and file.isatty():
> +    if esc and sys.platform != "win32" and 'isatty' in dir(file) and 
> file.isatty():

Please use hasattr(log, 'isatty') instead.

>          if not isinstance(esc, tuple):
>              esc = (esc,)
>          text = (''.join(['\x1b[%sm' % cod for cod in esc])  + 

Marius Gedminas
-- 
I am a computer. I am dumber than any human and smarter than any administrator.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20090224/39a3cd66/attachment.pgp>


More information about the Pypy-dev mailing list