Author zbysz
Recipients zbysz
Date 2012-01-06.13:55:47
SpamBayes Score 0.00394576
Marked as misclassified No
Message-id <1325858148.7.0.947093232457.issue13720@psf.upfronthosting.co.za>
In-reply-to
Content
% cat test_argparse_narrow.py
import argparse
argparse.ArgumentParser().print_help()

% COLUMNS=15 ./python test_argparse_narrow.py
Traceback (most recent call last):
  File "test_argparse_narrow.py", line 2, in <module>
    argparse.ArgumentParser().print_help()
  File "/home/zbyszek/python/cpython/Lib/argparse.py", line 2347, in print_help
    self._print_message(self.format_help(), file)
  File "/home/zbyszek/python/cpython/Lib/argparse.py", line 2321, in format_help
    return formatter.format_help()
  File "/home/zbyszek/python/cpython/Lib/argparse.py", line 276, in format_help
    help = self._root_section.format_help()
  File "/home/zbyszek/python/cpython/Lib/argparse.py", line 206, in format_help
    func(*args)
  File "/home/zbyszek/python/cpython/Lib/argparse.py", line 206, in format_help
    func(*args)
  File "/home/zbyszek/python/cpython/Lib/argparse.py", line 514, in _format_action
    help_lines = self._split_lines(help_text, help_width)
  File "/home/zbyszek/python/cpython/Lib/argparse.py", line 615, in _split_lines
    return _textwrap.wrap(text, width)
  File "/home/zbyszek/python/cpython/Lib/textwrap.py", line 316, in wrap
    return w.wrap(text)
  File "/home/zbyszek/python/cpython/Lib/textwrap.py", line 291, in wrap
    return self._wrap_chunks(chunks)
  File "/home/zbyszek/python/cpython/Lib/textwrap.py", line 220, in _wrap_chunks
    raise ValueError("invalid width %r (must be > 0)" % self.width)
ValueError: invalid width -1 (must be > 0)

argparse should not fail if the user resizes the window to something very thin...
History
Date User Action Args
2012-01-06 13:55:48zbyszsetrecipients: + zbysz
2012-01-06 13:55:48zbyszsetmessageid: <1325858148.7.0.947093232457.issue13720@psf.upfronthosting.co.za>
2012-01-06 13:55:48zbyszlinkissue13720 messages
2012-01-06 13:55:47zbyszcreate