From: J. Alexander Treuman Date: Sun, 23 Mar 2008 21:10:41 +0000 (-0400) Subject: mpd.py: strip trailing \n from MPD's hello line for a nicer error message X-Git-Tag: v0.2.0~4 X-Git-Url: http://git.kaliko.me/?p=python-musicpd.git;a=commitdiff_plain;h=285bcce3de90f2e5474978d0bbb5fa4485b957f3;hp=202767471f017c54d1ba73e2ad4bedca5ef0d40f mpd.py: strip trailing \n from MPD's hello line for a nicer error message --- diff --git a/mpd.py b/mpd.py index bd68b3c..c924b3c 100644 --- a/mpd.py +++ b/mpd.py @@ -275,6 +275,7 @@ class MPDClient(object): line = self._rfile.readline() if not line.endswith("\n"): raise ConnectionError, "Connection lost while reading MPD hello" + line = line.rstrip("\n") if not line.startswith(HELLO_PREFIX): raise ProtocolError, "Got invalid MPD hello: '%s'" % line self.mpd_version = line[len(HELLO_PREFIX):].strip()