platform system may be Windows or Microsoft since Vista

Discussion in 'Python' started by p.lavarre@ieee.org, Aug 31, 2007.

  1. Guest

    Let's suppose you get Python for Vista Windows today from
    http://www.python.org/download/.

    Should you then conclude that the tests:

    if platform.system() in ('Windows', 'Microsoft'):
    if not (platform.system() in ('Windows', 'Microsoft')):

    are now exactly what you should write for that 2.5.1 Python, when you
    must resort to os-specific tools like DeviceIoControl, in place of the
    slightly simpler tests that worked before:

    if platform.system() == 'Windows': # Microsoft
    if platform.system() != 'Windows': # Microsoft

    ?

    Curiously yours, thanks in advance,

    P.S. Groups search assures me clp hasn't previously reviewed: platform
    system Windows Microsoft

    P.P.S. I ask because this August I rediscovered this 28 May Python
    uname vs. Win kernel32.getVersionEx issue indexed by Google as
    follows:

    http://mail.python.org/pipermail/patches/2007-June/022947.html
    ....

    Patches item #1726668, was opened at 2007-05-28 03:23

    On Microsoft Vista platform.system() returns 'Microsoft' and
    platform.release() returns 'Windows'

    Under Microsoft Windows XP SP2 platform.system() returns 'Windows' and
    platform.release() returns 'XP'.

    This is problem was caused by a change in the output of the "ver"
    command. In Windows XP SP2 "ver" outputted 'Microsoft Windows XP
    [Version 5.1.2600]' In Microsoft Vista "ver" outputted 'Microsoft
    Windows [Version 6.0.6000]'. The lack of the 3rd word before version
    causes _syscmd_ver(...) in platform.py to return 'Microsoft' for
    system instead of 'Microsoft Windows'. This causes uname() to return
    the incorrect values. Both system() and release() call uname().

    ....
     
    , Aug 31, 2007
    #1
    1. Advertising

  2. Klaas Guest

    On Aug 31, 9:47 am, wrote:
    > Let's suppose you get Python for Vista Windows today fromhttp://www.python.org/download/.
    >
    > Should you then conclude that the tests:
    >
    > if platform.system() in ('Windows', 'Microsoft'):
    > if not (platform.system() in ('Windows', 'Microsoft')):


    Good analysis. Log a bug @ bugs.python.org

    -Mike
     
    Klaas, Aug 31, 2007
    #2
    1. Advertising

  3. Guest

    > > suppose you get Python for Vista Windows today
    > > if platform.system() in ('Windows', 'Microsoft'):
    > > if not (platform.system() in ('Windows', 'Microsoft')):

    >
    > Good analysis.


    Yes I am sane!! Thank you for saying.

    > Log a bug @ bugs.python.org


    Glad to hear I can help. I created:

    http://bugs.python.org/issue1082
    TITLE = (no priority set) platform system may be Windows or Microsoft
    since Vista
    CREATOR =

    The Search Tracker there now finds this bug within: platform system
    Windows Microsoft

    Thanks again for clueing me in promptly,

    P.S. http://bugs.python.org/issue1082 now includes the musings:

    NOTES:

    There is no fixing all of this?

    Cross-platform scripts actually will misbehave across the large
    population that is 2.5 Python in Vista unless those scripts change to
    implement something like the suggested workaround, that's now an
    accomplished fact.

    Question: Is it better to leave this feature as is, so that everyone
    eventually learns to workaround it, or is it better to fix it late now
    in 2007-09, so that many people never have to learn to workaround it?

    Question: Why are we screen-scraping the Ver command, instead of
    calling Win kernel32.getVersionEx? And how can any code for screen-
    scraping the Ver command be in doubt about whether the platform.system
    underneath is 'Windows'?

    P.P.S.

    http://wiki.python.org/moin/SubmittingBugs
    is the page that newbie Python bug reporters should read first, I
    guess

    My path to that page was as follows ...

    > Log a bug @ bugs.python.org


    Indeed the Search Tracker finds no hits at: platform system Windows
    Microsoft

    Vaguely feels like e-mail registration required? Ick. Ok. Ah, the
    Issues > Create New menu item appears after login, good.

    Those bug Types are labeled in English but otherwise undefined. (Later
    I see I could contribute my guess of definitions at
    http://wiki.python.org/moin/TrackerDocs/.) I guess surprising result
    values like I'm seeing count as 'Behavior' else 'RFE' else 'Security',
    but not in ('Crash', 'Compile', 'Resource Usage'). I guess by RFE we
    mean a wish, i.e., a Request For Enhancement.

    Ok then:

    TITLE: platform system may be Windows or Microsoft since Vista
    TYPE: Behavior
    SEVERITY: Major (not Critical, Urgent, Normal, Minor)
    COMPONENTS: Windows

    All the "process" fields I guess I should leave blank. Somehow there
    is no place to describe the bug in detail??? I guess I Submit New
    entry anyhow ... Oh no, not actually. There is online help of Wiki
    quality!!

    Clicking thru that online help eventually explains:

    """
    Change Note: describe the problem in detail, including what you
    expected to happen and what did happen. Be sure to include whether any
    extension modules were involved, and what hardware and software
    platform you were using (including version information as
    appropriate).
    """

    Thus, I wrote ...

    SUMMARY:

    'Microsoft' is the platform.system() of Vista Windows, whereas
    'Windows' was the platform.system() of XP Windows, whoops.

    STEPS TO REPRODUCE & ACTUAL RESULTS:

    Run 2.5.1 Python in a Vista and see:

    >>> import platform
    >>> platform.system()
    >>>

    'Microsoft'
    >>>


    EXPECTED RESULTS:

    >>> import platform
    >>> platform.system()

    'Windows'
    >>>


    WORKAROUND:

    Write new Python source code like:

    if platform.system() in ('Windows', 'Microsoft'):
    if not (platform.system() in ('Windows', 'Microsoft')):

    in place of obsolete Python source code like:

    if platform.system() == 'Windows': # Microsoft
    if platform.system() != 'Windows': # Microsoft

    REGRESSION/ ISOLATION:

    Seen by me in an Enterprise Vista. Indexed by Google as reported by
    Martin v. Löwis (loewis) circa 2007-05-29 07:11 as:

    http://mail.python.org/pipermail/patches/2007-June/022947.html
    ....

    Patches item #1726668, was opened at 2007-05-28 03:23

    On Microsoft Vista platform.system() returns 'Microsoft' and
    platform.release() returns 'Windows'

    Under Microsoft Windows XP SP2 platform.system() returns 'Windows' and
    platform.release() returns 'XP'.

    This is problem was caused by a change in the output of the "ver"
    command. In Windows XP SP2 "ver" outputted 'Microsoft Windows XP
    [Version 5.1.2600]' In Microsoft Vista "ver" outputted 'Microsoft
    Windows [Version 6.0.6000]'. The lack of the 3rd word before version
    causes _syscmd_ver(...) in platform.py to return 'Microsoft' for
    system instead of 'Microsoft Windows'. This causes uname() to return
    the incorrect values. Both system() and release() call uname().

    NOTES:

    [as above]
     
    , Sep 1, 2007
    #3
  4. Guest

    > > Log a bug @ bugs.python.org
    >
    > http://bugs.python.org/issue1082
    > TITLE ... platform system may be Windows or Microsoft since Vista


    Six days gone with no feedback. Something wrong with the input?

    Maybe the blank Priority field?

    I agree Severity Major.

    I'm thinking no priority because there is no fixing this. We now
    choose between two wrong ways to change the Python Msi installer of
    Windows:

    1. Hide that many people now and for months or years to come will
    continue to need both halves of the (platform.system() in ('Windows',
    'Microsoft') guard.

    2. Leave unchanged to require many more people to need both halves in
    future.

    I find neither choice inspiring.
     
    , Sep 7, 2007
    #4
  5. In message <>,
    wrote:

    > I'm thinking no priority because there is no fixing this.


    Why are you bothering to check an informational string? Why not check
    directly for the functionality you need?
     
    Lawrence D'Oliveiro, Sep 8, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page