From: kaliko Date: Thu, 4 Oct 2012 15:28:45 +0000 (+0200) Subject: python3 conversion X-Git-Tag: v0.3.1b~6 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=0f466f78e48c24cdf0f5e39645c19d58e3654012;p=python-musicpd.git python3 conversion Only supports python >= 3.2 --- 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: