From 1bfee6f12c9432bbbc20b278f41ae2684ab23173 Mon Sep 17 00:00:00 2001 From: Ajordat Date: Fri, 18 Aug 2023 01:36:01 +0200 Subject: [PATCH] Fixed connection to the db pymysql uses keyword arguments on `connect` instead of positional arguments. --- Chapter_Three/Lecture_4_Lab/myapp/server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Chapter_Three/Lecture_4_Lab/myapp/server.py b/Chapter_Three/Lecture_4_Lab/myapp/server.py index bd5f876..3da68dd 100644 --- a/Chapter_Three/Lecture_4_Lab/myapp/server.py +++ b/Chapter_Three/Lecture_4_Lab/myapp/server.py @@ -14,7 +14,10 @@ def get(self): class ProbeHandler(tornado.web.RequestHandler): def get(self): try: - db = pymysql.connect('localhost', 'myapp', 'password', 'myapp') + db = pymysql.connect(host='localhost', + user='myapp', + password='password', + database='myapp') cursor = db.cursor() cursor.execute("SELECT VERSION()") result = cursor.fetchone()