def __get_selector(self): if self.paras.selector_file: try: selector = Selector(location=self.paras.selector_file) self.last_directory = os.path.dirname(self.paras.selector_file) LOG.debug("Loaded selector from %s" % self.paras.selector_file) except Exception as err: self.warn( "Unable to read selector file '%s'" % self.paras.selector_file, err) selector = Selector() else: selector = Selector() #Difficult keeping track of a selector that is not saved: if selector.location is None: selector_dir = os.path.join(Configurations.rspub_config_dir(), "selectors") os.makedirs(selector_dir, exist_ok=True) location = os.path.join(selector_dir, "default_selector.csv") if os.path.exists(location): selector = Selector(location=location) else: selector.write(location) self.paras.selector_file = location return selector
def test_rspub_config_dir(self): print(Configurations.rspub_config_dir())