Message411704
> 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. |
|
Date |
User |
Action |
Args |
2022-01-26 05:05:27 | eryksun | set | recipients:
+ eryksun, lemburg, paul.moore, vstinner, tim.golden, zach.ware, steve.dower, miss-islington, sahsariga111 |
2022-01-26 05:05:27 | eryksun | set | messageid: <1643173527.73.0.205584009929.issue45382@roundup.psfhosted.org> |
2022-01-26 05:05:27 | eryksun | link | issue45382 messages |
2022-01-26 05:05:27 | eryksun | create | |
|