From 4904e06e6aa2278f96d9fd007c6ac3261f127f25 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 11 Jan 2012 14:58:00 +0100 Subject: [PATCH] core.main: pipe the profiler stream to stderr --- ranger/core/main.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ranger/core/main.py b/ranger/core/main.py index 1c2686bb7f..8458f928ee 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -127,7 +127,7 @@ def print_function(string): profile = None ranger.__fm = fm cProfile.run('ranger.__fm.loop()', '/tmp/ranger_profile') - profile = pstats.Stats('/tmp/ranger_profile') + profile = pstats.Stats('/tmp/ranger_profile', stream=sys.stderr) else: fm.loop() except Exception: @@ -146,9 +146,7 @@ def print_function(string): except (AttributeError, NameError): pass if ranger.arg.profile and profile: - stdout, sys.stdout = sys.stdout, sys.stderr - profile.strip_dirs().sort_stats('cumulative').print_callees(100) - sys.stdout = stdout + profile.strip_dirs().sort_stats('cumulative').print_callees() if crash_traceback: print("ranger version: %s, executed with python %s" % (ranger.__version__, sys.version.split()[0]))