homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Russell.Sim
Recipients Russell.Sim, bethard, georg.brandl, terry.reedy, zbysz
Date 2012年07月22日.03:05:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342926357.95.0.339942835565.issue13720@psf.upfronthosting.co.za>
In-reply-to
Content
Hi,
I am having the same problem while running ipython in a batch mode emacs. Apparently you can't even start ipython if the columns are less than 27, since they use the argparse library for the magic method help printing and they preformat the strings at import time. So importing the library fails. :(
I have a simple patch that fixes it but from what i can tell if you set the columns to 10 or 1000 there is no effect on the output, so i wonder if it even pays any attention to the width during rendering.
If you think it's of value I am happy to write tests. Or if someone has a better implementation idea I'll be happy to implement it, but if you are on a terminal that is getting <27 characters then you can't really expect the formmating of the messages to be that readable.
--- cpython/Lib/argparse.py	2012年07月22日 12:10:42.751869655 +1000
+++ /tmp/ediff3953qkY	2012年07月22日 12:54:51.380700044 +1000
@@ -95,6 +95,7 @@
 def _callable(obj):
 return hasattr(obj, '__call__') or hasattr(obj, '__bases__')
 
+MIN_WIDTH = 10
 
 SUPPRESS = '==SUPPRESS=='
 
@@ -486,7 +487,10 @@
 # determine the required width and the entry label
 help_position = min(self._action_max_length + 2,
 self._max_help_position)
- help_width = self._width - help_position
+ if self._width - help_position > MIN_WIDTH:
+ help_width = self._width - help_position
+ else:
+ help_width = MIN_WIDTH
 action_width = help_position - self._current_indent - 2
 action_header = self._format_action_invocation(action)
History
Date User Action Args
2012年07月22日 03:05:58Russell.Simsetrecipients: + Russell.Sim, georg.brandl, terry.reedy, bethard, zbysz
2012年07月22日 03:05:57Russell.Simsetmessageid: <1342926357.95.0.339942835565.issue13720@psf.upfronthosting.co.za>
2012年07月22日 03:05:57Russell.Simlinkissue13720 messages
2012年07月22日 03:05:56Russell.Simcreate

AltStyle によって変換されたページ (->オリジナル) /