I have been wrestling with this issue and i can't figure it out nor do i expect to given my limited experience. It is part of my login_portal which is attached to a database on MySQL and everything works well except i have that recurring message when running. I have placed pass, Exception and ValueException in the except blocks still with the same result... Which given the semantics of the TypeError message just does not compute i feel i have satisfied the problem three-fold.
The error i keep getting at the bottom when running my scripts is below-
Exception ignored in: <function BaseMySQLSocket.del at 0x000001A7375131F0> Traceback (most recent call last): File "C:\Users\georg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\network.py", line 149, in del File "C:\Users\georg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\network.py", line 137, in shutdown TypeError: catching classes that do not inherit from BaseException is not allowed
I am sure "create_db_connection" is my problem function:
# Functions
def create_db_connection(host_name, user_name, pass_word, db_name):
connection = None
try:
connection = mysql.connector.connect(
host=host_name,
user=user_name,
passwd=pass_word,
database=db_name
)
print("MySQL Database connection successful")
except Error as err:
print(f"Error: '{err}'")
def read_query(connection, query):
cursor = connection.cursor()
result = None
try:
cursor.execute(query)
result = cursor.fetchall()
return result
except Error as err:
print(f"Error: '{err}'")
# My calls
connection = create_db_connection('localhost', 'root', 'GeoPlayingCode17##',
'login_details')
results = read_query(connection, q1)