[Python-modules-team] Bug#913530: Bug#913530: crashes because of html5lib incompatibility

Nicolas Dandrimont olasd at debian.org
Sun Nov 11 23:34:49 GMT 2018


Control: tags -1 + unreproducible moreinfo

Hi!

* Antoine Beaupre <anarcat at debian.org> [2018-11-11 17:14:52 -0500]:

> Package: python3-bleach
> Version: 2.1.3-1
> Severity: critical
> 
> In current Debian buster, with the Python 3.6 interpreter, bleach
> completely fails to load as a module:
> 
> $ python3
> Python 3.6.7 (default, Oct 21 2018, 08:08:16) 
> [GCC 8.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import bleach
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python3/dist-packages/bleach/__init__.py", line 8, in <module>
>     from bleach.linkifier import (
>   File "/usr/lib/python3/dist-packages/bleach/linkifier.py", line 7, in <module>
>     from html5lib.filters.sanitizer import allowed_protocols
> ImportError: cannot import name 'allowed_protocols'

On an up-to-date sid system, at least with the same package versions as your
system:

$ python3.6
Python 3.6.7 (default, Oct 21 2018, 08:08:16) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bleach
>>> bleach.__file__
'/usr/lib/python3/dist-packages/bleach/__init__.py'
>>> import html5lib
>>> html5lib.__file__
'/usr/lib/python3/dist-packages/html5lib/__init__.py'
>>> from html5lib.filters.sanitizer import allowed_protocols
>>> allowed_protocols
frozenset({'news', 'callto', 'telnet', 'xmpp', 'rsync', 'data', 'nntp', 'irc', 'gopher', 'feed', 'ed2k', 'https', 'webcal', 'urn', 'ftp', 'rtsp', 'afs', 'http', 'tag', 'mailto', 'ssh', 'aim', 'sftp'})

The debci tests for python-readme-renderer, which itself imports bleach, are
also happy (and have always been since the upload of readme-renderer in April).

Please show what html5lib.__file__ returns on your system?

> [...]
>
> The simplest fix for this would probably be to upgrade bleach to the
> latest release. Indeed, this command works around the problem
> completely:
> 
>     sudo pip install bleach

I have the feeling this may be your problem; Don't ever ever install packages
system-wide with pip, as they will shadow the modules that are installed by
Debian, and will never be upgraded, which will lead to all kinds of
weirdnesses.

If my intuition is correct, and an old html5lib has been installed by pip,
you'll want to purge the contents of /usr/local/lib/python3*/dist-packages/ (or
~/.local/lib/python3.6/dist-packages) to fix your system.

Hope this helps,
-- 
Nicolas Dandrimont

The nice thing about Windows is - It does not just crash, it displays a
dialog box and lets you press 'OK' first.
(Arno Schaefer's .sig)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/python-modules-team/attachments/20181112/48bd3b69/attachment.sig>


More information about the Python-modules-team mailing list