Author r.david.murray
Recipients
Date 2002-10-14.04:07:44
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I don't know if this is a module bug or a documentation bug.  I'm
using the documentation from the manual on python.org.

>>> x = TextWrapper()
>>> x.wrap(u'abcd')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.3/textwrap.py", line 239, in wrap
    text = self._munge_whitespace(text)
  File "/usr/local/lib/python2.3/textwrap.py", line 99, in _munge_whitespace
    text = text.translate(self.whitespace_trans)
TypeError: character mapping must return integer, None or unicode

If you do x.replace_whitespace = True, then it will wrap the text.

So either whitespace replacement needs to be fixed, or the docs
need to be updated to note that you have to set replace_whitespace
to false if you want to wrap unicode.
History
Date User Action Args
2007-08-23 14:06:45adminlinkissue622831 messages
2007-08-23 14:06:45admincreate