Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust exception handling in isatty() #304

Open
carltongibson opened this issue May 13, 2021 · 1 comment
Open

Adjust exception handling in isatty() #304

carltongibson opened this issue May 13, 2021 · 1 comment

Comments

@carltongibson
Copy link

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

@carltongibson
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant