Message90170
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 http://dpaste.com/hold/63642/
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 pdb.run('platform._syscmd_ver()'), on Vista in English I get:
-> info = pipe.read()
(Pdb) s
> c:\program files\python26\lib\platform.py(493)_syscmd_ver()
-> if pipe.close():
(Pdb) info
'\nMicrosoft Windows [Version 6.0.6002]\n'
...
-> m = _ver_output.match(info)
(Pdb) s
> c:\program files\python26\lib\platform.py(511)_syscmd_ver()
-> 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\platform.py(420)_syscmd_ver()
-> m = _ver_output.match(info)
(Pdb) n
> c:\program files\python25\lib\platform.py(421)_syscmd_ver()
-> if m:
(Pdb) m
(Pdb)
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/platform.py?view=markup
[2]: /python/branches/release26-maint/Lib/platform.py?view=markup |
|
Date |
User |
Action |
Args |
2009-07-06 10:34:36 | ezio.melotti | set | recipients:
+ ezio.melotti, lemburg, portella |
2009-07-06 10:34:36 | ezio.melotti | set | messageid: <1246876476.88.0.882496051814.issue3410@psf.upfronthosting.co.za> |
2009-07-06 10:34:35 | ezio.melotti | link | issue3410 messages |
2009-07-06 10:34:34 | ezio.melotti | create | |
|