linux-btrace.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blktrace bno_plot.py: output comprehensive message when gnuplot not found
@ 2013-12-03 12:04 Eiichi Tsukata
  2013-12-04  2:25 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Eiichi Tsukata @ 2013-12-03 12:04 UTC (permalink / raw)
  To: linux-btrace

Currently, bno_plot.py uses os.execvp which does not show enough information
when executed command is not found. For example, when gnuplot is not found
bno_plot.py shows the following messages:

    Traceback (most recent call last):
      File "/usr/local/bin/bno_plot.py", line 123, in <module>
        os.execvp(cmd[0], cmd)
      File "/usr/lib64/python2.7/os.py", line 344, in execvp
        _execvpe(file, args)
      File "/usr/lib64/python2.7/os.py", line 368, in _execvpe
        func(file, *argrest)
    OSError: [Errno 2] No such file or directory

Users can't understand what happend directly from the message.

Instead of os.execvp, this patch uses os.system which shows the following
messages when gnuplot not found:

    sh: gnuplot: command not found

Signed-off-by: Eiichi Tsukata <devel@etsukata.com>
---
 btt/bno_plot.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/btt/bno_plot.py b/btt/bno_plot.py
index 19dfdfd..aa92480 100644
--- a/btt/bno_plot.py
+++ b/btt/bno_plot.py
@@ -114,13 +114,12 @@ if __name__ = '__main__':
 
 	pid = os.fork()
 	if pid = 0:
-		cmd = '/usr/bin/gnuplot %s/plot.cmds -' % tmpdir
+		cmd = 'gnuplot %s/plot.cmds -' % tmpdir
 
 		if verbose: print 'Executing %s' % cmd
 
-		cmd = cmd.split(None)
 		os.chdir(tmpdir)
-		os.execvp(cmd[0], cmd)
+		os.system(cmd)
 		sys.exit(1)
 
 	os.waitpid(pid, 0)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-04  2:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-03 12:04 [PATCH] blktrace bno_plot.py: output comprehensive message when gnuplot not found Eiichi Tsukata
2013-12-04  2:25 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).