[Pythonmac-SIG] Getting Sharing name of the Macintosh viaPython?
brad.allen@omsdal.com
brad.allen at omsdal.com
Sat Aug 6 02:00:04 CEST 2005
I've long been successfully using this hack I found at macosxhints.com:
/usr/bin/awk '/ComputerName/ {{{getline} print
substr($0,12,length($0)-20)} exit}'
/Library/Preferences/SystemConfiguration/preferences.plist
The output of this command can of course be parsed by Python.
A better way would be to use plistlib to parse the preferences.plist file,
but I just never
got around to it since the awk thing has been working reliably.
Brad Allen
IT Desktop Support
brad.allen at omsdal.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20050805/928448a3/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 18067 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20050805/928448a3/attachment-0001.jpeg
More information about the Pythonmac-SIG
mailing list