If I've got a script that uses a config file (or defaults to a generic config file) that calls another module which needs the config file passed to it as a parameter should I always
File 1 (the script): /bin/runner
include doer.py ... initializing backup conf file backup_conf_file = "/etc/thing.conf" ... processing opts and args ... if ("backup_conf_file" in opts): backup_conf_file = arg doer.copy_thing(backup_conf_file)
File 2 (the module): /lib/doer.py:
def copy_thing(backup_conf_file="/etc/thing.conf"): """Do stuff"""
So, I obviously did something wrong above, but what is the right way to do it? I'd like to allow testing the script with a different conf file location and I'd like to allow testing the module with a different conf file location.
What I'd really love would be a feature where I can call
backup_conf_file=backup_conf_file or DEFAULT if None), but unless that exists and I don't know about it, what should I be doing here?