Python3, Ubuntu 20.04
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92
When querying the MySQL database I receive this error, the code was working under Python2.7 but not in Python3.
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92
When querying the MySQL database I receive this error, the code was working under Python2.7 but not in Python3.
appointments = App_Connection().Query_All("SELECT * FROM `ea_appointments` WHERE `id` > '%s'" % (record_num,)) class App_Connection(object):
def __init__(self, host="xx.xxx.x.xxx", user="_app", passwd="", db="appoint"):
self.host = host
self.user = user
self.passwd = passwd
self.dbc = db
self.connection()
def connection(self):
self.connection = MySQLdb.connect(self.host, self.user, self.passwd, self.dbc)
def Query_All(self, sql_statement):
cursor = self.connection.cursor()
cursor.execute(sql_statement)
result = cursor.fetchall()
cursor.close()
return result
def Query_One(self, sql_statement):
cursor = self.connection.cursor()
cursor.execute(sql_statement)
result = cursor.fetchone()
cursor.close()
return result
def Commit(self, sql_statement):
cursor = self.connection.cursor()
cursor.execute(sql_statement)
self.connection.commit()
cursor.close()
buran write Apr-27-2021, 01:48 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have re[laced quote tags with python tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have re[laced quote tags with python tags for you.
See BBcode help for more info.
