{"record":{"id":"ef5f12f3a5d71ff8","repo":"pola-rs/polars","slug":"objname-object-has-no-attribute-name-r","errorCode":null,"errorMessage":"{objname} object has no attribute {name!r}","messagePattern":"(.+?) object has no attribute (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/_utils/expired.py","lineNumber":87,"sourceCode":"    Raise an `AttributeError` for a non-existent attribute.\n\n    Parameters\n    ----------\n    obj\n        The object on which the attribute was accessed.\n    superclass\n        The superclass of the object used to attempt to access the attribute.\n    name\n        The name of the non-existent attribute.\n    meta\n        Whether the object is a metaclass (default: False).\n    \"\"\"\n    if (super_getattr := getattr(superclass, \"__getattr__\", None)) is not None:\n        return super_getattr(name)\n    else:\n        objname = f\"{obj.__name__!r}\" if meta else f\"{type(obj).__name__!r}\"  # type: ignore[attr-defined]\n        msg = f\"{objname} object has no attribute {name!r}\"\n        raise AttributeError(msg, name=name, obj=obj)\n\n\ndef removed_parameters(\n    *params: RemovedParameter | RenamedParameter,\n) -> IdentityFunction:\n    \"\"\"\n    Decorator to mark function parameters.\n\n    This decorator expects a number of `RemovedParameter` or `RenamedParameter`\n    instances that describe each of the removed parameters of the method.\n    \"\"\"\n    assert len(params) == len({p.name for p in params}), (\n        \"duplicate parameter in removed parameter list\"\n    )\n    params_dict = {p.name: p for p in params}\n\n    def decorate(function: Callable[P, T]) -> Callable[P, T]:\n        @wraps(function)","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/pola-rs/polars/blob/5d8ebabf11caea54a5c29178a64a058762f49766/py-polars/src/polars/_utils/expired.py#L69-L105","documentation":"Fallback AttributeError raised by polars' getattr_fallback when a missing attribute is looked up on a polars class and no superclass __getattr__ handles it. It is the terminal error after removed-attribute checks have passed, producing the standard 'object has no attribute' message (with quoting adapted for metaclasses).","triggerScenarios":"Accessing any misspelled or nonexistent attribute on polars classes that install getattr_fallback in their metaclass or __getattr__ chain, e.g. df.coloumns, pl.DataFame, Expr.lst.sum.","commonSituations":"Typos in attribute names, autocomplete suggestions from outdated tutorials, or code written against a different polars version where the attribute never existed or has a different name.","solutions":["Check the spelling against the current API docs (e.g. it's columns not coloumns)","Use dir(obj) or getattr(obj, 'name', default) to introspect available attributes","Search the migration guide in case the attribute was renamed","Update IDE stubs/types so autocomplete matches the installed version"],"exampleFix":"# before\ndf.coloumns\n# after\ndf.columns","handlingStrategy":"type-guard","validationCode":"valid = [a for a in dir(df) if 'col' in a.lower()]","typeGuard":"def has_attr(obj: object, name: str) -> bool:\n    return hasattr(obj, name) or name in dir(obj)","tryCatchPattern":"try:\n    val = getattr(obj, name)\nexcept AttributeError as e:\n    raise AttributeError(f'{name} missing on {type(obj).__name__}: check docs') from e","preventionTips":["Enable IDE type stubs / mypy with polars plugin","Use dir(obj) during interactive development","Avoid copy-pasting attribute names from old tutorials"],"tags":["python","polars","attribute-error","typo","getattr"],"backgroundTag":"attribute-not-found","analyzedSha":"5d8ebabf11caea54a5c29178a64a058762f49766","analyzedAt":"2026-08-28T18:02:35.179Z","contentChangedAt":"2026-08-28T18:02:35.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}