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.

Title: platform.system() returns incorrect value in Vista
Type: Stage:
Components: None Versions:
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: lemburg Nosy List: bleppard, lemburg, loewis
Priority: normal Keywords: patch

Created on 2007-05-28 01:23 by bleppard, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
Platform-VistaFix2.patch bleppard, 2007-05-30 06:04 Fix for uname() and win32_ver()
Messages (5)
msg52681 - (view) Author: Benjamin Leppard (bleppard) Date: 2007-05-28 01:23

On Microsoft Vista platform.system() returns 'Microsoft' and platform.release() returns 'Windows'

Under Microsoft Windows XP SP2 platform.system() returns 'Windows' and platform.release() returns 'XP'.

This is problem was caused by a change in the output of the "ver" command. In Windows XP SP2 "ver" outputted 'Microsoft Windows XP [Version 5.1.2600]'  In Microsoft Vista "ver" outputted 'Microsoft Windows [Version 6.0.6000]'. The lack of the 3rd word before version causes _syscmd_ver(...) in to return 'Microsoft' for system instead of 'Microsoft Windows'. This causes uname() to return the incorrect values. Both system() and release() call uname().

This problem occurs in the trunk.

I have attached a patch against the trunk svn that fixes the symptom of the problem in uname()
msg52682 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-05-29 05:11
Reclassifying as a patch. Marc-Andre, can you take a look? If not, please unassign.
msg52683 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2007-05-29 16:08
I don't have Vista handy to check the patch. 

Ideally, win32_ver() should be patched to return proper values for Vista directly from the registry. Would be great if you could provide a patch for this as well.

However, in some cases _syscmd_ver() will still be used, so the patch is fine. Please add a comment explaining the problem and also add a check to set release to 'Vista' in case the version starts with '6.0'.

msg52684 - (view) Author: Benjamin Leppard (bleppard) Date: 2007-05-30 06:04
I updated the patch to included comments, and set the release to 'Vista' when the version starts with '6.0'. Unfortunately both Windows Server 2008 and Windows Vista both are version 6.0.

I updated win32_ver() to report the correct values for Vista and Windows Server 2008. It reports release of '2008Server' for Windows 2008 server, and release of 'post2008Server' for version 6.1 or greater. I have not tested it under Windows Server 2008.
File Added: Platform-VistaFix2.patch
msg52685 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2007-06-12 09:27
Thank you.

Committed revision 55927.
Date User Action Args
2022-04-11 14:56:24adminsetgithub: 45006
2007-05-28 01:23:43bleppardcreate