From b8e246a77e441766abd2a4d486daf9f7f45315f6 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 19 Aug 2022 15:56:44 +0530 Subject: [PATCH] chore: code cleanup (cherry picked from commit d274b5681714f2bca015f2c068965f53b50d0814) --- frappe/__init__.py | 7 ------- frappe/modules/export_file.py | 4 +++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index 6fc44b542f..e155cae78e 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -16,7 +16,6 @@ import inspect import json import os import re -import shutil import warnings from typing import TYPE_CHECKING, Any, Callable, Literal, Optional, overload @@ -532,12 +531,6 @@ def throw( ) -def delete_folder(path: str) -> None: - """Delete folder and all the content inside that folder.""" - if os.path.exists(path): - shutil.rmtree(path) - - def create_folder(path, with_init=False): """Create a folder in the given path and add an `__init__.py` file (optional). diff --git a/frappe/modules/export_file.py b/frappe/modules/export_file.py index 1c5f74180c..edd58d35b0 100644 --- a/frappe/modules/export_file.py +++ b/frappe/modules/export_file.py @@ -2,6 +2,7 @@ # License: MIT. See LICENSE import os +import shutil import frappe import frappe.model @@ -101,7 +102,8 @@ def delete_folder(module, dt, dn): # delete folder folder = os.path.join(module_path, dt, dn) - frappe.delete_folder(folder) + if os.path.exists(folder): + shutil.rmtree(folder) def create_folder(module, dt, dn, create_init):