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


_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
https://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to