From 35a4dcc147970fa9795f63d097c9534310814a7e Mon Sep 17 00:00:00 2001 From: Byron Ruth Date: Mon, 30 Dec 2013 09:41:57 -0500 Subject: [PATCH] Ensure client password defaults to empty string In case the a None value is passed during initialization, this ensures the password defaults to an empty string. This prevents receiving a "'NoneType' object has no attribute 'encode'" when preparing the connection. --- pymysql/connections.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymysql/connections.py b/pymysql/connections.py index f7be54c..1aa7656 100644 --- a/pymysql/connections.py +++ b/pymysql/connections.py @@ -590,7 +590,7 @@ class Connection(object): self.host = host self.port = port self.user = user or DEFAULT_USER - self.password = passwd + self.password = passwd or "" self.db = database self.no_delay = no_delay self.unix_socket = unix_socket