Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making a login page
#11
(Jun-11-2020, 05:57 AM)card51shor Wrote: what different code am i using?
the db.execute(...) line is different

You must pay more attention. And learn how to debug such simple errors on your own.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

#12
what does that mean?
#13
your error states keys but the code shown does not contain keys ?
#14
The traceback suggests that line 38 is the problem. You need to get used to reading those and working through your code to see what's wrong. Clearly you're passing a tuple on that line, so should you be passing a dict there?

FWIW, from the traceback, it looks like you're running locally on a Windows machine. By "online environment", I meant somewhere online that was running your application.
#15
(Jun-11-2020, 05:59 AM)buran Wrote: the db.execute(...) line is different
Sorry, my error - I was looking at the INSERT statement in your code and comparing it with SELECT statement in the traceback

Yet another reason why you should post traceback here, not an image - I overlooked it while switch between tabs
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

#16
(Jun-11-2020, 06:01 AM)ndc85430 Wrote: The traceback suggests that line 38 is the problem. You need to get used to reading those and working through your code to see what's wrong. Clearly you're passing a tuple on that line, so should you be passing a dict there?

FWIW, from the traceback, it looks like you're running locally on a Windows machine. By "online environment", I meant somewhere online that was running your application.

How do u know that is the problem and what is wrong with it? I say Fetchone() and not Fetchall()
#17
this would give the error you are getting
a_tuple = (1, 2, 3)
a_tuple.keys
Error:
(base) C:\Users\Dave\Documents\VS Code WorkSpaces>C:/Users/Dave/anaconda3/python.exe "c:/Users/Dave/Documents/VS Code WorkSpaces/Python Forum/general/forumpost2.py" Traceback (most recent call last): File "c:/Users/Dave/Documents/VS Code WorkSpaces/Python Forum/general/forumpost2.py", line 2, in <module> a_tuple.keys AttributeError: 'tuple' object has no attribute 'keys'
because a_tuple indeed has no attribute keys
#18
(Jun-11-2020, 06:04 AM)Yoriz Wrote: this would give the error you are getting
a_tuple = (1, 2, 3)
a_tuple.keys
Error:
(base) C:\Users\Dave\Documents\VS Code WorkSpaces>C:/Users/Dave/anaconda3/python.exe "c:/Users/Dave/Documents/VS Code WorkSpaces/Python Forum/general/forumpost2.py" Traceback (most recent call last): File "c:/Users/Dave/Documents/VS Code WorkSpaces/Python Forum/general/forumpost2.py", line 2, in <module> a_tuple.keys AttributeError: 'tuple' object has no attribute 'keys'
because a_tuple indeed has no attribute keys

I didn't have that line in my code, though.
#19
fix this line
db.execute('SELECT * FROM users WHERE username = %s AND password = %s', (username, password,))
SQLalchemy doesn't like using tuple to pass values. It's again about how you pass values for placeholders in the sql statement you want to execute
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

#20
(Jun-11-2020, 06:04 AM)card51shor Wrote: How do u know that is the problem and what is wrong with it? I say Fetchone() and not Fetchall()

By reading through the information presented: the traceback says that line 38 is the line in your code where the problem is and the error is about a tuple not having a property called keys. You're passing a tuple on line 38. It's pretty self-explanatory.


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to Connect Login Page oguzcan 1 1,694 Apr-30-2020, 08:24 AM
Last Post: pyzyx3qwerty

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020