From db4868207c48882931659c11576000b6124f8235 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Mon, 8 Sep 2014 21:15:14 +0200 Subject: [PATCH] Print friendly error message if gobject isn't found Fixes #836 --- docs/changelog.rst | 5 +++++ mopidy/__main__.py | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 7a15fb5a..0ff362f8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -8,6 +8,11 @@ This changelog is used to track all major changes to Mopidy. v0.20.0 (UNRELEASED) ==================== +**Commands** + +- Make the ``mopidy`` command print a friendly error message if the + :mod:`gobject` Python module cannot be imported. (Fixes: :issue:`836`) + **Local backend** - Add cover URL to all scanned files with MusicBrainz album IDs. (Fixes: diff --git a/mopidy/__main__.py b/mopidy/__main__.py index 9620b936..aa8d6dd9 100644 --- a/mopidy/__main__.py +++ b/mopidy/__main__.py @@ -4,9 +4,23 @@ import logging import os import signal import sys +import textwrap -import gobject -gobject.threads_init() +try: + import gobject + gobject.threads_init() +except ImportError: + print(textwrap.dedent(""" + ERROR: The gobject Python package was not found. + + Mopidy requires GStreamer (and GObject) to work. These are C libraries + with a number of dependencies themselves, and cannot be installed with + the regular Python tools like pip. + + Please see http://docs.mopidy.com/en/latest/installation/ for + instructions on how to install the required dependencies. + """)) + raise try: # Make GObject's mainloop the event loop for python-dbus