platform system may be Windows or Microsoft since Vista

p.lavarre at ieee.org p.lavarre at ieee.org
Fri Aug 31 18:47:58 CEST 2007


Let's suppose you get Python for Vista Windows today from
http://www.python.org/download/.

Should you then conclude that the tests:

if platform.system() in ('Windows', 'Microsoft'):
if not (platform.system() in ('Windows', 'Microsoft')):

are now exactly what you should write for that 2.5.1 Python, when you
must resort to os-specific tools like DeviceIoControl, in place of the
slightly simpler tests that worked before:

if platform.system() == 'Windows': # Microsoft
if platform.system() != 'Windows': # Microsoft

?

Curiously yours, thanks in advance,

P.S. Groups search assures me clp hasn't previously reviewed: platform
system Windows Microsoft

P.P.S. I ask because this August I rediscovered this 28 May Python
uname vs. Win kernel32.getVersionEx issue indexed by Google as
follows:

http://mail.python.org/pipermail/patches/2007-June/022947.html
...
 
Patches item #1726668, was opened at 2007-05-28 03: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 platform.py to return 'Microsoft' for
system instead of 'Microsoft Windows'. This causes uname() to return
the incorrect values. Both system() and release() call uname().

...




More information about the Python-list mailing list