["python","attributeerror","nonetype"]
Why do I get AttributeError: 'NoneType' object has no attribute 'something'?

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.
NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None. That usually means that an assignment or function call up above failed or returned an unexpected result.