[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 
<https://bugs.python.org/issue45382>
___
___
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 
> <https://bugs.python.org/issue45382>
> ___
>

--

___
Python tracker 
<https://bugs.python.org/issue45382>
___
___
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 
<https://bugs.python.org/issue45382>
___
___
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 
<https://bugs.python.org/issue45382>
___
___
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 
<https://bugs.python.org/issue45382>
___
___
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 
<https://bugs.python.org/issue45382>
___
___
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 
<https://bugs.python.org/issue45382>
___
___
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 
<https://bugs.python.org/issue45382>
___
___
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 
<https://bugs.python.org/issue45382>
___
___
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 
<https://bugs.python.org/issue45382>
___
___
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 
<https://bugs.python.org/issue45382>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

What about adding alert message for beginners that can stuck with that in docs? 
To warn others , is that good idea you think. Or it is redundant ?

--

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

Thanks that really works. 
So as I understand that b''.split() != ''.split()

--
resolution:  -> not a bug

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

Moreover according Python docs : This exception may be raised by user code to 
indicate that an attempted operation on an object is not supported. But also 
the Python interpreter gives that  a bytes-like object is required, not 'str' 
that I am already passing , so it says that all fine. But the question is why 
then TypeError happens .

--

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

''.split(',') # works as it should be 
b''.split(',') # gives strange error message.

TypeError: a bytes-like object is required, not 'str'

The problem here is that message is saying that for fix error you should use 
bytes-like object that not a true. In reality the string or None is required .

--

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

I am not really sure that it is working as it should be. Even with your example 
it gives : 
TypeError: a bytes-like object is required, not 'str'
The problem is why error message says that  bytes-like is  required , when the 
string is required.

--

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Change by Alex Zaslavskis :


Removed file: https://bugs.python.org/file50257/bug_in_python.py

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Change by Alex Zaslavskis :


Added file: https://bugs.python.org/file50258/bug_in_python.py

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Change by Alex Zaslavskis :


--
type: compile error -> behavior

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


New submission from Alex Zaslavskis :

If we will try to split bytes we will got quite strange error in console. 

Traceback (most recent call last):
  File "C:/Users/ProAdmin/Desktop/bug_in_python.py", line 6, in 
byte_message.split(",")
TypeError: a bytes-like object is required, not 'str'

The problem here is that object should be string and in if I convert it to 
string the error is going. So that mean that there are error in mistake . 
Correct variant should be :
Traceback (most recent call last):
  File "C:/Users/ProAdmin/Desktop/bug_in_python.py", line 6, in 
byte_message.split(",")
TypeError:  str is required, not a bytes-like object


message = 'Python is fun'
byte_message = bytes(message, 'utf-8')
print(byte_message)
#byte_message.split(",") causes error
str(byte_message).split(",") # works

--
components: Argument Clinic
files: bug_in_python.py
messages: 400948
nosy: larry, sahsariga111
priority: normal
severity: normal
status: open
title: Confusing error message when trying split bytes.
type: compile error
versions: Python 3.9
Added file: https://bugs.python.org/file50257/bug_in_python.py

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