This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, lemburg, miss-islington, paul.moore, sahsariga111, steve.dower, tim.golden, vstinner, zach.ware
Date 2022-01-26.05:05:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643173527.73.0.205584009929.issue45382@roundup.psfhosted.org>
In-reply-to
Content
> sys.getwindowsversion() which exposes GetVersionEx() looks fine to me.

In Windows 8+, sys.getwindowsversion() returns a version that can vary from 6.2.9200 (Windows 8) up to the actual OS version. It depends on the OS versions supported by the application manifest -- with 6.2.9200 used when there's no application manifest. The platform module uses the shell's VER command because it returns the real OS version.

The version number for Windows 11 is 10.0.22000+. The platform module misreports this as Windows 10. In msg403452, I suggested a modification to use build numbers. In msg404451 Steve said we may as well use the WMI result to identify Windows 11 based on the OS caption. If we use WMI, we can choose to rely on wmic.exe (deprecated), PowerShell, or implement our own code in C/C++.

> I don't understand why we have to handle XML or JSON and encoding... 

Using JSON or XML (ElementTree) isn't required, if you'd rather parse human-readable output. AFAIK, the Win32_OperatingSystem caption is always ASCII. 

In general, wmic.exe writes output text to a pipe that's encoded with the system OEM code page. pwsh.exe, powershell.exe, and cmd.exe write output text to a pipe (from their internal commands/cmdlets) that's encoded using the console's output code page. cmd.exe also supports a /U option to use UTF-16.
History
Date User Action Args
2022-01-26 05:05:27eryksunsetrecipients: + eryksun, lemburg, paul.moore, vstinner, tim.golden, zach.ware, steve.dower, miss-islington, sahsariga111
2022-01-26 05:05:27eryksunsetmessageid: <1643173527.73.0.205584009929.issue45382@roundup.psfhosted.org>
2022-01-26 05:05:27eryksunlinkissue45382 messages
2022-01-26 05:05:27eryksuncreate