How to find out operating system

Fredrik Lundh fredrik at pythonware.com
Thu Jun 27 17:47:49 EDT 2002


David LeBlanc wrote

> > > > You might try os.environ:
> > > > os.environ['WINOS'] -> WIN2000
> > > >
> > > > I don't know if WINOS is defined on '98 or ME, but
> > > > it should be good for NT, 2K and XP
> > >
> > > It is not.
> >
> > Neither is it defined on win2k pro:
> > KeyError: WINOS

> >>> import os
> >>> os.environ['WINOS']
> 'WIN2000'

on the other hand:

c:\> ver
Microsoft Windows 2000 [Version 5.00.2195]

(swedish version, all available service packs and
security patches)

c:\> python
Python 2.1.1 (#20, Aug 23 2001, 11:27:17) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ["WINOS"]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\py21\Lib\os.py", line 372, in __getitem__
    return self.data[key.upper()]
KeyError: WINOS

(fwiw, googling for WINOS brought up a whole bunch of
pages telling me that if I want to build mozilla, I need to
set the WINOS variable.  are you sure your computer
doesn't spend the nights building browsers, when you're
not looking?)

</F>





More information about the Python-list mailing list