From d7b5ab08d9ec798382d46464af39b6660bbb311a Mon Sep 17 00:00:00 2001 From: Massimo Di Pierro Date: Thu, 22 Aug 2024 11:08:55 +0200 Subject: [PATCH] no need to redirect stdout and stdin when loading a module --- py4web/core.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/py4web/core.py b/py4web/core.py index 898bf4a7..10dae504 100644 --- a/py4web/core.py +++ b/py4web/core.py @@ -1423,19 +1423,7 @@ def clear_modules(): del Reloader.MODULES[app_name] clear_modules() - load_module_message = None - buf_out = io.StringIO() - buf_err = buf_out - with redirect_stdout(buf_out), redirect_stderr(buf_err): - module = load_module(module_name, init) - load_module_message = buf_out.getvalue() - buf_out.close() - buf_out = sys.stdout - buf_err = sys.stderr - - if load_module_message: - click.secho(f"\x1b[A output {app_name} ", fg="yellow") - click.echo(load_module_message) + module = load_module(module_name, init) click.secho(f"\x1b[A[X] loaded {app_name} ", fg="green") Reloader.MODULES[app_name] = module