Не удается вызвать функцию класса
#!"C:\\Users\\M1032959\\AppData\\Local\\Programs\\Python\\Python36\\python.exe" import cgi, cgitb import _mysql import sys import logging print ("Content-Type: text/html") print (""" <TITLE>Bank login</TITLE> """) log_fname = "login_Details.log" logging.basicConfig(filename=log_fname, filemode='a', level=logging.DEBUG, format='%(asctime)s : %(levelname)s => %(message)s', datefmt='%Y-%m-%d %H:%M:%S' ) frmEmp = cgi.FieldStorage() try: conn = _mysql.connect("localhost", "root", "", "bank_details") logging.info('connection details:%s',conn) except Exception as e: print ("<br>Connection Error-> e</br>") logging.error('connection error: %s',e) sys.exit() class UserBankData: username = [] upassword = [] def __init__(self): username = self.username upassword = self.upassword def validateData(self): username = frmEmp.getvalue("uname") upassword = frmEmp.getvalue("upassword") # serch username and password in database sql = "SELECT uname,pass FROM login_check" conn.query(sql) login = 0 # Store the result set all_recs = conn.store_result() rec = all_recs.fetch_row() while (rec): for ename, epass in rec: ename = str(ename, 'utf-8') epass = str(epass, 'utf-8') if(username == ename and upassword == epass): login =1 logging.info("User name and Password is correct") break rec = all_recs.fetch_row() if(login == 0): logging.error("User name and Password is not correct.. Please enter proper details") print("User name and Password is not correct.. Please enter proper details") obj = UserBankData() obj.validateData() conn.close()
Что я уже пробовал:
Я новичок в python и написал код giving на python. Когда я запускаю код, он не выдает никаких ошибок, но и не вызывает функцию класса validateData().