Message55561
SUMMARY:
'Microsoft' is the platform.system() of Vista Windows, whereas 'Windows'
was the platform.system() of XP Windows, whoops.
STEPS TO REPRODUCE & ACTUAL RESULTS:
Run 2.5.1 Python in a Vista and see:
>>> import platform
>>> platform.system()
>>>
'Microsoft'
>>>
EXPECTED RESULTS:
>>> import platform
>>> platform.system()
'Windows'
>>>
WORKAROUND:
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
REGRESSION/ ISOLATION:
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:
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().
NOTES:
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'? |
|
Date |
User |
Action |
Args |
2007-09-01 15:34:23 | p.lavarre@ieee.org | set | spambayes_score: 0.0133222 -> 0.0133222 recipients:
+ p.lavarre@ieee.org |
2007-09-01 15:34:23 | p.lavarre@ieee.org | set | spambayes_score: 0.0133222 -> 0.0133222 messageid: <1188660863.15.0.271391863647.issue1082@psf.upfronthosting.co.za> |
2007-09-01 15:34:23 | p.lavarre@ieee.org | link | issue1082 messages |
2007-09-01 15:34:22 | p.lavarre@ieee.org | create | |
|