Attempting to access a method or property on a variable that evaluated to None.
Occurs when you try to access a method or property (e.g., `user.get('name')` or `data.strip()`), but the variable currently holds `None` instead of the expected object.
Common triggers: calling a function that returns `None` on failure (like `re.search()` or `dict.get()` with missing keys), or mutating list methods like `.sort()` which return `None` in-place.
1numbers = [3, 1, 2]2# list.sort() mutates in place and returns None!3sorted_nums = numbers.sort()4print(sorted_nums.append(4)) # AttributeError: 'NoneType' object has no attribute 'append'1numbers = [3, 1, 2]2 3# Fix 1: Use sorted() to get a new list4sorted_nums = sorted(numbers)5sorted_nums.append(4)6 7# Fix 2: Or call sort() and use original variable8numbers.sort()9numbers.append(4)Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
`numbers.sort()` returns `None`. Assigning that to `sorted_nums` means `sorted_nums` is `None`, so `sorted_nums.append(4)` fails.