colorama
colorama copied to clipboard
Adjust exception handling in `isatty()`
Hi. Thanks for the great work!
We had an issue reported on Django, where colorama.init()
was triggering an error with mod_wsgi
.
On the mod_wsgi issue Graham Dumpleton pointed out that the colorama isatty()
check is only handling AttributeError
where we have an OSError
(and feasibly a ValueError
could be raised too.)
Opening this just to put on your radar that widening the except clause in isatty()
may be valuable.
Thanks again. Kind Regards,
Carlton
Just a quick follow-up: I'm struggling to nest the colorama.init()
call without it stopping working so ideally it wouldn't raise.
This bit from the readme isn't quite true currently:
On other platforms, calling init() has no effect ... By design, this permits applications to call init() unconditionally on all platforms, after which ANSI output should just work.
We can catch the exception at the top layer, so it's not fatal.