From c2e6047c725e26987c87e2be59f2ab4bf9828fa5 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 12 May 2021 15:22:34 +0200 Subject: [PATCH] Fixed #32740 -- Caught possible exception when initializing colorama. --- django/core/management/color.py | 4 ++-- docs/releases/3.2.4.txt | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/django/core/management/color.py b/django/core/management/color.py index 3227809303..be8c31bb95 100644 --- a/django/core/management/color.py +++ b/django/core/management/color.py @@ -10,10 +10,10 @@ from django.utils import termcolors try: import colorama -except ImportError: + colorama.init() +except (ImportError, OSError): HAS_COLORAMA = False else: - colorama.init() HAS_COLORAMA = True diff --git a/docs/releases/3.2.4.txt b/docs/releases/3.2.4.txt index dac726e961..048eb8c385 100644 --- a/docs/releases/3.2.4.txt +++ b/docs/releases/3.2.4.txt @@ -18,3 +18,7 @@ Bugfixes * Prevented unnecessary initialization of unused caches following a regression in Django 3.2 (:ticket:`32747`). + +* Fixed a crash in Django 3.2 that could occur when running ``mod_wsgi`` with + the recommended settings while the Windows ``colorama`` library was installed + (:ticket:`32740`).