diff --git a/bazarr/libs.py b/bazarr/libs.py index 9d734eb23..7c3a3dd9f 100644 --- a/bazarr/libs.py +++ b/bazarr/libs.py @@ -2,6 +2,19 @@ import os import sys +from shutil import rmtree + + +def clean_libs(): + libs_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'libs') + + # Delete the old module almost empty directory compatible only with Python 2.7.x that cause bad magic number error + # if they are present in Python 3.x. + module_list = ['enum', 'concurrent'] + for module in module_list: + module_path = os.path.join(libs_dir, module) + if os.path.isdir(module_path): + rmtree(module_path) def set_libs(): @@ -13,4 +26,5 @@ def set_libs(): sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../libs2/')) +clean_libs() set_libs()