From 49c793cc89d1dc4ed88205ca1c0eae71fb214d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 7 Oct 2019 21:18:24 -0400 Subject: [PATCH] Clean old module --- bazarr/libs.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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()