diff --git a/mopidy/__init__.py b/mopidy/__init__.py index c91b15c8..f6870e22 100644 --- a/mopidy/__init__.py +++ b/mopidy/__init__.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals import platform import sys +import textwrap import warnings from distutils.version import StrictVersion as SV @@ -19,6 +20,21 @@ if (isinstance(pykka.__version__, basestring) 'ERROR: Mopidy requires Pykka >= 1.1, < 2, but found %s.' % pykka.__version__) +try: + import gobject # noqa +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 + warnings.filterwarnings('ignore', 'could not open display') diff --git a/mopidy/__main__.py b/mopidy/__main__.py index aa8d6dd9..9620b936 100644 --- a/mopidy/__main__.py +++ b/mopidy/__main__.py @@ -4,23 +4,9 @@ import logging import os import signal import sys -import textwrap -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 +import gobject +gobject.threads_init() try: # Make GObject's mainloop the event loop for python-dbus