From: Victor Stinner Date: Tue, 25 Jan 2022 19:02:23 +0000 (+0100) Subject: bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890) X-Git-Tag: v3.11.0a5~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cef0a5458f254c2f8536b928dee25862ca90ffa6;p=thirdparty%2FPython%2Fcpython.git bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890) --- diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index cfd7ac2755d5..d15a11c80b64 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: