def _get_logger(cls, logger_name): """ Return the logger for the given class name """ if not cls.__INITIALIZED__ : conf_file = None debug = False try: conf_file = Conf.get_instance().get('Logging', 'conf_file', None) logging.addLevelName(LoggerFactory.DISABLED, "DISABLED") debug = Conf.get_instance().getboolean('Logging', 'debug', False) if debug is True: print 'debug ' + str(debug) + ',initializing logging, using ' + conf_file logging.config.fileConfig(conf_file) #add console handler: specific for RNPicker Apps cls._add_console_handler() except Exception, ex: #pylint: disable-msg=W0703 err_msg = str(ex) if conf_file and not cls.__check_conf_file_exist__(conf_file): err_msg = ('file ' + conf_file + ' not found') if debug is True: print 'logging configuration error, ' + err_msg print traceback.print_exc(10, sys.stderr) cls.__INITIALIZED__ = True
def setUp(self): # necessary for the include with the VAR ENV substitution os.environ["DIRCONFENV"] = self._get_tests_dir_path() self.conf = Conf(use_resource=False) fp = open('%s/%s' % (self._get_tests_dir_path(), "test.config")) self.conf._read(fp, "the file") #IGNORE:W0212
def __init__(self,stuff): super(TestSAMPMLCreator,self).__init__(stuff) myBasicLoggingConfig() os.environ['RNPICKER_CONF_DIR'] = self._get_tests_dir_path() os.environ[Conf.ENVNAME] = '%s/%s'%(self._get_tests_dir_path(),'rnpicker.config') # create an empty shell Conf object self.conf = Conf.get_instance() self.mainDatabase = None self.mainUser = None self.mainPassword = None self.mainConn = None self.mainActivateTimer = False self.ParticulateArchiveDatabaseAccess = None self.archiveUser = None self.archivePassword = None self.archiveActivateTimer = False self.archConn = None self.xpath_calIDs = None self.xpath_specalIDs = None self.nbDatabase = None self.nbUser = None self.nbPassword = None self.nbActivateTimer = False self.nbConn = None TestSAMPMLCreator.c_log.info("\n********************************************************************************\n rnpicker modules are loaded from %s\n********************************************************************************\n"%(self._get_tests_dir_path()))
def _load_configuration(self,a_args): """ try to load the configuration from the config file. priority rules: if --conf_dir is set, try to read a dir/rnpicker.config. Otherwise look for RNPICKER_CONF_DIR env var Args: None Returns: return a conf object Raises: exception """ #read from command_line dir = a_args.get('conf_dir',None) #try to read from env if dir == None: dir = os.environ.get('RNPICKER_CONF_DIR',None) else: #always force the ENV Variable os.environ['RNPICKER_CONF_DIR'] = dir if dir is None: raise ConfAccessError('The conf dir needs to be set from the command line or using the env variable RNPICKER_CONF_DIR') if os.path.isdir(dir): os.environ[Conf.ENVNAME] = '%s/%s'%(dir,'rnpicker.config') return Conf.get_instance() else: raise ConfAccessError('The conf dir %s set with the env variable RNPICKER_CONF_DIR is not a dir'%(dir))
def pretty_print_xml(aFDescriptor, aOutput): """ xml pretty printing from a stream. Take a file descriptor (fd or StringIO for example """ # str = aFDescriptor.read() # print " Result = %s\n"%(str) # f = open("/tmp/res.xml","w") # f.write(str) # f.flush() # f.close() offset = 0 is_xml = False while not is_xml: c = aFDescriptor.read(1) if c == "<": is_xml = True else: offset += 1 if is_xml == True: aFDescriptor.seek(offset) tree = etree.parse(aFDescriptor) # get xslt stylesheet doing the transformation xsltPath = Conf.get_instance().get("Transformer", "xsltPrettyPrinter") transform = etree.XSLT(etree.parse(open(xsltPath))) result = transform(tree) ctbto.common.utils.printInFile(str(result), aOutput) else: raise Exception("Error. The file %s doesn't seems to be an XML file. Check its content")
def setUp(self): # necessary for the include with the VAR ENV substitution os.environ["DIRCONFENV"] = self._get_tests_dir_path() self.conf = Conf(use_resource=False) fp = open('%s/%s' % (self._get_tests_dir_path(), "test.config")) self.conf._read(fp,"the file") #IGNORE:W0212
def _add_console_handler(cls): """ add the specific console handler for RNPicker programs """ #create console handler console = logging.StreamHandler() console_formatter = logging.Formatter("%(levelname)s - %(message)s") console_filter = logging.Filter(Conf.get_instance().get('Logging', 'consoleFilter', 'Runner')) console.setFormatter(console_formatter) console.addFilter(console_filter) logging.root.addHandler(console)
def test_use_conf_ENVNAME_resource(self): """testUseConfENVNAMEResource: Use default resource ENVNAME to locate conf file""" self._create_fake_conf_file_in_tmp() # need to setup the ENV containing the the path to the conf file: os.environ[Conf.ENVNAME] = "/tmp/fake_conf.config" self.conf = Conf.get_instance() s = self.conf.get("MainDatabaseAccess","driverClassName") self.assertEqual(s,'oracle.jdbc.driver.OracleDriver')
def test_use_conf_ENVNAME_resource(self): """testUseConfENVNAMEResource: Use default resource ENVNAME to locate conf file""" self._create_fake_conf_file_in_tmp() # need to setup the ENV containing the the path to the conf file: os.environ[Conf.ENVNAME] = "/tmp/fake_conf.config" self.conf = Conf.get_instance() s = self.conf.get("MainDatabaseAccess", "driverClassName") self.assertEqual(s, 'oracle.jdbc.driver.OracleDriver')
def __init__( self, aDataPath, aID, aRemoteOffset, aRemoteSize, aRemoteHostname=None, aRemoteScript=None, aRemoteUser=None, aLocalDir=None, a_DoNotUseCache=False, a_LocalFilename=None, ): # my variables super(RemoteArchiveDataSource, self).__init__(aDataPath, aID, aRemoteOffset, aRemoteSize) # get reference to the conf object self._conf = Conf.get_instance() self._remoteScript = ( self._conf.get("RemoteAccess", "archiveAccessScript") if aRemoteScript == None else aRemoteScript ) self._remoteHostname = ( self._conf.get("RemoteAccess", "archiveAccessHost") if aRemoteHostname == None else aRemoteHostname ) self._remoteUser = ( self._conf.get("RemoteAccess", "archiveAccessUser", self._getCurrentUser()) if aRemoteUser == None else aRemoteUser ) self._localDir = self._conf.get("RemoteAccess", "localDir") if aLocalDir == None else aLocalDir self._cachingActivated = ( self._conf.getboolean("RemoteAccess", "activateDataFileCaching") if (self._conf.has_option("RemoteAccess", "activateDataFileCaching") and a_DoNotUseCache == False) else False ) self._localFilename = ( "%s_%s.%s" % (os.path.basename(self._remotePath), self._id, self._getExtension(self._remotePath)) if a_LocalFilename == None else a_LocalFilename ) self._getRemoteFile() self._log = LoggerFactory.get_logger(self)
def main(): os.environ['RNPICKER_CONF_DIR'] = '/home/aubert/dev/src-reps/java-balivernes/RNpicker/etc/conf' os.environ[Conf.ENVNAME] = '%s/%s'%(os.environ['RNPICKER_CONF_DIR'],'rnpicker.config') # parameter for remote file access remote_script = '%s/%s' % ( os.environ['RNPICKER_CONF_DIR'], 'scripts/generic_remote_extraction.sh') remote_host = 'kuredu' remote_user = '******' # begin and end date a_begin_date = '2007-01-01' a_end_date = '2007-01-05' dest_dir = "/tmp/data" Conf.get_instance() archive_db = 'oracle://*****:*****@moorea.ctbto.org' idcdev_db = 'oracle://*****:*****@idcdev.ctbto.org' rn_extractor = RNArchiveExctractor(a_input_url=archive_db, a_output_url='oracle://*****:*****@172.27.71.153/orcl', a_destination_dir = dest_dir, a_remote_hostname = remote_host, a_remote_script= remote_script, a_remote_user = remote_user) rn_extractor.copy_from_rn_archive_database(a_begin_date, a_end_date, a_has_to_drop_tables = False)
def print_general_exception(a_exception, a_parsed_args): """ print general exception. Complex case depending on the passed options and the fact the console handler might not have been instanciated. """ # check that the console hanlder has been set by the factory if LoggerFactory.is_console_handler_set(): LoggerFactory.get_logger("Runner").error( "%s. For more information see the log file %s.\nTry `generate_NG_arr --help (or -h)' for more information." % (a_exception, Conf.get_instance().get("Logging", "fileLogging", "/tmp/rnpicker.log")) ) if a_parsed_args.get("verbose", 1) == 3: a_logger = LoggerFactory.get_logger("Runner").error else: a_logger = Runner.log_in_file a_logger("Traceback: %s." % (get_exception_traceback())) else: # cannot get general logger so print print ("Fatal Error: Traceback: %s." % (get_exception_traceback()))
def __init__(self, aDataPath, aID, aRemoteOffset, aRemoteSize): self.len = 0 self.buflist = [] self.pos = 0 self.closed = False self.softspace = 0 # my variables # get reference to the conf object self._conf = Conf.get_instance() self._remotePath = aDataPath self._id = aID self._localDir = self._conf.get("RemoteAccess", "localDir") self._cachingActivated = self._conf.getboolean("RemoteAccess", "activateDataFileCaching", False) self._localFilename = ( self._conf.get("RemoteAccess", "localFilename") if self._conf.has_option("RemoteAccess", "localFilename") else None ) self._fd = None # these two options are only read in the ArchiveDataSource for the moment. # This should be generalized to all Files and the hierachy might disapear ? # where to point in the file self._remoteOffset = aRemoteOffset # Size to read self._remoteSize = aRemoteSize self._log = LoggerFactory.get_logger(self)
def run(): parsed_args = {} try: parsed_args = parse_arguments(sys.argv[1:]) # very special case: run the automatic case # the Runner is bypassed if parsed_args['automatic_tests']: run_automatic_tests() Runner.load_configuration(parsed_args) conf_file = Conf.get_instance().get('log', 'conf_file', '/home/aubert/workspace/RNpicker/etc/conf/logging_rnpicker.config') runner = Runner(parsed_args) runner.execute(parsed_args) except ParsingError, e: # Not Runner set print print("Error - %s"%(e.get_message_error())) usage() sys.exit(2)
def __init__(self, a_args): super(Runner, self).__init__() # create an empty shell Conf object self._conf = Conf.get_instance() self._log = LoggerFactory.get_logger("Runner") # setup the prod database and connect to it self._ngDatabase = self._conf.get("NobleGazDatabaseAccess", "hostname") self._ngUser = self._conf.get("NobleGazDatabaseAccess", "user") self._ngPassword = self._conf.get("NobleGazDatabaseAccess", "password") self._ngActivateTimer = self._conf.getboolean("NobleGazDatabaseAccess", "activateTimer", True) if self._conf.getboolean("NobleGazDatabaseAccess", "obfuscatePassword", False): self._ngPassword = ctbto.common.utils.deobfuscate_string(self._ngPassword) # create DB connector self._ngMainConn = DatabaseConnector(self._ngDatabase, self._ngUser, self._ngPassword, self._ngActivateTimer) # setup the archive database and connect to it self._ArchiveDatabaseAccess = self._conf.get("ArchiveDatabaseAccess", "hostname") self._archiveUser = self._conf.get("ArchiveDatabaseAccess", "user") self._archivePassword = self._conf.get("ArchiveDatabaseAccess", "password") if self._conf.getboolean("ArchiveDatabaseAccess", "obfuscatePassword", False): self._archivePassword = ctbto.common.utils.deobfuscate_string(self._archivePassword) self._archiveActivateTimer = self._conf.getboolean("ArchiveDatabaseAccess", "activateTimer", True) # create DB connector self._ngArchConn = DatabaseConnector( self._ArchiveDatabaseAccess, self._archiveUser, self._archivePassword, self._archiveActivateTimer ) # connect to the DBs self._ngMainConn.connect() self._ngArchConn.connect()
def __init__(self,): """ constructor """ # get reference to the conf object self._conf = Conf.get_instance() self._log = LoggerFactory.get_logger(self)
class TestConf(unittest.TestCase): def _get_tests_dir_path(self): """ get the org.ctbto.conf.tests path depending on where it is defined """ fmod_path = org.ctbto.conf.__path__ test_dir = "%s/tests"%fmod_path[0] return test_dir def setUp(self): # necessary for the include with the VAR ENV substitution os.environ["DIRCONFENV"] = self._get_tests_dir_path() self.conf = Conf(use_resource=False) fp = open('%s/%s' % (self._get_tests_dir_path(), "test.config")) self.conf._read(fp,"the file") #IGNORE:W0212 def test_print_module_path(self): print("org.ctbto.conf module is loaded from %s\n" % (self._get_tests_dir_path())) def test_get_objects(self): """testGetObjects: test getter from all types """ # get simple string astring = self.conf.get("GroupTest1", "astring") self.assertEqual(astring,"oracle.jdbc.driver.OracleDriver") # get an int aint = self.conf.getint("GroupTest1", "aint") self.assertEqual(aint,10) # get floatcompile the statements afloat = self.conf.getfloat("GroupTest1", "afloat") self.assertEqual(afloat,5.24) # get different booleans form abool1 = self.conf.getboolean("GroupTest1", "abool1") self.assertEqual(abool1, True) abool2 = self.conf.getboolean("GroupTest1", "abool2") self.assertEqual(abool2, False) abool3 = self.conf.getboolean("GroupTest1", "abool3") self.assertEqual(abool3, True) abool4 = self.conf.getboolean("GroupTest1", "abool4") self.assertEqual(abool4 ,False) def test_get_defaults(self): """testGetDefaults: test defaults values """ # get all defaults astring = self.conf.get("GroupTest","astring","astring") self.assertEqual(astring,"astring") # get an default for int aint = self.conf.getint("GroupTest","aint",2) self.assertEqual(aint,2) # get float afloat = self.conf.getfloat("GroupTest","afloat",10.541) self.assertEqual(afloat,10.541) abool1 = self.conf.getboolean("GroupTest","abool1",True) self.assertEqual(abool1,True) abool2 = self.conf.getboolean("GroupTest","abool2",False) self.assertEqual(abool2,False) # existing group no option abool5 = self.conf.getboolean("GroupTest1","abool32",False) self.assertEqual(abool5,False) def test_var_substitutions(self): """testVarSubstitutions: test variables substitutions""" # simple substitution apath = self.conf.get("GroupTestVars","path") self.assertEqual(apath,"/foo/bar//tmp/foo/bar/bar/foo") # multiple substitution apath = self.conf.get("GroupTestVars","path1") self.assertEqual(apath,"/foo//tmp/foo/bar//foo/bar//tmp/foo/bar/bar/foo/bar") # nested substitution nested = self.conf.get("GroupTestVars","nested") self.assertEqual(nested,"this is done") def test_include(self): """testInclude: test includes """ val = self.conf.get("IncludedGroup","hello") self.assertEqual(val,'foo') def _create_fake_conf_file_in_tmp(self): f = open('/tmp/fake_conf.config','w') f.write('\n[MainDatabaseAccess]\n') f.write('driverClassName=oracle.jdbc.driver.OracleDriver') f.flush() f.close() def test_use_conf_ENVNAME_resource(self): """testUseConfENVNAMEResource: Use default resource ENVNAME to locate conf file""" self._create_fake_conf_file_in_tmp() # need to setup the ENV containing the the path to the conf file: os.environ[Conf.ENVNAME] = "/tmp/fake_conf.config" self.conf = Conf.get_instance() s = self.conf.get("MainDatabaseAccess","driverClassName") self.assertEqual(s,'oracle.jdbc.driver.OracleDriver') def test_read_from_CLI(self): """testReadFromCLI: do substitutions from command line resources""" #set environment os.environ["TESTENV"] = "/tmp/foo/foo.bar" val = self.conf.get("GroupTest1","fromenv") self.assertEqual(val,'/mydir//tmp/foo/foo.bar') #set cli arg sys.argv.append("--LongName") sys.argv.append("My Cli Value") val = self.conf.get("GroupTest1","fromcli1") self.assertEqual(val,'My Cli Value is embedded') #check with a more natural cli value val = self.conf.get("GroupTest1","fromcli2") self.assertEqual(val,'My Cli Value is embedded 2') def test_read_from_ENV(self): """testReadFromENV: do substitutions from ENV resources""" #set environment os.environ["TESTENV"] = "/tmp/foo/foo.bar" val = self.conf.get("ENV","TESTENV") self.assertEqual(val,"/tmp/foo/foo.bar") #set cli arg sys.argv.append("--LongName") sys.argv.append("My Cli Value") val = self.conf.get("CLI","LongName") self.assertEqual(val,"My Cli Value") # get a float from env os.environ["TESTENV"] = "1.05" val = self.conf.getfloat("ENV","TESTENV") self.assertEqual(val+1,2.05) def test_print_content(self): """ test print content """ #set environment os.environ["TESTENV"] = "/tmp/foo/foo.bar" #set cli arg sys.argv.append("--LongName") sys.argv.append("My Cli Value") substitute_values = True result = self.conf.print_content( substitute_values ) self.assertNotEqual(result, '') def test_value_as_List(self): """ Value as List """ the_list = self.conf.getlist('GroupTestValueStruct','list') self.assertEqual(the_list,['a', 1, 3]) def test_value_as_dict(self): """Dict as Value """ the_dict = self.conf.get_dict('GroupTestValueStruct','dict') self.assertEqual(the_dict, {'a': 2, 'b': 3}) def test_complex_dict(self): """ complex dict """ the_dict = self.conf.get_dict('GroupTestValueStruct','complex_dict') self.assertEqual(the_dict, {'a': 2, 'c': {'a': 1, 'c': [1, 2, 3], 'b': [1, 2, 3, 4, 5, 6, 7]}, 'b': 3}) def test_dict_error(self): """ error with a dict """ try: self.conf.get_dict('GroupTestValueStruct','dict_error') except Exception, err: self.assertEquals(err.message, "Expression \"{1:2,'v b': a\" cannot be converted as a dict.") return self.fail('Should never reach that point')
class TestConf(unittest.TestCase): def _get_tests_dir_path(self): """ get the org.ctbto.conf.tests path depending on where it is defined """ fmod_path = org.ctbto.conf.__path__ test_dir = "%s/tests" % fmod_path[0] return test_dir def setUp(self): # necessary for the include with the VAR ENV substitution os.environ["DIRCONFENV"] = self._get_tests_dir_path() self.conf = Conf(use_resource=False) fp = open('%s/%s' % (self._get_tests_dir_path(), "test.config")) self.conf._read(fp, "the file") #IGNORE:W0212 def test_print_module_path(self): print("org.ctbto.conf module is loaded from %s\n" % (self._get_tests_dir_path())) def test_get_objects(self): """testGetObjects: test getter from all types """ # get simple string astring = self.conf.get("GroupTest1", "astring") self.assertEqual(astring, "oracle.jdbc.driver.OracleDriver") # get an int aint = self.conf.getint("GroupTest1", "aint") self.assertEqual(aint, 10) # get floatcompile the statements afloat = self.conf.getfloat("GroupTest1", "afloat") self.assertEqual(afloat, 5.24) # get different booleans form abool1 = self.conf.getboolean("GroupTest1", "abool1") self.assertEqual(abool1, True) abool2 = self.conf.getboolean("GroupTest1", "abool2") self.assertEqual(abool2, False) abool3 = self.conf.getboolean("GroupTest1", "abool3") self.assertEqual(abool3, True) abool4 = self.conf.getboolean("GroupTest1", "abool4") self.assertEqual(abool4, False) def test_get_defaults(self): """testGetDefaults: test defaults values """ # get all defaults astring = self.conf.get("GroupTest", "astring", "astring") self.assertEqual(astring, "astring") # get an default for int aint = self.conf.getint("GroupTest", "aint", 2) self.assertEqual(aint, 2) # get float afloat = self.conf.getfloat("GroupTest", "afloat", 10.541) self.assertEqual(afloat, 10.541) abool1 = self.conf.getboolean("GroupTest", "abool1", True) self.assertEqual(abool1, True) abool2 = self.conf.getboolean("GroupTest", "abool2", False) self.assertEqual(abool2, False) # existing group no option abool5 = self.conf.getboolean("GroupTest1", "abool32", False) self.assertEqual(abool5, False) def test_var_substitutions(self): """testVarSubstitutions: test variables substitutions""" # simple substitution apath = self.conf.get("GroupTestVars", "path") self.assertEqual(apath, "/foo/bar//tmp/foo/bar/bar/foo") # multiple substitution apath = self.conf.get("GroupTestVars", "path1") self.assertEqual( apath, "/foo//tmp/foo/bar//foo/bar//tmp/foo/bar/bar/foo/bar") # nested substitution nested = self.conf.get("GroupTestVars", "nested") self.assertEqual(nested, "this is done") def test_include(self): """testInclude: test includes """ val = self.conf.get("IncludedGroup", "hello") self.assertEqual(val, 'foo') def _create_fake_conf_file_in_tmp(self): f = open('/tmp/fake_conf.config', 'w') f.write('\n[MainDatabaseAccess]\n') f.write('driverClassName=oracle.jdbc.driver.OracleDriver') f.flush() f.close() def test_use_conf_ENVNAME_resource(self): """testUseConfENVNAMEResource: Use default resource ENVNAME to locate conf file""" self._create_fake_conf_file_in_tmp() # need to setup the ENV containing the the path to the conf file: os.environ[Conf.ENVNAME] = "/tmp/fake_conf.config" self.conf = Conf.get_instance() s = self.conf.get("MainDatabaseAccess", "driverClassName") self.assertEqual(s, 'oracle.jdbc.driver.OracleDriver') def test_read_from_CLI(self): """testReadFromCLI: do substitutions from command line resources""" #set environment os.environ["TESTENV"] = "/tmp/foo/foo.bar" val = self.conf.get("GroupTest1", "fromenv") self.assertEqual(val, '/mydir//tmp/foo/foo.bar') #set cli arg sys.argv.append("--LongName") sys.argv.append("My Cli Value") val = self.conf.get("GroupTest1", "fromcli1") self.assertEqual(val, 'My Cli Value is embedded') #check with a more natural cli value val = self.conf.get("GroupTest1", "fromcli2") self.assertEqual(val, 'My Cli Value is embedded 2') def test_read_from_ENV(self): """testReadFromENV: do substitutions from ENV resources""" #set environment os.environ["TESTENV"] = "/tmp/foo/foo.bar" val = self.conf.get("ENV", "TESTENV") self.assertEqual(val, "/tmp/foo/foo.bar") #set cli arg sys.argv.append("--LongName") sys.argv.append("My Cli Value") val = self.conf.get("CLI", "LongName") self.assertEqual(val, "My Cli Value") # get a float from env os.environ["TESTENV"] = "1.05" val = self.conf.getfloat("ENV", "TESTENV") self.assertEqual(val + 1, 2.05) def test_print_content(self): """ test print content """ #set environment os.environ["TESTENV"] = "/tmp/foo/foo.bar" #set cli arg sys.argv.append("--LongName") sys.argv.append("My Cli Value") substitute_values = True result = self.conf.print_content(substitute_values) self.assertNotEqual(result, '') def test_value_as_List(self): """ Value as List """ the_list = self.conf.getlist('GroupTestValueStruct', 'list') self.assertEqual(the_list, ['a', 1, 3]) def test_value_as_dict(self): """Dict as Value """ the_dict = self.conf.get_dict('GroupTestValueStruct', 'dict') self.assertEqual(the_dict, {'a': 2, 'b': 3}) def test_complex_dict(self): """ complex dict """ the_dict = self.conf.get_dict('GroupTestValueStruct', 'complex_dict') self.assertEqual( the_dict, { 'a': 2, 'c': { 'a': 1, 'c': [1, 2, 3], 'b': [1, 2, 3, 4, 5, 6, 7] }, 'b': 3 }) def test_dict_error(self): """ error with a dict """ try: self.conf.get_dict('GroupTestValueStruct', 'dict_error') except Exception, err: self.assertEquals( err.message, "Expression \"{1:2,'v b': a\" cannot be converted as a dict.") return self.fail('Should never reach that point')
usage() sys.exit(2) except ConfAccessError, e: # Not Runner set print print("Error - %s"%(e.get_message_error())) if parsed_args.get('verbose',1) == 3: print("Traceback: %s."%(get_exception_traceback())) usage() sys.exit(2) except LoggingSetupError, e: # Not Runner set print print("Error - %s"%(e.get_message_error())) sys.exit(2) except Exception, e: #IGNORE:W0703,W0702 try: LoggerFactory.get_logger("Runner").error("Error: %s. For more information see the log file %s.\nTry `generate_arr --help (or -h)' for more information."%(e,Conf.get_instance().get('Logging','fileLogging','/tmp/rnpicker.log'))) if parsed_args.get('verbose',1) == 3: a_logger = LoggerFactory.get_logger("Runner") else: a_logger = Runner.log_in_file a_logger("Traceback: %s."%(get_exception_traceback())) except: print("Fatal error that could not be logged properly. print Traceback in stdout: %s."%(get_exception_traceback())) #IGNORE:W0702 finally: sys.exit(3) sys.exit(0) if __name__ == "__main__":