os.name

Emile van Sebille emile at fenx.com
Fri Jul 30 22:31:01 EDT 1999


By the way, in windows at a command prompt:

95,98:    net config
nt:       net config [server|workstation]

gives a line that starts : Software version

I thought I'd key in it a script real quick, but I don't have
enough time now to wrap it up.  Maybe it will get you started.


def getwinver():
 import os
 winver = None
 test = os.system('net config > xxconfig.net')
 if test == 0:
  f = open('xxconfig.net', 'r')
  config = f.readlines()
  f.close()
  for line in config:
   print line
   if line[:16] == "Software version":
    winver = line
 else:
  pass # test value is error code
 return winver



--

Emile van Sebille
emile at fenx.com
-------------------


Fredrik Lundh <fredrik at pythonware.com> wrote in message
news:001e01beda8e$2111d2e0$f29b12c2 at secret.pythonware.com...
> Emile van Sebille <emile at fenx.com> wrote:
> > >>> os.name
> > 'nt'
> > >>> os.environ('OS')
> > Traceback (innermost last):
> >   File "<pyshell#8>", line 1, in ?
> >     os.environ('OS')
> > AttributeError: no __call__ method defined
>
> Gordon asked you to try os.environ['OS'],
> not os.environ('OS') ;-)
>
> </F>
>






More information about the Python-list mailing list