# HG changeset patch # User Emmanuel Gil Peyrot # Date 1404993226 -7200 # Node ID f0252cf111d875c2f849af3f822f347a48fafb8a # Parent b21922a038305105dbe3a40dd2652f6886ca2bbf Don’t traceback when GTK+ isn’t available. diff --git a/pytouhou/menu.py b/pytouhou/menu.py --- a/pytouhou/menu.py +++ b/pytouhou/menu.py @@ -15,11 +15,7 @@ from pytouhou.utils.helpers import get_logger logger = get_logger(__name__) -try: - from gi.repository import Gtk, Gdk -except ImportError: - logger.error('GTK+ unavailable, disabling the GUI menu.') - raise +from gi.repository import Gtk, Gdk import sys import re diff --git a/scripts/pytouhou b/scripts/pytouhou --- a/scripts/pytouhou +++ b/scripts/pytouhou @@ -49,8 +49,12 @@ logger.root.name = 'pytouhou' logger.info('Configuration loaded from: %s', ', '.join(options.paths)) if not args.no_menu: - from pytouhou.menu import menu - menu(options, args) + try: + from pytouhou.menu import menu + except ImportError: + logger.error('GTK+ unavailable, disabling the GUI menu.') + else: + menu(options, args) if args.game == 'EoSD': from pytouhou.games.eosd import EoSDCommon as Common, EoSDGame as Game