Clearly, your list of x attributes is not homogeneous; at least one of the attributes you list there is a function, while at least one other is a dict.

Answer from Martijn Pieters on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › what is "attributeerror: 'function' object has no attribute 'find'"
r/learnpython on Reddit: what is "AttributeError: 'function' object has no attribute 'find'"
June 18, 2022 -
morseCodeM={".-":"A",
            "-...":"B",
            "-.-.":"C",
            "-..":"D",
            ".":"E",
            "..-.":"F",
            "--.":"G",
            "....":"H",
            "..":"I",
            ".---":"J",
            "-.-":"K",
            ".-..":"L",
            "--":"M",
            "-.":"N",
            "---":"O",
            ".--.":"P",
            "--.-":"Q",
            ".-.":"R",
            "...":"S",
            "-":"T",
            "..-":"U",
            "...-":"V",
            ".--":"W",
            "-..-":"x",
            "-.--":"Y",
            "--..":"Z",
            " / ":" "}
def morseToText(inp):
  out=""
  while(inp!=" "):
    for i in morseCodeM:
      if(inp.find(i)!=-1):    <-----------------------
        out=out+morseCodeM[i]
        inp2=list(inp)
        inp2[inp.find(i):inp.find(i)+(len(i)-1)]=""
        inp="".join(inp2)
        return out

I honestly don't know whats wrong it just gives the error :"AttributeError: 'function' object has no attribute 'find'" on the line with the arrow .

edit: the code is about converting morse code to text

Discussions

python - AttributeError: 'function' object has no attribute 'value' error when reading the variables of a function - Stack Overflow
I need to use a function, inside which there will be another function and inside the 2nd function, there will be another two functions. And I have to access variables of the last two functions at the More on stackoverflow.com
🌐 stackoverflow.com
AttributeError: 'function' object has no attribute '__name__'
Some (maybe all) of the builtin functions do not have a __name__ attribute like regular functions: >>> def f(x): ... return x ... >>> f.__name__ 'f' >>> from math import sin >>> sin.__name__ Traceb... More on github.com
🌐 github.com
2
March 20, 2022
Getting an error during inference fairly simple model: 'function' object has no attribute 'items'
I’ve built a simple generative model to produce an output matrix Y : N x T (the shape/dims). I have a single datum of a matrix D : NxT and I want to fit my generative model parameters so that it will produce samples that very closely match my one data matrix D. I’m hoping the trained generative ... More on forum.pyro.ai
🌐 forum.pyro.ai
0
0
December 31, 2018
Don't know how to fix AttributeError: 'function' object has no attribute 'pk' when trying to create new users from registration form
Hi, I’m still very new to Python and Django. I am trying to create a working registration page and i get this error when submitting the form. I can’t find this error when looking on stack overflow or the forum and don’t know how to fix this issue. I copied the views and models code here. More on forum.djangoproject.com
🌐 forum.djangoproject.com
0
0
September 2, 2023
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-attributeerror-object-has-no-attribute
How to fix AttributeError: object has no attribute - GeeksforGeeks
July 23, 2025 - The hasattr() function is a built-in Python function that is used to check whether an object has a particular attribute or method. We have included the "hasattr()" function inside the if-else to add logic to our code snippet. This will avoid the AttributeError: object has no attribute error.
🌐
Databricks
kb.databricks.com › python › function-object-no-attribute
AttributeError: 'function' object has no attribute
May 19, 2022 - Using protected keywords from the DataFrame API as column names results in a function object has no attribute error message. Written by noopur.nigam Last published at: May 19th, 2022 · You are selecting columns from a DataFrame and you get an error message. ERROR: AttributeError: 'function' object has no attribute '_get_object_id' in job
🌐
GitHub
github.com › micropython › micropython › issues › 8432
AttributeError: 'function' object has no attribute '__name__' · Issue #8432 · micropython/micropython
March 20, 2022 - >>> f.__name__ = 'g' >>> f.some_attr = 'some value' >>> sin.__name__ = 'g' Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: attribute '__name__' of 'builtin_function_or_method' objects is not writable >>> sin.some_attr = 'some value' Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'builtin_function_or_method' object has no attribute 'some_attr'
Author   warnerjon12
🌐
Pyro
forum.pyro.ai › t › getting-an-error-during-inference-fairly-simple-model-function-object-has-no-attribute-items › 620
Getting an error during inference fairly simple model: 'function' object has no attribute 'items' - Pyro Discussion Forum
December 31, 2018 - I’ve built a simple generative model to produce an output matrix Y : N x T (the shape/dims). I have a single datum of a matrix D : NxT and I want to fit my generative model parameters so that it will produce samples that very closely match my one data matrix D. I’m hoping the trained generative model parameters will be able to tell me useful, interpretable information about the structure of my experimental data matrix D. The “forward” pass of my model indeed generates samples that look the way...
Find elsewhere
🌐
Itsourcecode
itsourcecode.com › home › attributeerror: ‘function’ object has no attribute
attributeerror: 'function' object has no attribute [SOLVED]
April 17, 2023 - The “AttributeError: ‘function’ object has no attribute” error occurs when you try to access an attribute or method of an object that doesn’t exist.
🌐
Django Forum
forum.djangoproject.com › using django › forms & apis
Don't know how to fix AttributeError: 'function' object has no attribute 'pk' when trying to create new users from registration form - Forms & APIs - Django Forum
September 2, 2023 - Hi, I’m still very new to Python and Django. I am trying to create a working registration page and i get this error when submitting the form. I can’t find this error when looking on stack overflow or the forum and don’t know how to fix this issue. I copied the views and models code here.
🌐
GitHub
github.com › salesforce › CodeTF › issues › 29
AttributeError: 'function' object has no attribute '__func__' · Issue #29 · salesforce/CodeTF
June 13, 2023 - This repository was archived by the owner on May 1, 2025. It is now read-only. Copy link · Copy link · Open · Open · AttributeError: 'function' object has no attribute '__func__'#29 · Copy link · Paul-B98 · opened · on Jun 13, 2023 · Issue body actions ·
Author   Paul-B98
🌐
Hugging Face
discuss.huggingface.co › beginners
Model = model.to(args.device) AttributeError: 'function' object has no attribute 'to' - Beginners - Hugging Face Forums
February 15, 2022 - I am getting this error when trying to do hyperparameter search Traceback (most recent call last): File "/gpfs7kw/linkhome/rech/genlig01/umg16uw/test/expe_5/traitements/gridsearch_flaubert.py", line 581, in trainer, outdir = prepare_fine_tuning(PRE_TRAINED_MODEL_NAME, train_dataset, val_dataset, ...
🌐
Quora
quora.com › What-does-AttributeError-function-object-has-no-attribute-iterrows-mean
What does AttributeError: 'function' object has no attribute 'iterrows' mean? - Quora
Answer (1 of 2): What it says… You are trying to access an attribute called iterrows but the object in question does not have such attribute, because it is a function, Without seeing the code we can only guess but it seems that you may have forgotten to write a pair of parentheses after the fun...
🌐
GitHub
github.com › pandas-dev › pandas › issues › 48733
BUG: AttributeError: 'function' object has no attribute 'currentframe' · Issue #48733 · pandas-dev/pandas
September 23, 2022 - Pandas version checks I have checked that this issue has not already been reported. I have confirmed this bug exists on the latest version of pandas. I have confirmed this bug exists on the main branch of pandas. Reproducible Example imp...
Author   huka81
🌐
Python Forum
python-forum.io › thread-36765.html
AttributeError: 'function' object has no attribute 'metadata
Hi! Please help me with the error below. Error: Base.metadata.create_all(engine) AttributeError: 'function' object has no attribute 'metadatarepository -> users.py from Model.Domain.users import Users from sqlalchemy.orm import sessionmaker from ...
🌐
PyTorch Forums
discuss.pytorch.org › t › attributeerror-function-object-has-no-attribute-parameters › 127453
AttributeError: 'function' object has no attribute 'parameters' - PyTorch Forums
July 22, 2021 - Inside class Edge, I have issues extracting attribute of class ConvEdge(Edge) # https://github.com/D-X-Y/AutoDL-Projects/issues/99 import torch import torch.utils.data import torch.nn as nn import torch.nn.functional a…
🌐
Free Python Source Code
freepythonsourcecode.com › post › 97
'function' object has no attribute register and AttributeError
5 With Examples fix: AttributeError: 'function' object has no attribute 'glob and AttributeError: 'function' object has no attribute 'get_extra_actions Python · 6 How to Fix AttributeError: 'dict_values' object has no attribute 'update_relative' in Python With Examples.
🌐
Analytics Vidhya
analyticsvidhya.com › home › how to fix attribute error in python?
How to Fix Attribute Error in Python? -
May 17, 2024 - For example, if you meant to write user.name but accidentally typed user.naem you’ll get an AttributeError. The variable you’re trying to access is None: In Python, None represents the absence of a value. If you try to use an attribute on a variable that is None, you’ll get this error. Trying to access a private attribute: In some object-oriented programming contexts, there might be special attributes designed not to be directly accessed.
🌐
Rollbar
rollbar.com › home › how to fix attributeerror in python
How to Fix AttributeError in Python | Rollbar
October 17, 2022 - This can occur when an attempt is made to reference an attribute on a value that does not support the attribute. The Python AttributeError is raised when an invalid attribute reference is made.