From 2dde3a9b0132f48b683520c3cd18ed503ebe09e9 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Fri, 2 Apr 2021 01:12:19 +0530 Subject: [PATCH] fix: Hide all warnings in frappe commands Hide all warnings when triggered via frappe.utils.bench_helper --- frappe/commands/utils.py | 3 --- frappe/utils/bench_helper.py | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index 1ee2a7ec00..8ae55ae9c7 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -501,8 +501,6 @@ frappe.db.connect() @pass_context def console(context): "Start ipython console for a site" - import warnings - site = get_site(context) frappe.init(site=site) frappe.connect() @@ -523,7 +521,6 @@ def console(context): if failed_to_import: print("\nFailed to import:\n{}".format(", ".join(failed_to_import))) - warnings.simplefilter('ignore') IPython.embed(display_banner="", header="", colors="neutral") diff --git a/frappe/utils/bench_helper.py b/frappe/utils/bench_helper.py index 633d867306..e1ae7931d6 100644 --- a/frappe/utils/bench_helper.py +++ b/frappe/utils/bench_helper.py @@ -6,6 +6,7 @@ import json import importlib import frappe.utils import traceback +import warnings click.disable_unicode_literals_warning = True @@ -98,5 +99,5 @@ def get_apps(): return frappe.get_all_apps(with_internal_apps=False, sites_path='.') if __name__ == "__main__": + warnings.simplefilter('ignore') main() -