Skip to content

Commit

Permalink
Print friendly error message if gobject isn't found
Browse files Browse the repository at this point in the history
  • Loading branch information
jodal committed Sep 8, 2014
1 parent 12f9860 commit db48682
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 16 additions & 2 deletions mopidy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,23 @@
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
Expand Down

2 comments on commit db48682

@bjornars
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible to get this to work when runnings tests as well? gobject gets pulled in transitively from conftest.py, and thus not benefiting from this nice error message.

@jodal
Copy link
Owner Author

@jodal jodal commented on db48682 Jul 27, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.