Sean Wang added the comment:
This bug still exists in Python 2.7.10 with optparse version 1.5.3.
When the default_value is not ASCII encoded, it would raise
`UnicodeEncodeError: 'ascii' codec can't encode characters`
this error is due to the `str` usage in `expand_default` method:
def expand_default(self, option):
if self.parser is None or not self.default_tag:
return option.help
default_value = self.parser.defaults.get(option.dest)
if default_value is NO_DEFAULT or default_value is None:
default_value = self.NO_DEFAULT_VALUE
return option.help.replace(self.default_tag, str(default_value))
----------
nosy: +Sean.Wang
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue2931>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com