I'm trying to code a qgis plugin using the latest version of python and qgis 2.18 but I keep getting this error message:
AttributeError: AutomatisationDEPLOIEMENT instance has no attribute 'utilisat_lineEdit'
This is my code would anyone kindly help me?
class AutomatisationDEPLOIEMENT:
"""QGIS Plugin Implementation."""
def __init__(self, iface):
"""Constructor.
:param iface: An interface instance that will be passed to this class
which provides the hook by which you can manipulate the QGIS
application at run time.
:type iface: QgisInterface
"""
# Save reference to the QGIS interface
self.iface = iface
# initialize plugin directory
self.plugin_dir = os.path.dirname(__file__)
# initialize locale
locale = QSettings().value('locale/userLocale')[0:2]
locale_path = os.path.join(
self.plugin_dir,
'i18n',
'AutomatisationDEPLOIEMENT_{}.qm'.format(locale))
if os.path.exists(locale_path):
self.translator = QTranslator()
self.translator.load(locale_path)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
# Declare instance attributes
self.actions = []
self.menu = self.tr(u'&Automatisation DEPLOIEMENT')
# TODO: We are going to let the user set this up in a future iteration
self.toolbar = self.iface.addToolBar(u'AutomatisationDEPLOIEMENT')
self.toolbar.setObjectName(u'AutomatisationDEPLOIEMENT')
... snip ...
def loginCheck(self):
username = self.utilisat_lineEdit.text()
password = self.pass_lineEdit.text()
connection = sqlite3.connect("login.db")
result = connection.execute("SELECT * FROM USERS WHERE USERNAME = ? AND PASSWORD = ?", (username, password))
if (len(result.fetchall()) > 0):
print("User Found ! ")
else:
print("User Not Found !")
self.showMessageBox('Warning', 'Invalid Username And Password')
connection.close()
I'm trying to get the logincheck function to work
The error message clearly shows what you did wrong: AttributeError: AutomatisationDEPLOIEMENT instance has no attribute 'utilisat_lineEdit'
In the first line of your loginCheck()
you are trying to access self.utilisat_lineEdit
but this property does not exist. I guess your are trying to access some kind of gui element, but this is not available in your class.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.