[issue13720] argparse print_help() fails if COLUMNS is set to a low value
Zbyszek Szmek
report at bugs.python.org
Fri Jan 6 14:55:48 CET 2012
New submission from Zbyszek Szmek <zbyszek at in.waw.pl>:
% 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...
----------
components: Library (Lib)
files: test_argparse_narrow.py
messages: 150733
nosy: zbysz
priority: normal
severity: normal
status: open
title: argparse print_help() fails if COLUMNS is set to a low value
versions: Python 3.3
Added file: http://bugs.python.org/file24154/test_argparse_narrow.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13720>
_______________________________________
More information about the Python-bugs-list
mailing list