#32740: Running colorama.init() at import time causes deployment error
---------------------------------+--------------------------------------
Reporter: Leon Matthews | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Other) | Version: 3.2
Severity: Normal | Resolution:
Keywords: apache mod_wsgi | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Carlton Gibson):
* cc: MinchinWeb (added)
Comment:
Hello again. I'm supposing we should fix this, but I'm a little intrigued
by the last line of that traceback:
{{{
File "/srv/websites/digitaladvisor.nz/env/lib/python3.8/site-
packages/colorama/ansitowin32.py", line 59, in closed
26 return stream.closed
}}}
The docs you link have this for justification:
> A well behaved Python WSGI application should never attempt to write any
data directly to sys.stdout or use the print statement without directing
it to an alternate file object.
But [https://docs.python.org/3.9/library/io.html#io.IOBase.closed `closed`
is just checking the status of the stream]. It's not writing data, so
shouldn't trigger an error. To that extent it kind of looks like a bug in
`mod_wsgi`. 🤔
> could it please be moved into a function instead?
An earlier iteration of the PR did have this call nested inside a
function.
--
Ticket URL: <https://code.djangoproject.com/ticket/32740#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/071.df8a93b5a2530204434696403509a1b1%40djangoproject.com.