Skip to content

Commit 68f0a25

Browse files
authored
Merge pull request #2032 from tomaarsen/hotfix/colorama_nameerror
Only call `colorama.init` if `colorama` is available
2 parents 6525008 + c752a6c commit 68f0a25

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

isort/format.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def create_terminal_printer(
150150
print(no_colorama_message, file=sys.stderr)
151151
sys.exit(1)
152152

153-
colorama.init(strip=False)
153+
if not colorama_unavailable:
154+
colorama.init(strip=False)
154155
return (
155156
ColoramaPrinter(error, success, output) if color else BasicPrinter(error, success, output)
156157
)

0 commit comments

Comments
 (0)