from the documents inifile = linuxcnc.ini(sys.argv[1]) # inifile.find() returns None if the key wasnt found - the # following idiom is useful for setting a default value: machine_name = inifile.find("EMC", "MACHINE") or "unknown" print "machine name: ", machine_name