Whatever you are passing in when you call morseToText is a function, not a string. Answer from Deleted User on reddit.com
🌐
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

Error with BertTokenizerFast: AttributeError - 'function' object has no attribute 'get'
Hey everyone, I’m stuck while following a HuggingFace tutorial on training a text emotion recognition model. https://www.youtube.com/watch?v=u–UVvH-LIQ Almost there, but when I tried running trainer.train(), it threw an error: You're using a BertTokenizerFast tokenizer. More on discuss.huggingface.co
🌐 discuss.huggingface.co
0
0
October 8, 2023
final project - AttributeError: 'function' object has no attribute 'method' - CS50 Stack Exchange
Hey guys I've been working on my final project. I keep running into this error When I run flask, this error occurs File "/home/ubuntu/project/app.py", line 88, in login if request.method ... More on cs50.stackexchange.com
🌐 cs50.stackexchange.com
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
function has no attribute
I was watching the tutorial about developing a discord bot with python. At the 27th minute I started to get an error. I searched a lot but I couldn’t find a solution. Please help me to understand the situation here. My Code is: import discord import os import json import requests client = ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
0
March 29, 2021
🌐
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
🌐
Hugging Face
discuss.huggingface.co › beginners
Error with BertTokenizerFast: AttributeError - 'function' object has no attribute 'get' - Beginners - Hugging Face Forums
October 8, 2023 - Hey everyone, I’m stuck while following a HuggingFace tutorial on training a text emotion recognition model. https://www.youtube.com/watch?v=u–UVvH-LIQ Almost there, but when I tried running trainer.train(), it threw an error: You're using a BertTokenizerFast tokenizer.
🌐
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.
🌐
Stack Exchange
cs50.stackexchange.com › questions › 42406 › attributeerror-function-object-has-no-attribute-method
final project - AttributeError: 'function' object has no attribute 'method' - CS50 Stack Exchange
I'm confused because the error says line 88, but this if request.method == "GET": is line 53 and this if len(rows) != 1 or not check_password_hash(rows[0]["hash"], request.form.get("password")): is line 88.
🌐
Sololearn
sololearn.com › en › Discuss › 2066141 › attributeerror-function-object-has-no-attribute-get-flask-python
AttributeError: 'function' object has no attribute 'get' - Flask Python | Sololearn: Learn to code for FREE!
November 11, 2019 - It looks to me like you are overwriting the posts dictionary when defining the posts function (the error is a giveaway for that) Try renaming the function to something else: def get_post(post_id): .....
Find elsewhere
🌐
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.
🌐
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.
🌐
Free Python Source Code
freepythonsourcecode.com › post › 97
'function' object has no attribute register and AttributeError
The error AttributeError: 'function' object has no attribute 'get' Python typically occurs when you mistakenly call a method on a function instead of on an object that supports the process.
🌐
freeCodeCamp
forum.freecodecamp.org › python
function has no attribute - Python - The freeCodeCamp Forum
March 29, 2021 - I was watching the tutorial about developing a discord bot with python. At the 27th minute I started to get an error. I searched a lot but I couldn’t find a solution. Please help me to understand the situation here. My Code is: import discord import os import json import requests client = discord.Client() def get_quote(): response = requests.get ("https://zenquotes.io/api/random") json_data = json.loads(response.text) quote = json_data[0]["q"] + " -" + json_data[0]["a"] ...
🌐
CrewAI
community.crewai.com › general
Config error running crew locally: AttributeError: 'function' object has no attribute 'get' - General - CrewAI
December 29, 2024 - I created an empty template project using crewai create. I changed it to hierarchical, edited the yaml files, updated the crew.py file. I ran into several issues with the template (e.g. agent and expected_output missing …
🌐
Free Python Source Code
freepythonsourcecode.com › post › 109
Attributeerror function object has no attribute python.
September 20, 2024 - The error AttributeError: 'function' object has no attribute Python typically occurs when accessing an attribute or method from a function object, but the function doesn't have that attribute or method.
🌐
Reddit
reddit.com › r/learnpython › keep getting error message attributeerror: 'function' object has no attribute 'get'
r/learnpython on Reddit: keep getting error message AttributeError: 'function' object has no attribute 'get'
February 16, 2021 -

hi all, I've started using Tkinter to create a login and register system. The register system works fine but when it comes to logging in once the user has entered their details and presses login I get this error message

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.8/tkinter/__init__.py", line 1883, in __call__
    return self.func(*args)
  File "main.py", line 20, in login_verify
    password1=password_verify.get()
  AttributeError: 'function' object has no attribute 'get'

Im not sure whats causing this error message and why the same error message isn't being called with username_verify.get()

here is my code

from tkinter import *
import os

def register_user():
  username_info = username.get()
  password_info = password.get()

  file = open(username_info, "w")
  file.write(username_info+"\n")
  file.write(password_info)
  file.close()

  username_entry.delete(0, END)
  password_entry.delete(0, END)

  Label(screen1, text= "Registration succesful", fg = "green", font = ("Calibri", 11)).pack()

def login_verify():
  username1=username_verify.get()
  password1=password_verify.get()
  username_entry1.delete(0, END)
  password_entry1.delete(0, END)

  list_of_files = os.listdir()
  if username1 in list_of_files:
    file = open(username1, "r")
    verify = file1.read().splitlines()
    if password1 in verify:
      print("login success")
    else:
      print("Incorrect Password")
  
  else:
    print("User not found")



def password_verify():
  print("working...")

def register():
  global screen1
  screen1= Toplevel(screen)
  screen1.title("Register")
  screen1.title("Register")
  screen1.geometry("300x250")
  
  global username
  global password
  global username_entry
  global password_entry
  username = StringVar()
  password = StringVar()

  Label(screen1, text="Please enter your details below").pack()
  Label(screen1, text ="").pack()
  Label(screen1, text="username * ").pack()
  global username_entry
  global password_entry
  username_entry=Entry(screen1, textvariable = username)
  username_entry.pack()
  Label(screen1, text="Password * ").pack()
  password_entry=Entry(screen1, textvariable = password)
  password_entry.pack()
  Label(screen1, text= "").pack()
  Button(screen1, text = "Register", width = "10", height = "1", command = register_user).pack()


def login():
  global screen2
  screen2 = Toplevel(screen)
  screen2.title("Login")
  screen2.geometry("300x250")
  Label(screen2, text="Please Login").pack()
  Label(screen2, text ="").pack()
  
  global username_verify
  global password_verify

  username_verify=StringVar()
  passsword_verify=StringVar()

  global username_entry1
  global password_entry1

  Label(screen2, text="username * ").pack()
  username_entry1 = Entry(screen2, textvariable=username_verify)
  username_entry1.pack()
  Label(screen2, text= "").pack()
  Label(screen2, text="Password * ").pack()
  password_entry1 = Entry(screen2, textvariable=password_verify)
  password_entry1.pack()
  Label(screen2, text= "").pack()
  Button(screen2, text = "Login", width = 10, height = 1, command = login_verify).pack()




def main_screen():
  global screen
  
  screen=Tk()
  screen.geometry("300x250")
  screen.title("Seller 3.2.5")  
  Label(text="Seller 3.2.5", bg="grey", width="300", height="2", font=("Calibri", 13)).pack()
  Button(text="Login", height="2", width="30", command = login).pack()
  Label(text="").pack()
  Button(text="Register", height="2", width="30", command = register).pack()

  screen.mainloop()

main_screen()

any help would be greatly appreciated

🌐
Reddit
reddit.com › r/django › attributeerror: 'function' object has no attribute 'get' while saving onetoone relation in django?
r/django on Reddit: AttributeError: 'function' object has no attribute 'get' while saving onetoone relation in django?
July 10, 2021 -

I am getting :

AttributeError: 'function' object has no attribute 'get' while saving onetoone relation in django?

While implementing login-signup application.

My project contains two models CustomUser and UserProfile, having OneToOne relation between them.

When user registers in site first he redirected to form for CustomUser model and when he hit the submit button he will again redirected to another form for UserProfile and then login form.But when i am submitting the UserProfile form it shows the error.

view for CustomUser form:-

    def user_registration(request):
        if request.method == "POST":
            fm = UserCreationForm(request.POST)
            if fm.is_valid():
                fm.save()
                return HttpResponseRedirect('/addprofile/')
        else:
            fm = UserCreationForm()
        return render(request, 'signup.html', {'form': fm})

view for UserProfile Form:-

    def create_profile(request):
        if request.method == "POST":
            print(request.POST)
            fm = ProfileForm(requests.post)
            if fm.is_valid():
                instance = fm.save(commit=False)
                instance.user = request.user
                instance.save()
                return HttpResponseRedirect('/login/')
        else:
            fm = ProfileForm()
        return render(request, "profileform.html", {'form': fm})

Full error trace:-

    Internal Server Error: /addprofile/
    Traceback (most recent call last):
      File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
        response = get_response(request)
      File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
        response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "C:\Users\Admin\Desktop\project\EVCFinder\user\views.py", line 26, in create_profile
        if fm.is_valid():
      File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\forms\forms.py", line 175, in is_valid
        return self.is_bound and not self.errors
      File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\forms\forms.py", line 170, in errors
        self.full_clean()
      File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\forms\forms.py", line 372, in full_clean
        self._clean_fields()
      File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\forms\forms.py", line 384, in _clean_fields
        value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))
      File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\django\forms\widgets.py", line 263, in value_from_datadict
        return data.get(name)
    AttributeError: 'function' object has no attribute 'get'
    [10/Jul/2021 18:31:13] "POST /addprofile/ HTTP/1.1" 500 83734
    Not Found: /favicon.ico
    [10/Jul/2021 18:31:13,237] - Broken pipe from ('127.0.0.1', 53626)

Thanks In Advance

🌐
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.
🌐
Frappe
discuss.frappe.io › frappe cloud
Function' object has no attribute 'get_value - Frappe Cloud - Frappe Forum
December 20, 2023 - App Versions { "frappe": "14.60.0", "payments": "0.0.1", "press": "0.7.0" } Route Form/Site/new-site-hwhonrllyy Traceback Traceback (most recent call last): File "apps/frappe/frappe/app.py", line 95, in application response = frappe.api.handle() File "apps/frappe/frappe/api.py", line 55, in handle return frappe.handler.handle() File "apps/frappe/frappe/handler.py", line 47, in handle data = execute_cmd(cmd) File "apps/frappe/frappe/handler.py", line 85, in execute_cmd ...
🌐
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 ...