[Tutor] How can I get the hostid of a computer?

Lance lbrannma@cablespeed.com
Sat, 19 Oct 2002 11:01:33 -0700


Thanks,.. but this is what I get with the uname method:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in ?
    host = os.uname()[2]
AttributeError: 'module' object has no attribute 'uname'

----- Original Message -----
From: <lumbricus@gmx.net>
To: <tutor@python.org>
Sent: Saturday, October 19, 2002 10:34 AM
Subject: Re: [Tutor] How can I get the hostid of a computer?


> Hi!
>
> > At 16:23 2002-10-18 -0700, Lance wrote:
>
> [ snip ]
>
> > E.g. in Linux:
> >  >>> import os
> >  >>> host = os.popen('uname -n').read().strip()
> >  >>> print host
> > palanga.ume1.thinkware.se
>
> Better:
>
> >>> import os
> >>> host=os.uname()[1]
>
> HTH, J"o!
>
>
> --
> Wir beschliessen etwas, stellen das dann in
> den Raum und warten dann einige Zeit ab, was
> passiert. Wenn es dann kein grosses Geschrei
> gibt und keine Aufstaende, weil die meisten
> gar nicht begreifen, was da beschlossen
> wurde, dann machen wir weiter - Schritt fuer
> Schritt, bis es kein Zurueck mehr gibt.
>    -- J-C Juncker
>
> +++ GMX - Mail, Messaging & more  http://www.gmx.net +++
> NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>