-xsetbg_conf = SafeConfigParser()
-xsetbg_conf.read(os.path.join(xsetbg_dir, 'xsetbg.conf'))
+for d in config_dirs:
+ xsetbg_conf_file = os.path.join(d, 'xsetbg.conf')
+ if os.path.exists(xsetbg_conf_file):
+ xsetbg_conf = SafeConfigParser()
+ xsetbg_conf.read(xsetbg_conf_file)
+ break
+else:
+ raise RuntimeError("Cannot find xsetbg.conf; searched %s", config_dirs)
+
+if __name__ == '__main__':
+ print "Config dirs:", config_dirs
+ print "Config file:", xsetbg_conf_file