From d45691869ccfb2c4bdb04d20d2a1c1abb8152373 Mon Sep 17 00:00:00 2001 From: Sean Finney Date: Wed, 2 Sep 2009 00:14:54 +0200 Subject: move the profile/pstats import into run_profile this way if the app is being run on a machine that does not have python-profiler installed it will still function unless specifically told to profile. --- pagehandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pagehandler.py') diff --git a/pagehandler.py b/pagehandler.py index 6298b45..99379db 100755 --- a/pagehandler.py +++ b/pagehandler.py @@ -24,6 +24,7 @@ def application(env, resp): return ReqHandler.ErrorCmd(str(e), e.status).output() def profile_app(call): + import cProfile as profile, pstats profile.run(call, "profile.out") p = pstats.Stats("profile.out") p.sort_stats('time', 'cumulative') @@ -35,7 +36,6 @@ if __name__ == '__main__': os.environ['SCRIPT_FILENAME'] = sys.argv[0] from wsgiref import simple_server as ss import getopt - import cProfile as profile, pstats def cmd_help(): print """ -- cgit v1.2.3