From 2b2b425de4fe919e05018f773323e76472e4c737 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 1 Aug 2016 21:02:50 -0700 Subject: [PATCH] igor.script: Replace ArgumentParser(version=...) with a version argument ArgumentParser lost its undocumented version argument in 3.3.0 [1,2,3]. The version action is the documented way to do this [4]. [1]: http://bugs.python.org/issue13248 [2]: https://hg.python.org/cpython/rev/5393382c1b1d [3]: https://hg.python.org/cpython/file/374f501f4567/Misc/HISTORY#l477 [4]: https://docs.python.org/3/library/argparse.html#action --- igor/script.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/igor/script.py b/igor/script.py index acb1a22..685fdd1 100644 --- a/igor/script.py +++ b/igor/script.py @@ -36,8 +36,10 @@ class Script (object): log_levels = [_logging.ERROR, _logging.WARNING, _logging.INFO, _logging.DEBUG] def __init__(self, description=None, filetype='IGOR Binary Wave (.ibw) file'): - self.parser = _argparse.ArgumentParser( - description=description, version=__version__) + self.parser = _argparse.ArgumentParser(description=description) + self.parser.add_argument( + '--version', action='version', + version='%(prog)s {}'.format(__version__)) self.parser.add_argument( '-f', '--infile', metavar='FILE', default='-', help='input {}'.format(filetype)) -- 2.26.2