> *From:* "Schollnick, Benjamin" <[EMAIL PROTECTED]>
> *To:* <[email protected]>
> *Date:* Wed, 3 Aug 2005 15:21:53 -0400
>
> Anyone have any idea on how to get the Machine Name from the Sharing
> Preference pane?
import os
def get_system_info():
""" Use system_profiler command to return a dict of
information about system
"""
info_dict = {'systemversion': None,
'kernelversion': None,
'bootvolume': None,
'computername': None,
'username': None }
command = 'system_profiler SPSoftwareDataType'
fo = os.popen(command, 'r')
for line in fo.readlines():
ilist = line[:-1].split(':')
if len(ilist) >= 2:
for key in info_dict:
if key == ilist[0].replace(' ','').lower():
info_dict[key] = ilist[1]
return info_dict
print repr(get_system_info())
Regards,
David Hughes
Forestfield Software
www.foresoft.co.uk
_______________________________________________
Pythonmac-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig