#255 UnicodeDecodeError: 'utf8' codec can't decode bytes

v3.0
closed-fixed
5
2008-02-14
2008-02-14
No

While generating epydoc documentation for portage package on a Gentoo System I have the following Traceback:
Traceback (most recent call last):
File "/usr/bin/epydoc", line 13, in <module>
cli()
File "/usr/lib64/python2.5/site-packages/epydoc/cli.py", line 965, in cli
main(options, names)
File "/usr/lib64/python2.5/site-packages/epydoc/cli.py", line 783, in main
write_html(docindex, options)
File "/usr/lib64/python2.5/site-packages/epydoc/cli.py", line 823, in write_ht
ml
html_writer.write(options.target)
File "/usr/lib64/python2.5/site-packages/epydoc/docwriter/html.py", line 660,
in write
name_to_docs)
File "/usr/lib64/python2.5/site-packages/epydoc/docwriter/html.py", line 711,
in _write
write_func(f.write, *args)
File "/usr/lib64/python2.5/site-packages/epydoc/docwriter/html.py", line 808,
in write_sourcecode
self._src_code_tab_width).colorize())
File "/usr/lib64/python2.5/site-packages/epydoc/docwriter/html_colorize.py", l
ine 487, in colorize
html = html.decode(coding).encode('ascii', 'xmlcharrefreplace')
File "/usr/lib64/python2.5/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 589-591: invalid
data

Here are the packages involved:
sys-apps/portage-2.1.4.4
dev-lang/python-2.5.1-r5
dev-python/epydoc-3.0.1

Discussion

  • Edward Loper

    Edward Loper - 2008-02-14

    Logged In: YES
    user_id=195958
    Originator: NO

    To clarify, you're running epydoc on the portage package? It looks to me like epydoc is probably right -- that the file in question claims to be utf8, but does not contain correct data. But epydoc should at least be more polite about telling you that (e.g., telling you what file has the issue, and not crashing.) I'll take a closer look when I get a chance. If you know which file it might be crashing on, can you check what bytes 589-591 actually contain? I.e., something like:

    >>> print '%r' % open('/path/to/brokenfile').read()[589:591]

     
  • Edward Loper

    Edward Loper - 2008-02-14

    Logged In: YES
    user_id=195958
    Originator: NO

    Fixed in svn revision 1718. (i.e., if your source file lies about the encoding that it uses, epydoc will no longer crash; instead, it will complain and do the best it can do. In the case of generating colorized source code, it will use the 'ignore' option when decoding, i.e., any characters that don't make sense in the declared encoding will be ignored.)

     
  • Edward Loper

    Edward Loper - 2008-02-14
    • status: open --> closed-fixed
     
  • Nobody/Anonymous

    Logged In: NO

    > To clarify, you're running epydoc on the portage package?
    yes

    After further investigations the involved file seems to be:
    /usr/lib64/python2.5/site-packages/pysqlite2/dbapi2.py from dev-python/pysqlite-2.4.1

    print '%r' % open('/usr/lib64/python2.5/site-packages/pysqlite2/dbapi2.py').read()[589:591]
    ' b'

    I'll test the svn version as soon as I can.

     
  • Sandro Bonazzola

    Logged In: YES
    user_id=600513
    Originator: YES

    Tested working with rev. 1728, thanks.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks