diff --git a/docs/source/release/v6.1.0/mantidworkbench.rst b/docs/source/release/v6.1.0/mantidworkbench.rst index 407a0d4ebcdfd44c57de824e2e7d44e98cfa6479..8fcec4e1ec60873507463a85d7e5019e3b937d0f 100644 --- a/docs/source/release/v6.1.0/mantidworkbench.rst +++ b/docs/source/release/v6.1.0/mantidworkbench.rst @@ -10,6 +10,7 @@ New and Improved - New plot interactions: Double click a legend to hide it, double click a curve to open it in the plot config dialog. - It is now possible to overplot bin data from the matrix workspace view. +- New command line options ``--version`` will print the version on mantid and exit. ``--error-on-warning`` will convert python warnings into exceptions. This is intended for developers so they can find deprecation warnings more easily. - Improved the performance of the table workspace display for large datasets - A new empty facility with empty instrument is the default facility now, and user has to select their choice of facility (including ISIS) and instrument for the first time diff --git a/qt/applications/workbench/workbench/app/main.py b/qt/applications/workbench/workbench/app/main.py index 0f46a317a3157e5445385818fb6721d52a1eb6cf..e6beadc488ba7e2c415c3ec9fc1d5fde723184a6 100644 --- a/qt/applications/workbench/workbench/app/main.py +++ b/qt/applications/workbench/workbench/app/main.py @@ -7,12 +7,15 @@ # This file is part of the mantid workbench. import argparse import os +from mantid import __version__ as mtd_version +import warnings def main(): # setup command line arguments parser = argparse.ArgumentParser(description='Mantid Workbench') parser.add_argument('script', nargs='?') + parser.add_argument('--version', action='version', version=mtd_version) parser.add_argument('-x', '--execute', action='store_true', @@ -24,6 +27,10 @@ def main(): parser.add_argument('--profile', action='store', help='Run workbench with execution profiling. Specify a path for the output file.') + parser.add_argument('--error-on-warning', + action='store_true', + help='Convert python warnings to exceptions') + try: # set up bash completion as a soft dependency import argcomplete @@ -34,6 +41,10 @@ def main(): # parse the command line options options = parser.parse_args() + if options.error_on_warning: + warnings.simplefilter("error") # Change the filter in this process + os.environ["PYTHONWARNINGS"] = "error" # Also affect subprocesses + if options.profile: import cProfile output_path = os.path.abspath(os.path.expanduser(options.profile))