[Ironpython-users] ipy 2.7.4 problem with platform.win32_ver()

Peter Schwalm ps at peter-schwalm.de
Mon Nov 4 05:45:09 CET 2013


Hello,

if I call platform.win32_ver() with ipy 2.7.4 I get the following exception:

IronPython 2.7.4 (2.7.0.40) on .NET 4.0.30319.1008 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
 >>> import platform
 >>> x = platform.win32_ver()
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "C:\Program Files (x86)\IronPython 2.7\Lib\platform.py", line 
615, in win32_ver
AttributeError: 'sys.getwindowsversion' object has no attribute 
'service_pack_major'

Line 615 is the underlined text in the program snippet from platform.py 
below:

     # Find out the registry key and some general version infos
     winver = GetVersionEx()
     maj,min,buildno,plat,csd = winver
     version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF)
     if hasattr(winver, "service_pack"):
         if winver.service_pack != "":
_csd = 'SP%s' % winver.service_pack_major_
     else:
         if csd[:13] == 'Service Pack ':
             csd = 'SP' + csd[13:]

In the previous version I used (2.7.1) this error did not occur. It 
looks that the underlying implementations of sys.getwindowsversion() in 
2.7.1 and 2.7.4 have a different behaviour:

- in 2.7.1 the function returns a tuple
- in 2.7.4 an object is delivered which has the attribute "service_pack" 
but not "service_pack_major"

Greeting and thank you in advance
Peter Schwalm


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20131104/cd4345a2/attachment.html>


More information about the Ironpython-users mailing list