From 4f517f784392feb0a8d07799dafd65ebbbb9e12a Mon Sep 17 00:00:00 2001 From: Bernhard Thiel Date: Fri, 9 Dec 2016 11:41:21 +0100 Subject: [PATCH 1/2] The mprof executable now uses `sys.executable` instead of "python" for the subprocess --- mprof | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mprof b/mprof index 192ba10..ee55517 100755 --- a/mprof +++ b/mprof @@ -218,11 +218,12 @@ def run_action(): options.python = True if options.python: print("running as a Python program...") - if not args[0].startswith("python"): - args.insert(0, "python") + if not osp.basename(args[0]).startswith("python"): + args.insert(0, sys.executable) cmd_line = get_cmd_line(args) args[1:1] = ("-m", "memory_profiler", "--timestamp", "-o", mprofile_output) + #print(" ".join(args)) p = subprocess.Popen(args) else: cmd_line = get_cmd_line(args) From 52bf90987326ee04757bde27aeb014a940129fed Mon Sep 17 00:00:00 2001 From: Bernhard Thiel Date: Fri, 9 Dec 2016 11:49:04 +0100 Subject: [PATCH 2/2] Falls back to the string 'python' if 'sys.executable' is empty or None --- mprof | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mprof b/mprof index ee55517..7a1b773 100755 --- a/mprof +++ b/mprof @@ -219,7 +219,10 @@ def run_action(): if options.python: print("running as a Python program...") if not osp.basename(args[0]).startswith("python"): - args.insert(0, sys.executable) + if sys.executable: + args.insert(0, sys.executable) + else: + args.insert(0, "python") cmd_line = get_cmd_line(args) args[1:1] = ("-m", "memory_profiler", "--timestamp", "-o", mprofile_output)