diff --git a/osinfo.py b/osinfo.py index fc8a8a18d4a..a109901e80a 100644 --- a/osinfo.py +++ b/osinfo.py @@ -1,7 +1,7 @@ # Script Name : osinfo.py # Author : Craig Richards # Created : 5th April 2012 -# Last Modified : 22nd February 2016 +# Last Modified : April 02 2016 # Version : 1.0 # Modifications : Changed the list to a dictionary. Although the order is lost, the info is with its label. @@ -12,7 +12,7 @@ profile = { 'Architecture: ': platform.architecture(), -'Linux Distribution: ': platform.linux_distribution(), +#'Linux Distribution: ': platform.linux_distribution(), 'mac_ver: ': platform.mac_ver(), 'machine: ': platform.machine(), 'node: ': platform.node(), @@ -27,5 +27,10 @@ 'version: ': platform.version(), } +if hasattr(platform, 'linux_distribution'): + #to avoid AttributeError exception in some old versions of the module + profile['linux_distribution'] = platform.linux_distribution() + #FIXME: do this for all properties but in a loop + for key in profile: print(key + str(profile[key]))