New submission from Pat LaVarre: 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'? ---------- components: Windows messages: 55561 nosy: [EMAIL PROTECTED] severity: major status: open title: platform system may be Windows or Microsoft since Vista type: behavior versions: Python 2.5 __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1082> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com