Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue3410] platform.version() don't work as expected in Vista in portuguese

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Jul 4, 2009, 5:52 AM

Post #1 of 9 (430 views)
Permalink
[issue3410] platform.version() don't work as expected in Vista in portuguese

Marc-Andre Lemburg <mal [at] egenix> added the comment:

Ezio Melotti wrote:
> Ezio Melotti <ezio.melotti [at] gmail> added the comment:
>
> I tried platform.version() on a non-English Vista and XP and I got
> '32bit' for Vista and '5.1.2600' for XP. With platform.platform() I got
> 'Windows-32bit-SP2' on Vista and 'Windows-XP-5.1.2600-SP2' on XP.

Could you please run the platform function win32_ver() through
a debugger and check why it doesn't return "Vista". That function
does have support for Vista.

----------
title: platform.version() don't work as expected in Vista in portuguese -> platform.version() don't work as expected in Vista in portuguese

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 4, 2009, 6:22 AM

Post #2 of 9 (415 views)
Permalink
[issue3410] platform.version() don't work as expected in Vista in portuguese [In reply to]

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

The Vista machine is running Py 2.5.2 but is not mine so I can't
test/debug the issue properly there. FWIW I tried win32_ver() on it and
I got ('', '6.0.6002', 'SP2', 'Multiprocessor Free').

Here on WinXP with 2.6 I get ('XP', '5.1.2600', 'SP2', u'Uniprocessor
Free') (why only the last is unicode?).

On Monday I'll have access to more Windows machines (including Vista)
but they are all in English. If there's something that I should try
there let me know.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 4, 2009, 2:56 PM

Post #3 of 9 (402 views)
Permalink
[issue3410] platform.version() don't work as expected in Vista in portuguese [In reply to]

Marc-Andre Lemburg <mal [at] egenix> added the comment:

Ezio Melotti wrote:
> Ezio Melotti <ezio.melotti [at] gmail> added the comment:
>
> The Vista machine is running Py 2.5.2 but is not mine so I can't
> test/debug the issue properly there. FWIW I tried win32_ver() on it and
> I got ('', '6.0.6002', 'SP2', 'Multiprocessor Free').

Interesting. Looking at the code in win32_ver() should be getting
one of ('Vista', '2008Server', 'post2008Server'), but not '' for the
release.

> Here on WinXP with 2.6 I get ('XP', '5.1.2600', 'SP2', u'Uniprocessor
> Free') (why only the last is unicode?).

Do you have the win32 tools installed on that machine ? This could
be the reason.

> On Monday I'll have access to more Windows machines (including Vista)
> but they are all in English. If there's something that I should try
> there let me know.

Please check the results of win32_ver() on those machines. The
release part should always be set.

Thanks,
--
Marc-Andre Lemburg
eGenix.com

________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::

eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 4, 2009, 3:11 PM

Post #4 of 9 (406 views)
Permalink
[issue3410] platform.version() don't work as expected in Vista in portuguese [In reply to]

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

> Do you have the win32 tools installed on that machine ? This could
> be the reason.

On my XP machine I have them installed for Py 2.4 only, "import
win32api" fails on Py 2.6.
"platform.win32_ver()" returns the same with both the versions, but on
Py 2.4 they are all plain strings, on Py 2.6 the last string is Unicode
(and on Py 3 they are all Unicode).

I'll let you know about the result of win32_ver() on the other machines.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 5, 2009, 10:48 PM

Post #5 of 9 (386 views)
Permalink
[issue3410] platform.version() don't work as expected in Vista in portuguese [In reply to]

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

Here are the results.
Windows Vista SP2 in English
Python 3.0.1:
>>> platform.platform()
'Windows-Vista-6.0.6002-SP2'
>>> platform.version()
'6.0.6002'
>>> platform.win32_ver()
('Vista', '6.0.6002', 'SP2', 'Multiprocessor Free')

Python 2.6.2:
>>> platform.platform()
'Windows-Vista-6.0.6002-SP2'
>>> platform.version()
'6.0.6002'
>>> platform.win32_ver()
('Vista', '6.0.6002', 'SP2', u'Multiprocessor Free')

Windows 2003 Server SP2 in English
Python 3.1
>>> platform.platform()
'Windows-2003Server-5.2.3790-SP2'
>>> platform.version()
'5.2.3790'
>>> platform.win32_ver()
('2003Server', '5.2.3790', 'SP2', 'Uniprocessor Free')

Everything seems fine, however I don't have any non-English Windows
here. Do you know if it's possible to download and install language
packs and if they may affect the text in the version? If so, I could try
to do it and see if I can reproduce the original issue.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 6, 2009, 2:04 AM

Post #6 of 9 (382 views)
Permalink
[issue3410] platform.version() don't work as expected in Vista in portuguese [In reply to]

Marc-Andre Lemburg <mal [at] egenix> added the comment:

Ezio Melotti wrote:
> Ezio Melotti <ezio.melotti [at] gmail> added the comment:
>
> Here are the results.
> Windows Vista SP2 in English
> Python 3.0.1:
> >>> platform.platform()
> 'Windows-Vista-6.0.6002-SP2'
> >>> platform.version()
> '6.0.6002'
> >>> platform.win32_ver()
> ('Vista', '6.0.6002', 'SP2', 'Multiprocessor Free')
>
> Python 2.6.2:
> >>> platform.platform()
> 'Windows-Vista-6.0.6002-SP2'
> >>> platform.version()
> '6.0.6002'
> >>> platform.win32_ver()
> ('Vista', '6.0.6002', 'SP2', u'Multiprocessor Free')
>
> Windows 2003 Server SP2 in English
> Python 3.1
> >>> platform.platform()
> 'Windows-2003Server-5.2.3790-SP2'
> >>> platform.version()
> '5.2.3790'
> >>> platform.win32_ver()
> ('2003Server', '5.2.3790', 'SP2', 'Uniprocessor Free')

Thanks.

> Everything seems fine, however I don't have any non-English Windows
> here.

Indeed.

> Do you know if it's possible to download and install language
> packs and if they may affect the text in the version? If so, I could try
> to do it and see if I can reproduce the original issue.

I'm not sure whether that would make a difference.

On XP this does not make a difference - I've tested this with
a German Win XP version.

I think the best strategy is to run win32_ver() through the
pdb debugger in step-by-step mode and on the Vista machine
where you saw the problem.

BTW: Do you have the win32 tools installed on that machine ?

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 6, 2009, 3:34 AM

Post #7 of 9 (378 views)
Permalink
[issue3410] platform.version() don't work as expected in Vista in portuguese [In reply to]

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

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

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 6, 2009, 3:49 AM

Post #8 of 9 (378 views)
Permalink
[issue3410] platform.version() don't work as expected in Vista in portuguese [In reply to]

Marc-Andre Lemburg <mal [at] egenix> added the comment:

Ezio Melotti wrote:
> Ezio Melotti <ezio.melotti [at] gmail> added the comment:
>
> 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).

Ah, that makes sense: Vista support only got added in Python 2.6.
We cannot add that support to Python 2.5, since that branch is
closed.

Note however that platform.py does work with multiple Python versions,
so you can always copy the module from a later version and hand-replace
the one from the original distribution with an updated one.

> 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)

Thanks for checking.

> 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?

Interesting. In the German XP uses 'Version' as well, so the regexp
matches just fine.

I'll correct the regexp to only try matching on 'Ver\w+'.

> 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

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 6, 2009, 3:54 AM

Post #9 of 9 (383 views)
Permalink
[issue3410] platform.version() don't work as expected in Vista in portuguese [In reply to]

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

Won't that fail with Windows versions in Japanese, Chinese, Arab and
similar?
If 'Version' is translated in all the languages as a single word and
it's between whitespaces (or even between a [ and a space), \S+ should
be safe enough, otherwise \w+ with the re.U flag should work.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue3410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.