[issue45382] platform() is not able to detect windows 11

2022-03-28 Thread Tim Golden


Tim Golden  added the comment:

> I don't see why the wmi module ( https://pypi.org/project/WMI/ ) can't be 
> used instead to get the information

Well I can speak here as the author of that module and as an (occasional) core 
developer. The wmi module stands on the shoulderes of the pywin32 
win32com.client code -- which is an _enormous_ dependency to bring into Python. 
(And which no-one would realistically agree to...)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-03-27 Thread Evernow


Evernow  added the comment:

As mentioned wmic is deprecated ( 
https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmic ). 

I don't see why the wmi module ( https://pypi.org/project/WMI/ ) can't be used 
instead to get the information, I have a working implementation of this that 
simply does the following: 

current_major_version = 
wmi.WMI().Win32_OperatingSystem()[0].Caption.encode("ascii", "ignore").decode(
"utf-8")
if "8" in current_major_version:
pass
elif "7" in current_major_version:  
pass
elif "10" in current_major_version:  
pass
elif "11" in current_major_version:
pass

--
nosy: +Evernow

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-03-16 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 0b0609d0d1a2f231c94bab2177095dd9a46fc137 by Miss Islington (bot) 
in branch '3.9':
[3.10] bpo-45382: test.pythoninfo logs more Windows versions (GH-30891) 
(GH-30894)
https://github.com/python/cpython/commit/0b0609d0d1a2f231c94bab2177095dd9a46fc137


--
nosy: +lukasz.langa

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-26 Thread Steve Dower


Steve Dower  added the comment:

>> AFAIK, the Win32_OperatingSystem caption is always ASCII.
> 
> I think I was wrong here. The "Caption" field is localized, so the wmic.exe 
> OEM encoded output to a pipe isn't reliable.

Correct. And while "Windows" itself is never translated, the caption may 
include terms that are translated (e.g., IIRC, the extra names for 
point-of-sales versions).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-26 Thread Steve Dower


Steve Dower  added the comment:

sys.getwindowsversion() is affected to Microsoft's minimal rebuilds of 
OS components causing core DLLs to have older versions than the release, 
and also to compatibility modes that may report earlier versions if API 
behaviour is being emulated.

The best way for us to use WMI is to call it directly. There are native 
APIs to access it and retrieve the data directly. It's just nobody has 
written it yet.

Calling out to Powershell needs to account for cases where Powershell is 
not present, is disabled/blocked/limited, or is a different version. We 
can rely on the native APIs (at least, if they fail, there's nothing 
better we could possibly have done).

WMI is essentially the Windows equivalent of the platform module, so 
there's no reason all the APIs in platform.py shouldn't use it, and 
every reason that sys/os *shouldn't* use it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-26 Thread Eryk Sun

Eryk Sun  added the comment:

> AFAIK, the Win32_OperatingSystem caption is always ASCII. 

I think I was wrong here. The "Caption" field is localized, so the wmic.exe OEM 
encoded output to a pipe isn't reliable. The system OEM code page doesn't 
necessarily match the display/preferred language of the current user. It could 
be a lossy encoding with default and best-fit translations (e.g. "?"; "α" -> 
"a"). If using wmic.exe, it's better to redirect the output to a temp file, 
which will be UTF-16.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-26 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-26 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 26.01.2022 01:29, Eryk Sun wrote:
> 
> Eryk Sun  added the comment:
> 
>> Bit wmic seems nice solution.
>> Is still working for windows lower than 11?
> 
> wmic.exe is still included in Windows 10 and 11, but it's officially 
> deprecated [1], which means it's no longer being actively developed, and it 
> might be removed in a future update. PowerShell is the preferred way to use 
> WMI.

All of these require shelling out to the OS, so why not stick to
`ver` as we've done in the past. This has existed for ages and
will most likely not disappear anytime soon.

Is there a good reason to prefer wmic or PowerShell (which are
less likely to be available or reliable) ?

> ---
> [1] 
> https://docs.microsoft.com/en-us/windows/deployment/planning/windows-10-deprecated-features
-- 
Marc-Andre Lemburg
eGenix.com

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-26 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

The quick research on web gived me that C/C++ developers will just get the 
build version and compare it with predefined list.
See more there: 
https://docs.microsoft.com/answers/questions/672988/c-detect-windows-build.html

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-26 Thread Alex Zaslavskis

Alex Zaslavskis  added the comment:

The quick research on web gived me that C/C++ developers will just get the
build version and compare it with predefined list.
See more there:
https://docs.microsoft.com/answers/questions/672988/c-detect-windows-build.html

ср, 26 янв. 2022 г., 05:05 Eryk Sun :

>
> Eryk Sun  added the comment:
>
> > 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.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread Eryk Sun


Eryk Sun  added the comment:

> 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.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread STINNER Victor


STINNER Victor  added the comment:

I don't understand why we have to handle XML or JSON and encoding... just to 
get a version number. Why did Microsoft make it so complicated?

sys.getwindowsversion() which exposes GetVersionEx() looks fine to me.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread Eryk Sun


Eryk Sun  added the comment:

> Bit wmic seems nice solution.
> Is still working for windows lower than 11?

wmic.exe is still included in Windows 10 and 11, but it's officially deprecated 
[1], which means it's no longer being actively developed, and it might be 
removed in a future update. PowerShell is the preferred way to use WMI.

---
[1] 
https://docs.microsoft.com/en-us/windows/deployment/planning/windows-10-deprecated-features

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +29075
pull_request: https://github.com/python/cpython/pull/30894

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 4a57fa296b92125e41220ecd201eb2e432b79fb0 by Victor Stinner in 
branch '3.10':
[3.10] bpo-45382: test.pythoninfo logs more Windows versions (GH-30891)
https://github.com/python/cpython/commit/4a57fa296b92125e41220ecd201eb2e432b79fb0


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

Thanks guys. Microsoft is always pain for us.
Bit wmic seems nice solution.
Is still working for windows lower than 11?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +29074
pull_request: https://github.com/python/cpython/pull/30891

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset cef0a5458f254c2f8536b928dee25862ca90ffa6 by Victor Stinner in 
branch 'main':
bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890)
https://github.com/python/cpython/commit/cef0a5458f254c2f8536b928dee25862ca90ffa6


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread STINNER Victor

STINNER Victor  added the comment:

> When writing to a pipe, wmic.exe hard codes using the process OEM code page 
> (i.e. CP_OEMCP). If it matters, running wmic.exe with subprocess should use 
> encoding='oem' instead of text=True.

Oh ok, I wrote PR 30890 to fix the wmic.exe encoding.

I would prefer to avoid a named temporary file if possible, until it's really 
needed.

I'm only aware of the Fedora operating system which made fun of non-ASCII users 
once with "Fedora release 19 (Schrödinger's Cat)": 
https://lwn.net/Articles/545741/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-25 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +29073
pull_request: https://github.com/python/cpython/pull/30890

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-24 Thread Eryk Sun


Eryk Sun  added the comment:

> It's *very* unlikely you'll ever get output that doesn't fit into MBCS,

When writing to a pipe, wmic.exe hard codes using the process OEM code page 
(i.e. CP_OEMCP). If it matters, running wmic.exe with subprocess should use 
encoding='oem' instead of text=True.

That said, wmic.exe is deprecated. I suggest using PowerShell instead. For 
example:

import os
import json
import subprocess

cmd = 'Get-CimInstance Win32_OperatingSystem | Select Caption, Version | 
ConvertTo-Json'
p = subprocess.run(f'powershell.exe -c "{cmd}"', capture_output=True, 
encoding=os.device_encoding(1))
result = json.loads(p.stdout)

PowerShell uses the console's output code page (i.e. os.device_encoding(1)) 
when writing to stdout, even if it's a pipe. (If PowerShell is run without a 
console via DETACHED_PROCESS, then it outputs nothing to stdout.) The only way 
I know of to make PowerShell write UTF-8 to stdout when it's a pipe is by 
temporarily changing the console output code page. Assuming the current process 
has a console, you have to first get the current code page with 
GetConsoleOutputCP(). Change the code page to UTF-8 via 
SetConsoleOutputCP(CP_UTF8). Run the PowerShell command. Finally, restore the 
original code page.

Maybe subprocess should provide a context manager to set the console code pages 
before a call, and restore the previous console code pages and console modes 
after a call completes. That's what CLI shells such as CMD do when running an 
external program.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-24 Thread Steve Dower


Steve Dower  added the comment:

Yeah, I pushed the machines up to 2022 the other day while tidying the configs. 
Wouldn't have expected it to impact that issue though, it's fully within 
OpenSSL, isn't it? (We also updated that recently...)

Also, as an FYI, if you use "wmic /output:" then it always writes in 
utf-16-le with a BOM. It's *very* unlikely you'll ever get output that doesn't 
fit into MBCS, but if that does ever occur, we can use a temporary file instead 
of stdout.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b0898f4aa90d9397e23aef98a2d6b82445ee7455 by Victor Stinner in 
branch 'main':
bpo-45382: test.pythoninfo logs more Windows versions (GH-30817)
https://github.com/python/cpython/commit/b0898f4aa90d9397e23aef98a2d6b82445ee7455


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 30817 to log "ver" and "wmic os get Caption,Version /value" command 
output in test.pythoninfo. I would like to check if Windows Server 2022 is 
deployed on CI used by Python :-) I'm trying to understand why bpo-41682 
"[Windows] test_asyncio: Proactor 
test_sendfile_close_peer_in_the_middle_of_receiving failure" started to fail 
more often recently.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2022-01-22 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +29004
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30817

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-21 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

On my Win11 it returns me :

C:\Users\Win10Home>wmic os get Caption,Version /value


Caption=Microsoft Windows 11 Home Single Language
Version=10.0.22000

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-20 Thread Steve Dower


Steve Dower  added the comment:

All that said, if we're going to shell out to "ver", we may as well try "wmic 
os get Caption,Version /value" first and parse its output. For me, it looks 
like the below (with a number of blank lines around it):

Caption=Microsoft Windows 10 Enterprise
Version=10.0.19043

I would assume the output is in MBCS, and there doesn't appear to be an option 
to change that - the "/locale" option appears to influence translations, rather 
than encoding.

We'd still want the "ver" fallback I think. The wmic command is deprecated in 
favour of PowerShell commands, which means we would have to implement native 
calls to get equivalent functionality. But I expect neither cmd.exe nor 
wmic.exe will actually disappear for a long time.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-08 Thread STINNER Victor


STINNER Victor  added the comment:

macOS has a similar issue in the platform module. Previously, platform gave the 
darwin kernel version, whereas most users only know macOS versions. See 
bpo-35344.

Even if Microsoft decided to internally stay at 10.x, IMO users really expect 
"Windows 11" when requesting the Windows version, especially in 
platform.platform().

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-08 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 08.10.2021 02:15, Eryk Sun wrote:
> 
>> use the build number as reference instead of the major.minor
> 
> It could check the (major, minor, build) tuple, which allows reporting 10.1+ 
> as "post11" and minimizes hard coding of build numbers. For example, given 
> win32_ver() iterates by (major, minor, build) thresholds:

Great idea.

Could you prepare a PR for this ?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-07 Thread Eryk Sun


Eryk Sun  added the comment:

> use the build number as reference instead of the major.minor

It could check the (major, minor, build) tuple, which allows reporting 10.1+ as 
"post11" and minimizes hard coding of build numbers. For example, given 
win32_ver() iterates by (major, minor, build) thresholds:

_WIN32_CLIENT_RELEASES = [
((10, 1, 0), "post11"),
((10, 0, 22000), "11"),
((6, 4, 0), "10"),
((6, 3, 0), "8.1"),
((6, 2, 0), "8"),
((6, 1, 0), "7"),
((6, 0, 0), "Vista"),
((5, 2, 3790), "XP64"),
((5, 2, 0), "XPMedia"),
((5, 1, 0), "XP"),
((5, 0, 0), "2000"),
]

_WIN32_SERVER_RELEASES = [
((10, 1, 0), "post2022Server"),
((10, 0, 20348), "2022Server"),
((10, 0, 17763), "2019Server"),
((6, 4, 0), "2016Server"),
((6, 3, 0), "2012ServerR2"),
((6, 2, 0), "2012Server"),
((6, 1, 0), "2008ServerR2"),
((6, 0, 0), "2008Server"),
((5, 2, 0), "2003Server"),
((5, 0, 0), "2000Server"),
]

In win32_ver():

if major >= 5: # NT systems
if getattr(winver, 'product_type', None) == 3: # VER_NT_SERVER
release_list = _WIN32_SERVER_RELEASES
else:
release_list = _WIN32_CLIENT_RELEASES
ver = major, minor, build
for release_ver, release_name in release_list:
if ver >= release_ver:
release = release_name
break

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-07 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

Beter solution . Using match in python 3.10

--
Added file: https://bugs.python.org/file50331/main.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-07 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

That nice idea . So the dist can contain the minimal build required to say that 
is for example windows 11 . The simplest solution that came in mind is . Is far 
from perfect but it works.

--
Added file: https://bugs.python.org/file50330/main.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-07 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

It's probably time to extend the marketing version detection mechanism to use
the build number as reference instead of the major.minor system version numbers.

Here's a good reference for this:

https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions

MS resources:

https://docs.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version
https://docs.microsoft.com/en-us/windows/release-health/release-information

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-07 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

systeminfo can be option

--
Added file: https://bugs.python.org/file50329/import subprocess.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:

> Hmm, but the "ver" output seems to have more information than those APIs.

It's always had build numbers, which the regular APIs do not, because the 
regular APIs are meant for detecting incompatibilities rather than reporting.

Since there are some incompatibilities, I hope they'll rev the minor version 
number, but I have no idea if that's planned yet. In theory I have early access 
to the release build already, but I haven't installed it on anything.

Eventually I think we're going to need some kind of WMI call in the platform 
module to get the right data for reporting. Until then, we're making best 
guesses from heuristics.

--
nosy:  -eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Eryk Sun


Eryk Sun  added the comment:

The _WIN32_CLIENT_RELEASES table based on major.minor version number isn't 
helpful since Windows 10 and 11 have the same version number. win32_ver() needs 
a workaround to return release "11" if the build number is 22000 or greater. Is 
there any need/desire to also identify Server 2016, 2019, and 2022?

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 05.10.2021 22:30, Steve Dower wrote:
> The version number for "Windows 11" still starts with 10.0. Just like how 
> Windows 5.x and 6.x were around for a very long time each ;)
> 
> There are tables in platform module that map the specific version to the 
> release name. These probably need to be updated to return "11" for versions 
> 10.0.22000 and greater.

Hmm, but the "ver" output seems to have more information than those
APIs.

Note: The tables for mapping to releases for Windows only take the
major.minor versions as key. Unfortunately, those did not change. It's
actually the build version which provides the indicator, it seems.

Any idea, whether a patch will fix this on Windows soonish ?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Steve Dower


Steve Dower  added the comment:

The version number for "Windows 11" still starts with 10.0. Just like how 
Windows 5.x and 6.x were around for a very long time each ;)

There are tables in platform module that map the specific version to the 
release name. These probably need to be updated to return "11" for versions 
10.0.22000 and greater.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

win32_ver() should be using the internal Windows APIs to figure out the 
version. I do wonder why those don't return the same version as the "ver" 
command line tool.

Adding our Windows experts to the noisy list.

--
nosy: +lemburg, paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

demo.py contains dirty hack that can be used as a fix for some time before 
microsoft will not fix it.

--
Added file: https://bugs.python.org/file50327/demo.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

The bug comes from Microsoft  terminal bug : If I type there : ver it will 
return Microsoft Windows [Version 10.0.22000.194] only one patch is if that 
will check the build . 
so : 
 info = subprocess.check_output(cmd,
   stdin=subprocess.DEVNULL,
   stderr=subprocess.DEVNULL,
   text=True,
   shell=True)
if(int(info.strip(".")[2])==22000):
 return "Windows [Version 11.0.22000.194]

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

The 
platform.win32_ver() returns same answer

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Alex Zaslavskis


New submission from Alex Zaslavskis :

I am updated to windows 11 . Now I am trying to write script that will detect 
is user use windows 11 or windows 10 . 
I was using the simplest way as possible: 
import platform 
print(platform.platform())
The result I got is : Windows-10-10.0.22000-SP0
That is quite correct . The build version is correct ,but the windows version 
is still not .

--
components: Library (Lib)
messages: 403260
nosy: sahsariga111
priority: normal
severity: normal
status: open
title: platform() is not able to detect windows 11
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com