From cef0a5458f254c2f8536b928dee25862ca90ffa6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 25 Jan 2022 20:02:23 +0100 Subject: [PATCH] bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890) --- Lib/test/pythoninfo.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index cfd7ac2755d..d15a11c80b6 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -731,9 +731,12 @@ def collect_windows(info_add): import subprocess try: + # When wmic.exe output is redirected to a pipe, + # it uses the OEM code page proc = subprocess.Popen(["wmic", "os", "get", "Caption,Version", "/value"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, + encoding="oem", text=True) output, stderr = proc.communicate() if proc.returncode: