AttributeError in Python — What It Means and How to Fix It

What Python's AttributeError exception means and how to resolve it.

Published October 27, 2026

AttributeError is raised when an attribute or method is accessed on an object that doesn't have it.

Key points

  • Catch it specifically with "except AttributeError:" when you want to handle this exact case rather than a bare except

Example

None.append(1)  # AttributeError: 'NoneType' object has no attribute 'append'
More Python articles