Skip to content

Fix DeprecationWarning: chardet.universaldetector is deprecated - #602

Open
vivodi wants to merge 1 commit into
html5lib:masterfrom
vivodi:vivodi-patch-1
Open

Fix DeprecationWarning: chardet.universaldetector is deprecated#602
vivodi wants to merge 1 commit into
html5lib:masterfrom
vivodi:vivodi-patch-1

Conversation

@vivodi

@vivodi vivodi commented Jul 30, 2026

Copy link
Copy Markdown

Fix #601

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant