Accessing an attribute or method that doesn't exist on an object.
An AttributeError is raised when you try to access an attribute or call a method on an object that doesn't have it. This can happen with built-in types, custom classes, or `None` values (e.g., `NoneType has no attribute 'split'`).
Common causes: calling a method that doesn't exist on that type (e.g., `.append()` on a string), accessing an attribute before it is assigned in `__init__`, getting `None` from a function and then calling a method on it, or a typo in the method/attribute name.
1text = "hello world"2 3# Trying to call a list method on a string4text.append(" foo")5print(text)1text = "hello world"2 3# Fix 1: Use string concatenation or join for strings4text = text + " foo"5print(text) # "hello world foo"6 7# Fix 2: If you intended a list, use a list8words = ["hello", "world"]9words.append("foo")10print(words) # ['hello', 'world', 'foo']11 12# Fix 3: For None-related AttributeErrors, add a guard13result = None14if result is not None:15 print(result.split())Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
The variable `text` is a `str` object. Strings do not have an `.append()` method — that method belongs to lists. Python raises `AttributeError: 'str' object has no attribute 'append'`. The error message always tells you the type and the missing attribute name.