From 0f466f78e48c24cdf0f5e39645c19d58e3654012 Mon Sep 17 00:00:00 2001 From: kaliko Date: Thu, 4 Oct 2012 17:28:45 +0200 Subject: [PATCH] python3 conversion Only supports python >= 3.2 --- mpd.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mpd.py b/mpd.py index 7305f7d..674f714 100644 --- a/mpd.py +++ b/mpd.py @@ -396,7 +396,8 @@ class MPDClient(object): sock = socket.socket(af, socktype, proto) sock.connect(sa) return sock - except socket.error, err: + except socket.error as socket_err: + err = socket_err if sock is not None: sock.close() if err is not None: @@ -411,8 +412,8 @@ class MPDClient(object): self._sock = self._connect_unix(host) else: self._sock = self._connect_tcp(host, port) - self._rfile = self._sock.makefile("rb") - self._wfile = self._sock.makefile("wb") + self._rfile = self._sock.makefile("r") + self._wfile = self._sock.makefile("w") try: self._hello() except: -- 2.39.5