[Cython] 0.25.1 annotate_html UnicodeDecodeError

Robert Bradshaw robertwb at math.washington.edu
Tue Nov 22 13:09:00 EST 2016


You can run just this test with

python runtests.py annotate_html

Could you also run with --no-cleanup so see what non-ascii characters
appear in the html file?

On Sat, Nov 19, 2016 at 7:39 PM, Yaroslav Halchenko
<lists at onerussian.com> wrote:
> Ran into it while building a package for Debian
>
> ======================================================================
> FAIL: annotate_html ()
> Doctest: annotate_html
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/usr/lib/python3.5/doctest.py", line 2190, in runTest
>     raise self.failureException(self.format_failure(new.getvalue()))
> AssertionError: Failed doctest test for annotate_html
>   File "/build/cython-0.25.1/build/work-dir/run/cpp/annotate_html/annotate_html.cpython-35m-x86_64-linux-gnu.so", line 1, in annotate_html
>
> ----------------------------------------------------------------------
> File "/build/cython-0.25.1/build/work-dir/run/cpp/annotate_html/annotate_html.cpython-35m-x86_64-linux-gnu.so", line 9, in annotate_html
> Failed example:
>     with open(module_path + '.html') as html_file:
>         html = html_file.read()
> Exception raised:
>     Traceback (most recent call last):
>       File "/usr/lib/python3.5/doctest.py", line 1321, in __run
>         compileflags, 1), test.globs)
>       File "<doctest annotate_html[5]>", line 2, in <module>
>         html = html_file.read()
>       File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
>         return codecs.ascii_decode(input, self.errors)[0]
>     UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 16904: ordinal not in range(128)
>
> which then leads also to
>
> ----------------------------------------------------------------------
> File "/build/cython-0.25.1/build/work-dir/run/cpp/annotate_html/annotate_html.cpython-35m-x86_64-linux-gnu.so", line 13, in annotate_html
> Failed example:
>     assert re.search('<pre .*def.* .*mixed_test.*</pre>', html)
> Exception raised:
>     Traceback (most recent call last):
>       File "/usr/lib/python3.5/doctest.py", line 1321, in __run
>         compileflags, 1), test.globs)
>       File "<doctest annotate_html[7]>", line 1, in <module>
>         assert re.search('<pre .*def.* .*mixed_test.*</pre>', html)
>     NameError: name 'html' is not defined
>
>
> I guess some locale setting/assumptions?
>
> btw -- what is the "proper" way to run this doctest alone using
> runtests.py?
>
> --
> Yaroslav O. Halchenko
> Center for Open Neuroscience     http://centerforopenneuroscience.org
> Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
> Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
> WWW:   http://www.linkedin.com/in/yarik
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel


More information about the cython-devel mailing list