sys.exit(1) if _BG: from settings_background import ENDPOINTS else: from settings import ENDPOINTS def forever_alone(): with open('forever.txt') as handle: return handle.read() # if run as a script, we kick in here if __name__ == "__main__": UMLS.import_snomed_if_necessary() if _BG: print "-> Running as a background app" # load all rules rules = Rule.load_rules() if len(rules) < 1: print "There are no rules, no point in continuing" print forever_alone() sys.exit(1) print "-> Did load %d %s" % (len(rules), 'rule' if 1 == len(rules) else 'rules') # multiple endpoints? Ask which one to use ep = None if len(ENDPOINTS) > 1: