В чëм ошибка?
import getLogger
import sqlite3
import pymysql
con = sqlite3.connect("./gdpsTables.db")
cur = con.cursor()
def getDB(guildID: int):
cur.execute(f"SELECT host FROM servers WHERE guildID = {guildID}")
host = cur.fetchone()
cur.execute(f"SELECT user FROM servers WHERE guildID = {guildID}")
user = cur.fetchone()
cur.execute(f"SELECT password FROM servers WHERE guildID = {guildID}")
password = cur.fetchone()
cur.execute(f"SELECT dbname FROM servers WHERE guildID = {guildID}")
dbname = cur.fetchone()
getLogger.info("Connecting")
global conn
conn = pymysql.connect(
host = host[0],
user = user[0],
password = password[0],
database = dbname[0],
cursorclass = pymysql.cursors.DictCursor
)
getLogger.info("Succes")
with getDB(816668727055089684).conn:
with getDB(816668727055089684).conn.cursor() as curr:
curr.execute(
"SELECT userID FROM users"
)
print(curr.fetchone())
В линии 27 ошибка что нету атрибута conn