Author ezio.melotti
Recipients ezio.melotti, lemburg, portella
Date 2009-07-06.10:34:34
SpamBayes Score 1.28584e-08
Marked as misclassified No
Message-id <>
On the Vista machine that returned ('', '6.0.6002', 'SP2',
'Multiprocessor Free') there is ActiveState's Python 2.5.2 that includes
the pywin32 extension.

I managed to run pdb on it and the result was
Python 2.5 doesn't have any check for Vista, and in win32_ver(), inside
the "elif plat == VER_PLATFORM_WIN32_NT:" it only checks for maj <= 4
and maj == 5. Vista is 6 and 'release' remains unset [1]. In Py 2.6
there's also if maj == 6 [2] (and now maj == 7 should be added too).

However, I also tried to run what the OP said and indeed I found some
problem. With'platform._syscmd_ver()'), on Vista in English I get:
-> info =
(Pdb) s
> c:\program files\python26\lib\
-> if pipe.close():
(Pdb) info
'\nMicrosoft Windows [Version 6.0.6002]\n'
-> m = _ver_output.match(info)
(Pdb) s
> c:\program files\python26\lib\
-> if m is not None:
(Pdb) m
<_sre.SRE_Match object at 0x0000000002812AE0>
(Pdb) m.groups()
('Microsoft', 'Windows', '6.0.6002')

where _ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) '
                         'Version ([\d.]+))')

In non-English versions instead the regex doesn't match:
-> if pipe.close():
(Pdb) p info
'\nMicrosoft Windows [Versione 6.0.6002]\n'
> c:\program files\python25\lib\
-> m = _ver_output.match(info)
(Pdb) n
> c:\program files\python25\lib\
-> if m:
(Pdb) m

Since 'Version' is translated, the regex fails if the translation is
different because it checks specifically for the word 'Version'.
Replacing it with \S+ as the OP suggested sounds like a reasonable
solution. It is possible that even other versions of Windows (e.g. XP)
have 'Version' translated, can you reproduce it with your German XP?

Later I can try on another non-English XP and see if the regex match.

[1]: /python/branches/release25-maint/Lib/
[2]: /python/branches/release26-maint/Lib/
Date User Action Args
2009-07-06 10:34:36ezio.melottisetrecipients: + ezio.melotti, lemburg, portella
2009-07-06 10:34:36ezio.melottisetmessageid: <>
2009-07-06 10:34:35ezio.melottilinkissue3410 messages
2009-07-06 10:34:34ezio.melotticreate