From: J. Alexander Treuman Date: Wed, 10 Jun 2009 01:49:35 +0000 (-0400) Subject: mpd.py: raise ConnectionError if unix sockets aren't supported X-Git-Tag: v0.3.0~34 X-Git-Url: http://git.kaliko.me/?p=python-musicpd.git;a=commitdiff_plain;h=52157b2b51dee943c994076fbd151ad539c1c0e5 mpd.py: raise ConnectionError if unix sockets aren't supported --- diff --git a/mpd.py b/mpd.py index e2ef2e8..3050acd 100644 --- a/mpd.py +++ b/mpd.py @@ -299,6 +299,9 @@ class MPDClient(object): self._wfile = _NotConnected() def _unix_connect(self, path): + if not hasattr(socket, "AF_UNIX"): + raise ConnectionError("Unix domain sockets not supported " + "on this platform") sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(path) return sock