diff options
author | Achal Dave <achalddave@live.com> | 2016-05-04 11:51:00 -0400 |
---|---|---|
committer | Achal Dave <achalddave@live.com> | 2016-05-04 11:51:00 -0400 |
commit | 5acc17a5bfe010d92cc20766f88eff70d4ae92cc (patch) | |
tree | 78a5f201b611c95a94448f3426ed07942b3a0cf9 /tools | |
parent | 045e5ba5b95c2cb22fd988e373a16fe405193fc0 (diff) | |
download | caffeonacl-5acc17a5bfe010d92cc20766f88eff70d4ae92cc.tar.gz caffeonacl-5acc17a5bfe010d92cc20766f88eff70d4ae92cc.tar.bz2 caffeonacl-5acc17a5bfe010d92cc20766f88eff70d4ae92cc.zip |
Exit on error and report argument error details.
The statement 'exit' has no effect in Python scripts. Use 'sys.exit()'
instead.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/extra/plot_training_log.py.example | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/extra/plot_training_log.py.example b/tools/extra/plot_training_log.py.example index 4d3ed0d1..d98c52d3 100755 --- a/tools/extra/plot_training_log.py.example +++ b/tools/extra/plot_training_log.py.example @@ -160,7 +160,7 @@ Supported chart types:""" % (len(get_supported_chart_types()) - 1, num = len(supported_chart_types) for i in xrange(num): print ' %d: %s' % (i, supported_chart_types[i]) - exit + sys.exit() def is_valid_chart_type(chart_type): return chart_type >= 0 and chart_type < len(get_supported_chart_types()) @@ -171,17 +171,19 @@ if __name__ == '__main__': else: chart_type = int(sys.argv[1]) if not is_valid_chart_type(chart_type): + print '%s is not a valid chart type.' % chart_type print_help() path_to_png = sys.argv[2] if not path_to_png.endswith('.png'): print 'Path must ends with png' % path_to_png - exit + sys.exit() path_to_logs = sys.argv[3:] for path_to_log in path_to_logs: if not os.path.exists(path_to_log): print 'Path does not exist: %s' % path_to_log - exit + sys.exit() if not path_to_log.endswith(get_log_file_suffix()): + print 'Log file must end in %s.' % get_log_file_suffix() print_help() ## plot_chart accpets multiple path_to_logs plot_chart(chart_type, path_to_png, path_to_logs) |