Skip to content

DeprecationWarning: chardet.universaldetector is deprecated, import UniversalDetector from chardet or chardet.detector instead #601

Description

@vivodi

from chardet.universaldetector import UniversalDetector

C:\Users\vivodi\Projects\Flexget\.venv\Lib\site-packages\html5lib\html5parser.py:284: in parse
    self._parse(stream, False, None, *args, **kwargs)
C:\Users\vivodi\Projects\Flexget\.venv\Lib\site-packages\html5lib\html5parser.py:129: in _parse
    self.tokenizer = _tokenizer.HTMLTokenizer(stream, parser=self, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C:\Users\vivodi\Projects\Flexget\.venv\Lib\site-packages\html5lib\_tokenizer.py:42: in __init__
    self.stream = HTMLInputStream(stream, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C:\Users\vivodi\Projects\Flexget\.venv\Lib\site-packages\html5lib\_inputstream.py:145: in HTMLInputStream
    return HTMLBinaryInputStream(source, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C:\Users\vivodi\Projects\Flexget\.venv\Lib\site-packages\html5lib\_inputstream.py:422: in __init__
    self.charEncoding = self.determineEncoding(useChardet)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C:\Users\vivodi\Projects\Flexget\.venv\Lib\site-packages\html5lib\_inputstream.py:486: in determineEncoding
    from chardet.universaldetector import UniversalDetector
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    """Backward-compatibility stub for ``chardet.universaldetector``.
    
    chardet 6.x exposed :class:`UniversalDetector` via this module path.
    In chardet 7+ the canonical location is :mod:`chardet.detector`, but this
    stub keeps ``from chardet.universaldetector import UniversalDetector``
    working for existing callers.
    
    .. deprecated:: 7.0
        Import from :mod:`chardet` or :mod:`chardet.detector` instead.
    """
    
    from __future__ import annotations
    
    import warnings
    
    from chardet.detector import UniversalDetector
    
>   warnings.warn(
        "chardet.universaldetector is deprecated, "
        "import UniversalDetector from chardet or chardet.detector instead",
        DeprecationWarning,
        stacklevel=2,
    )
E   DeprecationWarning: chardet.universaldetector is deprecated, import UniversalDetector from chardet or chardet.detector instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions