1
다음 Python Mysql 연결을 테스트하는 간단한 코드가 있습니다. 나는이 코드를 실행하면PyMySQL 커서 유형 오류
connection = pymysql.connect(host = "localhost",
user = "root",
passwd = "",
db = "bugs",
charset = "utf8mb4",
cursorclass = "pymysql.cursors.Dictcursor")
try:
with connection.cursor() as cur:
cur.execute('''SELECT COUNT(*) FROM tbl_firefox''')
for row in cur.fetchall():
print("Number of rows in firefox table:", row)
connection.commit()
finally:
connection.close()
는 내가 다른 파이썬 MySQL의 코드에서 유사한 오류를 볼 수있다
File "test2.py", line 31, in <module>
with connection.cursor() as cur:
File "C:\Program Files\Anaconda3\lib\site-packages\pymysql\connections.py", line 833, in cursor
return self.cursorclass(self)
TypeError: 'str' object is not callable
유형의 오류를 얻을. 그러나 여전히 운이 없다. 누군가 나에게 버그를 지적 할 수 있다면, 많이 감사하겠습니다.
신인 실수 따옴표로 둘러싸여되지 passwd 및 cursorclass 이외의 암호를해야한다. 고마워. – akalanka