Python Forum
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 error from Mysql call
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 error from Mysql call
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.

appointments = App_Connection().Query_All("SELECT * FROM `ea_appointments` WHERE `id` > '%s'" % (record_num,))

class App_Connection(object):
    def __init__(self, host="", user="_app", passwd="", db="appoint"): = host
        self.user = user
        self.passwd = passwd
        self.dbc = db

    def connection(self):
        self.connection = MySQLdb.connect(, self.user, self.passwd, self.dbc)

    def Query_All(self, sql_statement):
        cursor = self.connection.cursor()
        result = cursor.fetchall()
        return result

    def Query_One(self, sql_statement):
        cursor = self.connection.cursor()
        result = cursor.fetchone()
        return result

    def Commit(self, sql_statement):
        cursor = self.connection.cursor()
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.
This must be a MySQLdb thing as I have changed module to
import pymysql
and it works as expected

Possibly Related Threads…
Thread Author Replies Views Last Post
  mySQL Database error not resolving. cybertooth 2 182 Aug-30-2021, 05:45 PM
Last Post: ibreeden
  MYSQL.CONNECTOR ERROR DB1 8 821 Jul-23-2021, 03:31 AM
Last Post: DB1
  ASCII-Codec in Python3 [SOLVED] AlphaInc 4 421 Jul-07-2021, 07:05 PM
Last Post: AlphaInc
  pool mysql error - not catch by try\except? korenron 1 304 Jul-05-2021, 11:26 AM
Last Post: ibreeden
Question UnicodeDecodeError . . . JohnnyCoffee 5 756 Feb-28-2021, 02:32 AM
Last Post: JohnnyCoffee
  JSON Decode error when using API to create dataframe Rubstiano7 4 736 Jan-11-2021, 07:52 PM
Last Post: buran
  In this function y initially has no value, but a call to foo() gives no error. Why? Pedroski55 8 928 Dec-19-2020, 07:30 AM
Last Post: ndc85430
  open(file, 'rb') raises UnicodeDecodeError binnybit 1 675 Sep-28-2020, 06:55 AM
Last Post: Gribouillis
  codec for byte transparency Skaperen 7 1,422 Sep-25-2020, 02:20 AM
Last Post: Skaperen
  Error in Mysql Client when upgrading Django Abi 0 552 Sep-21-2020, 06:11 AM
Last Post: Abi

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020