Creating a login page when passing json values showing me error class NoneType

0 votes
creating python login page showing me error, need how to pass JSON format in python input???when I pass JSON format it shows

error  <class 'NoneType'>
Nov 17, 2020 in Python by rehan
• 160 points
173 views

Hello @

Refer this:http://net-informations.com/python/err/nonetype.htm     if it not resolve your error can you please share your snippet so that we can help you out?

#appriciate your helping

email = input("enter your email ")

password = input("enter your password ")

print(email)

print(password)

def login(email, password):

    mycursor = mydb.cursor()

    query = " select * from users where email=%s AND password=%s"

    mycursor.execute(query,(email,password))

    cur = mycursor.fetchone()

    #  users = cursor.fetchall()

    print(type(cur))

    if cur is None:

        print("User not found, Register First")

else:

  print(cur)

login(email,password)

      

     Input which I am giving -

email "xyz@gmail.com"

password"12345"

how I'll resolve this and I am fetching my data from my db and I fetch data dynamically

Hey, @Rehan,

Could you please check on one thing on which line you are facing the particular error? Meanwhile executing your code snippet, on which line the error is comming up?

1 answer to this question.

0 votes
#appriciate your helping

email = input("enter your email ")

password = input("enter your password ")

print(email)

print(password)

def login(email, password):

    mycursor = mydb.cursor()

    query = " select * from users where email=%s AND password=%s"

    mycursor.execute(query,(email,password))

    cur = mycursor.fetchone()

    #  users = cursor.fetchall()

    print(type(cur))

    if cur is None:

        print("User not found, Register First")

else:

  print(cur)

login(email,password)

       

     Input which I am giving -

email "xyz@gmail.com"

password"12345"

how I'll resolve this and I am fetching my data from my db and I fetch data dynamically
answered Nov 17, 2020 by rehan
• 160 points

Hi, @Rehan.

Are you facing the error as "TypeError: 'NoneType' object is not subscriptable" ?

Related Questions In Python

0 votes
1 answer

How to Parse values from a JSON file?

import json from pprint import pprint with open('data.json') as ...READ MORE

answered Oct 15, 2018 in Python by Priyaj
• 58,120 points
970 views
0 votes
1 answer

Why am I getting a error when I am printing two different data types in python?

different data type is being used. that ...READ MORE

answered Mar 6, 2019 in Python by Mohammad
• 3,230 points
175 views
0 votes
1 answer
0 votes
1 answer

How to run code when a class is subclassed?

Classes (by default) are instances of the ...READ MORE

answered Nov 20, 2020 in Python by Gitika
• 65,870 points
50 views
+2 votes
4 answers

How can I replace values with 'none' in a dataframe using pandas

Actually in later versions of pandas this ...READ MORE

answered Aug 13, 2018 in Python by bug_seeker
• 15,550 points
39,057 views
0 votes
1 answer

How can I convert a list of dictionaries from a CSV into a JSON object in Python?

You could try using the AST module. ...READ MORE

answered Apr 17, 2018 in Python by anonymous
2,258 views
0 votes
2 answers

Extracting data from a JSON file in Python

Here is what i found and was ...READ MORE

answered Nov 27, 2018 in Python by Rupali
26,672 views
0 votes
1 answer

Obtaining a value when given a key in python dicionaries

We cannot. Dictionaries aren't meant to be ...READ MORE

answered May 31, 2018 in Python by Nietzsche's daemon
• 4,260 points
147 views