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

Slide slide.o.mix at gmail.com
Mon Nov 4 05:55:10 CET 2013


Can you file an issue on this on CodePlex?


On Sun, Nov 3, 2013 at 9:45 PM, Peter Schwalm <ps at peter-schwalm.de> wrote:

>  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 at python.org
> https://mail.python.org/mailman/listinfo/ironpython-users
>
>


-- 
Website: http://earl-of-code.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20131103/aeb3de7d/attachment.html>


More information about the Ironpython-users mailing list