0

I have a problem with some code I wrote:

def login(username, password):
    c.execute("SELECT * FROM masterPasswords WHERE passw='{}' AND user='{}'".format(password, username))
    if passw == password and user == username:
        return True
    else:
        return False

This is the error log:

Traceback (most recent call last):
  File "C:/Users/fraze/Documents/GitHub/Password-Management/main.py", line 65, in <module>
    account()
  File "C:/Users/fraze/Documents/GitHub/Password-Management/main.py", line 28, in account
    tryLogin()
  File "C:/Users/fraze/Documents/GitHub/Password-Management/main.py", line 15, in tryLogin
    if am.login(usernameInput, masterPassInput) == usernameInput and masterPassInput:
  File "C:\Users\fraze\Documents\GitHub\Password-Management\accountManagement.py", line 19, in login
    c.execute("SELECT * FROM masterPasswords WHERE passw='{}' AND user='{}'".format(password, username))
sqlite3.OperationalError: no such column: passw

I need some help please...

2
  • First the query should be something like c.execute("SELECT * FROM masterPasswords WHERE passw=? AND user=?", (password, username)) to parameterize it. But I don't know whether that will work because it's possible that you didn't build and table with a column called passw. Commented May 28, 2017 at 18:36
  • 1
    Yeah, obviously you table doesn't have a passw column. What is the question here? Commented May 28, 2017 at 19:08

1 Answer 1

0

RESOLVED: The error was that I changed the column names and the old (not changed) database had the older names and I was trying to access the new ones.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.