From 59521dbb07ecba42b12e08073c5a665279e59c24 Mon Sep 17 00:00:00 2001 From: wuzewu Date: Fri, 6 Mar 2020 10:19:41 +0800 Subject: [PATCH] Fix module install bug --- paddlehub/module/manager.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/paddlehub/module/manager.py b/paddlehub/module/manager.py index 7366626f..248a26c9 100644 --- a/paddlehub/module/manager.py +++ b/paddlehub/module/manager.py @@ -212,12 +212,13 @@ class LocalModuleManager(object): fp.write(md5_value) save_path = os.path.join(MODULE_HOME, module_name) - if os.path.exists(save_path): - shutil.rmtree(save_path) - if from_user_dir: - shutil.copytree(module_dir, save_path) - else: - shutil.move(module_dir, save_path) + if save_path != module_dir: + if os.path.exists(save_path): + shutil.rmtree(save_path) + if from_user_dir: + shutil.copytree(module_dir, save_path) + else: + shutil.move(module_dir, save_path) module_dir = save_path tips = "Successfully installed %s" % module_name if installed_module_version: -- GitLab