[Python-talk] recognizing XP systems

Bill Sconce sconce at in-spec-inc.com
Fri Apr 14 16:55:44 EDT 2006


On Fri, 14 Apr 2006 15:01:52 -0400
Python <python at venix.com> wrote:

> I need to distinguish between NT family Windows and Win95/98/ME.  I use
> 	import os
> 	os.uname()[2]
> and look for '2000' and 'NT'.



Hm.  Tougher than it looks.

The Library Reference and MartelliBible (the Nutshell) both say you'll
get 'nt'.  The Nutshell says specifically, "'nt' (all kinds of 32-bit
Windows platforms)" (p 172).


Other thoughts:

    1. sys.platform     
        # "Contains a platform identifier" 
        # (Library Reference)
        # Returns 'linux2' here
    
    2. platform.platform()
        # "Returns ... as much useful information as possible"
        # (Library Reference)
        # Returns 'Linux-2.6.11-ln.std-i686-with-debian-3.1' here
        
Of course I'm no better off than Lloyd with respect to his original
question - namely, no Microsoft stuff to try it on.

-Bill


More information about the Python-talk mailing list