From 898b2d39ad41af341a8920b77456a4d4db55a347 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 14 Jan 2022 14:41:06 -0500 Subject: [PATCH] Linting: E231,E303,E302,E221,E211,E303,E713,E265,W0612,E203,E231,E111,E222 --- ombi_sqlite2mysql.py | 193 ++++++++++++++++++++----------------- ombi_sqlite2mysql_multi.py | 47 ++++----- 2 files changed, 130 insertions(+), 110 deletions(-) diff --git a/ombi_sqlite2mysql.py b/ombi_sqlite2mysql.py index c3fdfec..83772be 100644 --- a/ombi_sqlite2mysql.py +++ b/ombi_sqlite2mysql.py @@ -49,7 +49,7 @@ json_file_database = "database.json" json_db_file = "" json_db_data = None -list_db = {'OmbiDatabase':'Ombi.db', 'SettingsDatabase':'OmbiSettings.db', 'ExternalDatabase':'OmbiExternal.db'} +list_db = {'OmbiDatabase': 'Ombi.db', 'SettingsDatabase': 'OmbiSettings.db', 'ExternalDatabase': 'OmbiExternal.db'} list_db_process = None global_opts = { @@ -61,7 +61,7 @@ check_count_data = {} table_name_data = { - '__efmigrationshistory' : '__EFMigrationsHistory' + '__efmigrationshistory': '__EFMigrationsHistory' } mysql_db_file = "data_ombi.mysql" @@ -76,7 +76,7 @@ fix_insert_default = { "__EFMigrationsHistory": { "id": "MigrationId", - "required":{ + "required": { "20191103213915_Inital": { "data": { "MigrationId": "20191103213915_Inital", @@ -122,25 +122,24 @@ sqlite_table_ignore = ['Logs', 'HangFire.AggregatedCounter', 'HangFire.Counter', 'HangFire.Hash', 'HangFire.Job', 'HangFire.JobParameter', 'HangFire.JobQueue', 'HangFire.List', 'HangFire.Schema', 'HangFire.Server', 'HangFire.Set', 'HangFire.State'] - def dump(obj): - for attr in dir(obj): - print("obj.%s = %r" % (attr, getattr(obj, attr))) + for attr in dir(obj): + print("obj.%s = %r" % (attr, getattr(obj, attr))) # https://stackoverflow.com/questions/3160699/python-progress-bar def progressbar(it, prefix="", size=60, file=sys.stdout): count = len(it) - #def size_console(): + # def size_console(): # rows, columns = os.popen('stty size', 'r').read().split() # return int(columns), int(rows) def show(j): # Not work in Windows! - #if str(size).lower() == "auto".lower(): + # if str(size).lower() == "auto".lower(): # size_fix = int(size_console()[0]) - len(prefix) - (len(str(count))*2) - 4 - 5 - #else: + # else: # size_fix = size size_fix = size @@ -155,23 +154,25 @@ def show(j): file.flush() - def _set_conf(key, value): global global_opts global_opts[key] = value return True -def _get_conf(key, default = ""): + +def _get_conf(key, default=""): if key in global_opts: return global_opts[key] else: return default + def _set_mysql_cfg(new_cfg): global mysql_cfg mysql_cfg = None mysql_cfg = new_cfg + def _get_mysql_cfg(): return mysql_cfg @@ -194,7 +195,7 @@ def _save_file(file_name, data, show_msg=True): if show_msg: print("[!!]") print("Unexpected error:", e) - #print("Unexpected error:", sys.exc_info()[0]) + # print("Unexpected error:", sys.exc_info()[0]) return False else: @@ -202,6 +203,7 @@ def _save_file(file_name, data, show_msg=True): print("[✓]") return True + def _read_json(file_json, def_return=None, show_msg=True): return_date = def_return if os.path.isfile(file_json): @@ -214,6 +216,7 @@ def _read_json(file_json, def_return=None, show_msg=True): print("Exception read json ({0}):".format(file_json), e) return return_date + def _save_json(file_json, data, overwrite=False, show_msg=True): if show_msg: sys.stdout.write("- Saving in ({0})... ".format(file_json)) @@ -244,6 +247,7 @@ def _get_path_file_in_conf(file_name): else: return "" + def _find_in_json(json_data, find, def_return="", ignorecase=True): data_return = def_return if json_data and find: @@ -283,7 +287,6 @@ def _find_in_json(json_data, find, def_return="", ignorecase=True): return data_return - def _check_read_config(): global json_db_data global list_db_process @@ -295,7 +298,7 @@ def _check_read_config(): return False elif not os.path.isdir(_get_conf('config')): - print ("Error: The config path does not exist or is not a directory !!") + print("Error: The config path does not exist or is not a directory !!") return False json_db = _get_path_file_in_conf(json_file_migration) @@ -305,13 +308,13 @@ def _check_read_config(): json_db_data = _read_json(json_db) if json_db_data is None: - print ("Error: No data has been read from the json ({0}) file, please review it.!!!!".format(json_db)) + print("Error: No data has been read from the json ({0}) file, please review it.!!!!".format(json_db)) return False list_db_process = [] for db_name in list_db: - #if db_name not in json_db_data: + # if db_name not in json_db_data: if db_name.lower() not in map(lambda name: name.lower(), json_db_data): print("- {0} [No Config >> Skip]".format(db_name)) continue @@ -325,41 +328,46 @@ def _check_read_config(): else: print("- {0} [{1} >> Unknown]".format(db_name, type_db)) - print ("") + print("") if len(list_db_process) == 0: - print ("Error: It is not necessary to update all databases are migrated.") + print("Error: It is not necessary to update all databases are migrated.") return False return True - def _clean_end_process(): _clean_check_count_data() _clean_table_name_data() _clean_list_error() _clean_fix_insert_mysql() + def _clean_list_tables_backup(): global mysql_list_tables_save_backup mysql_list_tables_save_backup = [] + def _clean_list_tables_skip_clean(): global mysql_list_tables_skip_clean mysql_list_tables_skip_clean = [] + def _clean_list_error(): global mysql_list_error mysql_list_error = [] + def _clean_check_count_data(): global check_count_data check_count_data = {} + def _clean_table_name_data(): global table_name_data table_name_data = {} + def _clean_fix_insert_mysql(): global fix_insert @@ -367,13 +375,14 @@ def _clean_fix_insert_mysql(): if _mysql_lower_case() is True: table_name = table_name.lower() - fix_insert[table_name]['mysql'] = { + fix_insert[table_name]['mysql'] = { "ls_column": [], "ls_data": [], "ls_id": [], "data": [] } + def _check_config_mysql(): # TODO: pendiente leer config de database.json new_cfg = None @@ -391,6 +400,7 @@ def _check_config_mysql(): _set_mysql_cfg(new_cfg) + def _mysql_IsConnect(): global mysql_conn if mysql_conn is None: @@ -402,6 +412,7 @@ def _mysql_IsConnect(): else: return False + def _mysql_connect(show_msg=True): global fix_insert global mysql_conn @@ -416,7 +427,7 @@ def _mysql_connect(show_msg=True): _mysql_disconnect() if show_msg: - #print("MySQL > Connecting...") + # print("MySQL > Connecting...") sys.stdout.write("MySQL > Connecting... ") try: mysql_conn = MySQLdb.connect(**mysql_cfg) @@ -432,7 +443,7 @@ def _mysql_connect(show_msg=True): msg_err = "* MySQL TypeError: {0}".format(str(e)) except ValueError as e: - msg_err = "* MySQL ValueError: {0}".format(str(e)) + msg_err = "* MySQL ValueError: {0}".format(str(e)) if msg_err: if show_msg: @@ -443,7 +454,6 @@ def _mysql_connect(show_msg=True): if show_msg: print("[✓]") - _mysql_get_lower_case_table_name() # Set default values, fix table @@ -455,6 +465,7 @@ def _mysql_connect(show_msg=True): return True + def _mysql_disconnect(show_msg=True): global mysql_conn @@ -466,12 +477,13 @@ def _mysql_disconnect(show_msg=True): if show_msg: print("[✓]") + def _mysql_execute_querys(list_insert, progressbar_text, progressbar_size, run_commit=250, ignorer_error=[], DISABLE_FOREIGN_KEY_CHECKS=True, show_msg=True): global mysql_conn global mysql_list_error if not _mysql_IsConnect: - #controlar si no hay conexion con mysql return false o sys.exit() + # controlar si no hay conexion con mysql return false o sys.exit() return False if list_insert is None or len(list_insert) == 0: @@ -504,7 +516,7 @@ def _mysql_execute_querys(list_insert, progressbar_text, progressbar_size, run_c except IndexError as e: str_msg_err = "* MySQL IndexError: {0}".format(str(e)) - #exit_is_error = True + # exit_is_error = True except TypeError as e: exit_is_error = True @@ -540,6 +552,7 @@ def _mysql_execute_querys(list_insert, progressbar_text, progressbar_size, run_c cur = None return True + def _mysql_fetchall_querys(query, ignorer_error=[]): global mysql_conn global mysql_list_error @@ -587,12 +600,14 @@ def _mysql_fetchall_querys(query, ignorer_error=[]): cur = None return data_return + def _mysql_lower_case(): global mysql_lower_case_table_names # if mysql_lower_case_table_names is None: # return False return mysql_lower_case_table_names + def _mysql_get_lower_case_table_name(): global mysql_lower_case_table_names # Default on Unix-based systems: 0 (case-sensitive) @@ -606,25 +621,26 @@ def _mysql_get_lower_case_table_name(): mysql_lower_case_table_names = False else: mysql_lower_case_table_names = True - + return mysql_lower_case_table_names + def _mysql_migration(data_dump): if not _mysql_IsConnect: return False - print ("Start Migration:") + print("Start Migration:") list_insert = [] str_insert = "INSERT INTO" for i in progressbar(data_dump, "- Preparing ", global_progressbar_size): if i is None: - #print("Ignorer 1:", i) + # print("Ignorer 1:", i) continue elif len(i) < len(str_insert): - #print("Ignorer 2:", i) + # print("Ignorer 2:", i) continue elif i[:len(str_insert)].upper() != str_insert: - #print("Ignorer 3:", i) + # print("Ignorer 3:", i) continue else: list_insert.append(i) @@ -642,6 +658,7 @@ def _mysql_migration(data_dump): return isInsertOK + def _mysql_migration_check(): if not _mysql_IsConnect: @@ -677,35 +694,36 @@ def _mysql_migration_check(): # 80 = size + text ("- Running "), pongo algo mas print('{:<80}'.format("- [!!] -> {0} -> [SQLite ({1}) / MySQL ({2})] = {3}".format(table, count_sqlite, count, count_sqlite - count))) else: - #print("- [OK] -> {0} ({1})".format(table, count)) + # print("- [OK] -> {0} ({1})".format(table, count)) pass return isOkMigration + def _mysql_tables_clean(): global check_count_data if not _mysql_IsConnect: return False - print ("Start clean tables:") + print("Start clean tables:") arr_query = [] # TODO: Pendiente ver por que si no se vacia __EFMigrationsHistory no se importan todos los datos correctamente!!!!!! - #Retorna datos no fiables, en ocasiones dice que hay 0 registros y si tiene registros. - #q = "SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{0}';".format(mysql_cfg['db']) + # Retorna datos no fiables, en ocasiones dice que hay 0 registros y si tiene registros. + # q = "SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{0}';".format(mysql_cfg['db']) q = "SET group_concat_max_len = 1024 * 1024 * 100;" q += "SELECT CONCAT('SELECT * FROM (',GROUP_CONCAT(CONCAT('SELECT ',QUOTE(tb),' `Table`, COUNT(1) `Rows` FROM ',db,'.',tb) SEPARATOR ' UNION '),') A " q += "ORDER BY " # No hace falta ordenar las tablas ya que usamos DISABLE_FOREIGN_KEY_CHECKS. - #q += "`Table` = \"__EFMigrationsHistory\" DESC, " - #q += "`Table` = \"AspNetUsers\" DESC, `Table` = \"ChildRequests\" DESC, `Table` = \"MovieRequests\" DESC, " - #q += "`Table` = \"Issues\" DESC, `Table` = \"IssueComments\" DESC, `Table` = \"IssueCategory\" DESC, " - #q += "`Table` = \"EmbyContent\" DESC, `Table` = \"EmbyEpisode\" DESC, " - #q += "`Table` = \"PlexServerContent\" DESC, `Table` = \"PlexSeasonsContent\" DESC, `Table` = \"PlexEpisode\" DESC, " + # q += "`Table` = \"__EFMigrationsHistory\" DESC, " + # q += "`Table` = \"AspNetUsers\" DESC, `Table` = \"ChildRequests\" DESC, `Table` = \"MovieRequests\" DESC, " + # q += "`Table` = \"Issues\" DESC, `Table` = \"IssueComments\" DESC, `Table` = \"IssueCategory\" DESC, " + # q += "`Table` = \"EmbyContent\" DESC, `Table` = \"EmbyEpisode\" DESC, " + # q += "`Table` = \"PlexServerContent\" DESC, `Table` = \"PlexSeasonsContent\" DESC, `Table` = \"PlexEpisode\" DESC, " q += "`Table` ASC " q += ";')" @@ -724,13 +742,13 @@ def _mysql_tables_clean(): tableLower = table.lower() if count == 0: - #print("- [EMPTY] -> {0}".format(table)) + # print("- [EMPTY] -> {0}".format(table)) continue if tableLower in mysql_list_tables_save_backup: table_temp = "{0}_migration_backup_{1}".format(_fix_name_table(table), datetime.datetime.now().strftime("%Y%m%d%H%M%S_%f")) - #print("- [BACKUP] -> {0} in {1}".format(table, table_temp)) + # print("- [BACKUP] -> {0} in {1}".format(table, table_temp)) print("- [BACKUP] -> {0}".format(table)) q = "CREATE TABLE `{0}` LIKE `{1}`;".format(table_temp, _fix_name_table(table)) @@ -754,23 +772,24 @@ def _mysql_tables_clean(): isAllOk = _mysql_execute_querys(list_querys, "- Running ", global_progressbar_size, 500, [], True) if isAllOk: - print ("Clean tables [✓]") + print("Clean tables [✓]") else: - print ("Clean tables [!!]") + print("Clean tables [!!]") print("") return isAllOk + def _fix_name_table(name_table): - + if name_table is None or name_table == "": return "" name_table_lower = name_table.lower() - + if _mysql_lower_case() is True: return name_table_lower - + if name_table_lower in table_name_data: return table_name_data[name_table_lower] @@ -785,14 +804,14 @@ def _convert_str_sqlite_mysql(str_data): str_data = str_data.replace('\\', '\\\\') str_data = str_data.replace('"', '\\"') - #TODO: Lo dejo por si las moscas, pero casi seguro que sobra. - #str_data = str_data.replace(",'t'", ",'1'") - #str_data = str_data.replace(",'f'", ",'0'") + # TODO: Lo dejo por si las moscas, pero casi seguro que sobra. + # str_data = str_data.replace(",'t'", ",'1'") + # str_data = str_data.replace(",'f'", ",'0'") - #line = line.replace('"', r'\"') - #line = line.replace('"', "'") - #line = re.sub(r"(? 0: @@ -874,12 +890,12 @@ def _sqlite_dump(): # print(q) # print("------------------------") # sys.exit() - yield q check_count_data[tableLower] += 1 print("") + def _iterdump(connection, db_name): global check_count_data global table_name_data @@ -893,7 +909,7 @@ def _iterdump(connection, db_name): # SELECT * FROM sqlite_master WHERE sql NOT NULL AND type == 'table' ORDER BY name = 'AspNetUsers' DESC, name = 'ChildRequests' DESC, name = 'MovieRequests' DESC, name = 'Issues' DESC, name = 'IssueComments' DESC, name ASC q += "name = 'AspNetUsers' DESC, name = 'ChildRequests' DESC, name = 'MovieRequests' DESC, name = 'Issues' DESC, name = 'IssueComments' DESC, name ASC" elif db_name.lower() == "ExternalDatabase".lower(): - #SELECT * FROM sqlite_master WHERE sql NOT NULL AND type == 'table' ORDER BY name = 'EmbyContent' DESC, name = 'EmbyEpisode' DESC, name = 'PlexServerContent' DESC, name = 'PlexSeasonsContent' DESC, name = 'PlexEpisode' DESC, name ASC + # SELECT * FROM sqlite_master WHERE sql NOT NULL AND type == 'table' ORDER BY name = 'EmbyContent' DESC, name = 'EmbyEpisode' DESC, name = 'PlexServerContent' DESC, name = 'PlexSeasonsContent' DESC, name = 'PlexEpisode' DESC, name ASC q += "name = 'EmbyContent' DESC, name = 'EmbyEpisode' DESC, name = 'PlexServerContent' DESC, name = 'PlexSeasonsContent' DESC, name = 'PlexEpisode' DESC, name ASC" else: q += "name ASC" @@ -971,7 +987,7 @@ def _iterdump_fix_insert(q, q_col, table_name): return None # eliminamos el simbolo ` que tiene cada nombre de columna a los lados. - ls_col = str(q_col).replace("`","").split(",") + ls_col = str(q_col).replace("`", "").split(",") id_col = str(v['id']) if id_col in ls_col: @@ -979,11 +995,11 @@ def _iterdump_fix_insert(q, q_col, table_name): val_id = str(q).split(",")[index_col_id] # Detecta si tiene comillas simples a los lados y las elimina poder hacer la compracion con mysql->ls_id. - #val_id = val_id[(1 if val_id[:1] == "'" else None):(-1 if val_id[-1:] == "'" else None)] + # val_id = val_id[(1 if val_id[:1] == "'" else None):(-1 if val_id[-1:] == "'" else None)] if val_id[:1] == "'" and val_id[-1:] == "'": val_id = val_id[1:-1] - #val_id = id del la consulta que nos ha llegado en q. + # val_id = id del la consulta que nos ha llegado en q. if len(val_id) > 0: if val_id in v['mysql']['ls_id']: # Si exite en mysql no la necesitamos. @@ -995,7 +1011,6 @@ def _iterdump_fix_insert(q, q_col, table_name): return q - def _fix_insert_read_mysql(): global fix_insert @@ -1041,18 +1056,18 @@ def _fix_insert_read_mysql(): v['mysql']['data'] = data if isAllOk: - print ("Read tables [✓]") + print("Read tables [✓]") else: - print ("Read tables [!!]") + print("Read tables [!!]") print("") return isAllOk def _save_dump(data, show_msg=True): if show_msg: - print ("Save Dump:") + print("Save Dump:") - dump_db_file = _get_path_file_in_conf(mysql_db_file) + dump_db_file = _get_path_file_in_conf(mysql_db_file) data_return = _save_file(dump_db_file, data, show_msg) if show_msg: @@ -1060,14 +1075,15 @@ def _save_dump(data, show_msg=True): return data_return + def _save_error_log(data, show_msg=True): if not data or len(data) == 0: return True if show_msg: - print ("Save Log Error Mysql Insert:") + print("Save Log Error Mysql Insert:") - log_file = _get_path_file_in_conf(mysql_log_err) + log_file = _get_path_file_in_conf(mysql_log_err) data_return = _save_file(log_file, data, show_msg) if show_msg: @@ -1075,6 +1091,7 @@ def _save_error_log(data, show_msg=True): return data_return + def _mysql_database_json_update(overwrite=False, show_msg=True): json_mysql = _get_path_file_in_conf(json_file_database) json_data = {} @@ -1091,6 +1108,7 @@ def _mysql_database_json_update(overwrite=False, show_msg=True): if show_msg: print("") + def _manager_json_update(overwrite=False, show_msg=True): json_file = _get_path_file_in_conf(json_file_migration) json_data = {} @@ -1111,7 +1129,6 @@ def _manager_json_update(overwrite=False, show_msg=True): print("") - def _OptionParser(): global opts op = OptionParser() @@ -1130,6 +1147,7 @@ def _OptionParser(): return _OptionParser_apply() + def _OptionParser_apply(): if opts.config: _set_conf('config', opts.config) @@ -1151,7 +1169,7 @@ def _OptionParser_apply(): if mysql_cfg: _mysql_database_json_update(True, True) else: - print ("Unable to create file \"{0}\" missing required parameters.".format(json_file_database)) + print("Unable to create file \"{0}\" missing required parameters.".format(json_file_database)) if opts.only_manager_json: _manager_json_update(True, True) @@ -1159,15 +1177,16 @@ def _OptionParser_apply(): return True + def load_MySQL_lib(): global MySQLdb try: MySQLdb = importlib.import_module('MySQLdb') - except ImportError as error: + except ImportError: # Output expected ImportErrors. print("Error load MySQLdb, check if MySQLdb is installed!") - #print(error.__class__.__name__ + ": " + error.message) + # print(error.__class__.__name__ + ": " + error.message) return False except Exception as exception: @@ -1179,7 +1198,6 @@ def load_MySQL_lib(): return True - def main(): global check_count_data @@ -1211,6 +1229,7 @@ def main(): if _get_conf('save_dump'): _save_dump(data_dump) + if __name__ == "__main__": print("Migration tool from SQLite to MySql/MariaDB for ombi ({0}) By {1}".format(__version__, __author__)) print("") diff --git a/ombi_sqlite2mysql_multi.py b/ombi_sqlite2mysql_multi.py index 94228cc..a716f8c 100644 --- a/ombi_sqlite2mysql_multi.py +++ b/ombi_sqlite2mysql_multi.py @@ -41,7 +41,7 @@ json_file_migration = "migration.json" json_file_database = "database.json" -list_db = {'OmbiDatabase':'Ombi.db', 'SettingsDatabase':'OmbiSettings.db', 'ExternalDatabase':'OmbiExternal.db'} +list_db = {'OmbiDatabase': 'Ombi.db', 'SettingsDatabase': 'OmbiSettings.db', 'ExternalDatabase': 'OmbiExternal.db'} opts = None opt = { @@ -116,7 +116,6 @@ def __call__(self, *values): return self.value in values - def _get_path_file_in_conf(file_name): if opt['config'] and file_name: return os.path.join(opt['config'], file_name) @@ -134,12 +133,13 @@ def _OptionParser(): opts, _ = op.parse_args() return _OptionParser_apply() + def _OptionParser_apply(): global opt - opt['config'] = opts.config - opt['force'] = opts.force - opt['no_backup'] = opts.no_backup - opt['save_dump'] = opts.save_dump + opt['config'] = opts.config + opt['force'] = opts.force + opt['no_backup'] = opts.no_backup + opt['save_dump'] = opts.save_dump ombi_sqlite2mysql._set_conf('config', opt['config']) ombi_sqlite2mysql._set_conf('force', opt['force']) @@ -154,10 +154,11 @@ def _OptionParser_apply(): return True + def main(): - json_db = _get_path_file_in_conf(json_file_database) - json_db_multi = _get_path_file_in_conf(json_file_database_multi) - json_migration = _get_path_file_in_conf(json_file_migration) + json_db = _get_path_file_in_conf(json_file_database) + json_db_multi = _get_path_file_in_conf(json_file_database_multi) + json_migration = _get_path_file_in_conf(json_file_migration) if not os.path.isfile(json_db_multi): print("Error: File {0} not exist!!!".format(json_db_multi)) @@ -165,27 +166,26 @@ def main(): json_db_multi_data = ombi_sqlite2mysql._read_json(json_db_multi) if json_db_multi_data is None: - print ("Error: No data has been read from the json ({0}) file, please review it.!!!!".format(json_db_multi)) + print("Error: No data has been read from the json ({0}) file, please review it.!!!!".format(json_db_multi)) return False - for key, value in json_db_multi_data.items(): - if not key in list_db: + if key not in list_db: print("- DataBase ({0}) Skip: Name DataBase is not valid!".format(key)) print("") continue - opt_type = None + opt_type = None opt_connect = None - opt_skip = False - opt_file = _get_path_file_in_conf(list_db[key]) + opt_skip = False + opt_file = _get_path_file_in_conf(list_db[key]) - mysql_host = "localhost" - mysql_port = "3306" - mysql_db = "Ombi" - mysql_user = "ombi" - mysql_pass = "ombi" + mysql_host = "localhost" + mysql_port = "3306" + mysql_db = "Ombi" + mysql_user = "ombi" + mysql_pass = "ombi" for subkey, subval in value.items(): with Switch(subkey, invariant_culture_ignore_case=True) as case: @@ -275,21 +275,21 @@ def main(): print("----------------------------------------------------------------") print("") - print("> Updating database.json...") ombi_sqlite2mysql._save_json(json_db, json_db_multi_data, True, True) print("") print("") + def load_Packaging_lib(): global version try: version = importlib.import_module('packaging.version') - except ImportError as error: + except ImportError: # Output expected ImportErrors. print("Error load packaging, check if packaging is installed!") - #print(error.__class__.__name__ + ": " + error.message) + # print(error.__class__.__name__ + ": " + error.message) return False except Exception as exception: @@ -300,6 +300,7 @@ def load_Packaging_lib(): return True + if __name__ == "__main__": print("Migration tool from SQLite to Multi MySql/MariaDB for ombi ({0}) By {1}".format(__version__, __author__)) print("")