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

Magnus Lycka magnus@thinkware.se
Sat, 19 Oct 2002 19:03:57 +0200


At 16:23 2002-10-18 -0700, Lance wrote:
>Any advice would be appreciated.

I don't know of any OS independent way.
I'm not even sure what you mean by hostid.
Host name? Domain name? NETBIOS name?

If you have a way to get this "hostid" from
the command line in the OS, it's trivial
to get it from within Python.

E.g. in Linux:
 >>> import os
 >>> host = os.popen('uname -n').read().strip()
 >>> print host
palanga.ume1.thinkware.se



-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se