[Python] Why do I get AttributeError: 'NoneType' object has no attribute 'something'?

Discussão em 'Python' iniciado por Stack, Janeiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I got this error:

    AttributeError: 'NoneType' object has no attribute 'something'


    What general scenarios might cause such an AttributeError, and how can I identify the problem?


    This is a special case of AttributeErrors. It merits separate treatment because there are a lot of ways to get an unexpected None value from the code, so it's typically a different problem; for other AttributeErrors, the problem might just as easily be the attribute name.

    See also What is a None value? and What is a 'NoneType' object? for an understanding of None and its type, NoneType.

    Continue reading...

Compartilhe esta Página