platform system may be Windows or Microsoft since Vista

p.lavarre at p.lavarre at
Sat Sep 1 17:44:47 CEST 2007

> > suppose you get Python for Vista Windows today
> > if platform.system() in ('Windows', 'Microsoft'):
> > if not (platform.system() in ('Windows', 'Microsoft')):
> Good analysis.

Yes I am sane!! Thank you for saying.

> Log a bug @

Glad to hear I can help. I created:
TITLE = (no priority set) platform system may be Windows or Microsoft
since Vista
CREATOR = p.lavarre at

The Search Tracker there now finds this bug within: platform system
Windows Microsoft

Thanks again for clueing me in promptly,

P.S. now includes the musings:


There is no fixing all of this?

Cross-platform scripts actually will misbehave across the large
population that is 2.5 Python in Vista unless those scripts change to
implement something like the suggested workaround, that's now an
accomplished fact.

Question: Is it better to leave this feature as is, so that everyone
eventually learns to workaround it, or is it better to fix it late now
in 2007-09, so that many people never have to learn to workaround it?

Question: Why are we screen-scraping the Ver command, instead of
calling Win kernel32.getVersionEx? And how can any code for screen-
scraping the Ver command be in doubt about whether the platform.system
underneath is 'Windows'?

is the page that newbie Python bug reporters should read first, I

My path to that page was as follows ...

> Log a bug @

Indeed the Search Tracker finds no hits at: platform system Windows

Vaguely feels like e-mail registration required? Ick. Ok. Ah, the
Issues > Create New menu item appears after login, good.

Those bug Types are labeled in English but otherwise undefined. (Later
I see I could contribute my guess of definitions at I guess surprising result
values like I'm seeing count as 'Behavior' else 'RFE' else 'Security',
but not in ('Crash', 'Compile', 'Resource Usage'). I guess by RFE we
mean a wish, i.e., a Request For Enhancement.

Ok then:

TITLE: platform system may be Windows or Microsoft since Vista
TYPE: Behavior
SEVERITY: Major (not Critical, Urgent, Normal, Minor)

All the "process" fields I guess I should leave blank. Somehow there
is no place to describe the bug in detail??? I guess I Submit New
entry anyhow ... Oh no, not actually. There is online help of Wiki

Clicking thru that online help eventually explains:

Change Note: describe the problem in detail, including what you
expected to happen and what did happen. Be sure to include whether any
extension modules were involved, and what hardware and software
platform you were using (including version information as

Thus, I wrote ...


'Microsoft' is the platform.system() of Vista Windows, whereas
'Windows' was the platform.system() of XP Windows, whoops.


Run 2.5.1 Python in a Vista and see:

>>> import platform
>>> platform.system()


>>> import platform
>>> platform.system()


Write new Python source code like:

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

in place of obsolete Python source code like:

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


Seen by me in an Enterprise Vista. Indexed by Google as reported by
Martin v. Löwis (loewis) circa 2007-05-29 07:11 as:

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 to return 'Microsoft' for
system instead of 'Microsoft Windows'. This causes uname() to return
the incorrect values. Both system() and release() call uname().


[as above]

More information about the Python-list mailing list