Exception in pydoc

Ricardo Aráoz ricaraoz at gmail.com
Fri Feb 26 17:49:55 CET 2010

I'm developing an in house app. Many coders here are not fluent in
english, so docstrings must be in Spanish in spite of recommendations
that docstrings better be in English.
When I use accented characters (in this case an 'ó') in my docstrings I
get :
>>> help('OpMejoraBizobj')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Python25\lib\site.py", line 346, in __call__
    return pydoc.help(*args, **kwds)
  File "C:\Python25\lib\pydoc.py", line 1645, in __call__
  File "C:\Python25\lib\pydoc.py", line 1687, in help
    elif request: doc(request, 'Help on %s:')
  File "C:\Python25\lib\pydoc.py", line 1481, in doc
    pager(title % desc + '\n\n' + text.document(object, name))
  File "C:\Python25\lib\pydoc.py", line 324, in document
    if inspect.ismodule(object): return self.docmodule(*args)
  File "C:\Python25\lib\pydoc.py", line 1072, in docmodule
    contents.append(self.document(value, key, name))
  File "C:\Python25\lib\pydoc.py", line 325, in document
    if inspect.isclass(object): return self.docclass(*args)
  File "C:\Python25\lib\pydoc.py", line 1208, in docclass
    contents = '\n'.join(contents)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
115: ordinal not in range(128)

The file's first two lines are :
#!/usr/bin/env python
# -*- coding: utf-8 -*-

Does pydoc only deal with ASCII?

More information about the Python-list mailing list