]> kaliko git repositories - python-musicpd.git/commitdiff
mpd.py: raise ConnectionError if unix sockets aren't supported
authorJ. Alexander Treuman <jat@spatialrift.net>
Wed, 10 Jun 2009 01:49:35 +0000 (21:49 -0400)
committerJ. Alexander Treuman <jat@spatialrift.net>
Wed, 10 Jun 2009 01:49:35 +0000 (21:49 -0400)
mpd.py

diff --git a/mpd.py b/mpd.py
index e2ef2e82ca7e8c63c9e53a15adaf0675d0edfe63..3050acd26d3fa411472962cabc45b0445836c3f7 100644 (file)
--- 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