[Python] Class cannot subclass 'QObject' (has type 'Any') using mypy

Discussão em 'Python' iniciado por Stack, Julho 22, 2025.

  1. Stack

    Stack Membro Participativo

    I have a class that subclasses QObject. Everyting works fine but when I run mypy on it I get the error:

    "error: Class cannot subclass 'QObject' (has type 'Any')"


    At the moment I am totally stuck. I Have been reading the mypy docs but couldn't find where the error was.

    Here the code:

    from PyQt5.QtCore import QObject

    class ServiceLocator(QObject):

    def __init__(self) -> None:
    super().__init__()
    ...


    Cheers.

    Continue reading...

Compartilhe esta Página