Python Undefined Variable – Mysql Connector

Hello Gang! I'm grateful once again for the advice to use MySQL over Postgres. It's been a pretty smooth experience so far. Unfortunately I had to migrate to a different host and have been getting an undefined variable error.

Mysql is Running. I used the package manager to get python-mysql.connector installed. And yet I keep getting an undefined variable error.

Here is the output:

Exception creating initial db connection
Error:  module 'ssl' has no attribute 'wrap_socket'
Error type:  <class 'AttributeError'>

Here is some test code if you need to replicate it:

import base64
import mysql.connector as mysql
try:
    connection=mysql.connect( host="localhost", database="iheartdaniweb", user="funuser", password="supersekritpass") 
except Exception as error:
    print("Exception creating initial db connection")
    print("Error: ", error)
    print("Error type: ", type(error))
connection.autocommit=True

Thanks in advance gang! Unfortunately the interwebs were no help with this one or I wouldn't bother you guys! Thanks again!! !!

CategoriesUncategorized