Message11164

Author stefan.richthofer
Recipients stefan.richthofer
Date 2017-03-03.13:27:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488547647.07.0.545962815118.issue2561@psf.upfronthosting.co.za>
In-reply-to
Content
Jython 2.7.1rc1 (, Mär 3 2017, 13:27:02)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.win32_ver()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\workspace\linux\Jython\ssh\jython\dist\Lib\platform.py", line 600, in win32_ver
    import _winreg
ImportError: No module named _winreg


This is 'caused' by the fix for #2553. However win32_ver also wasn't workable before that. Only difference was that it didn't raise an exception but returned empty strings instead.
Looking at what CPython says, win32_ver would return:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.win32_ver()
('10', '10.0.14393', '', u'Multiprocessor Free')

We can easily emulate the first two values. Only the build-type would be hairy to get. It's only reachable via API command, or rather invonveniently via systeminfo cmd-call (hardly possible to parse, because line-captions are localized). So I' suggest to just fill in the first two entries - better than exception or all strings empty.

In long term we might be able to improve this using JNR or by supporting the win32api extension.
History
Date User Action Args
2017-03-03 13:27:27stefan.richthofersetrecipients: + stefan.richthofer
2017-03-03 13:27:27stefan.richthofersetmessageid: <1488547647.07.0.545962815118.issue2561@psf.upfronthosting.co.za>
2017-03-03 13:27:26stefan.richthoferlinkissue2561 messages
2017-03-03 13:27:26stefan.richthofercreate