From ee05e18a9a51bab6933a6af3f38817ee98d15c6b Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Wed, 11 Feb 2009 00:26:25 +0000 Subject: [PATCH] show easy to understand error message on twisted importerror for the not so bright #796 --- deluge/core/core.py | 13 ++++++++----- deluge/ui/gtkui/gtkui.py | 7 +++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index 0f5bcaa18..b4d6d9435 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -30,9 +30,14 @@ import threading import pkg_resources import base64 -from twisted.internet import reactor -from twisted.internet.task import LoopingCall -import twisted.web.client +from deluge.log import LOG as log + +try: + from twisted.internet import reactor + from twisted.internet.task import LoopingCall + import twisted.web.client +except ImportError: + log.error("You must install python-twisted") try: import deluge.libtorrent as lt @@ -54,8 +59,6 @@ from deluge.core.autoadd import AutoAdd from deluge.core.authmanager import AuthManager from deluge.core.rpcserver import export -from deluge.log import LOG as log - STATUS_KEYS = ['active_time', 'compact', 'distributed_copies', 'download_payload_rate', 'eta', 'file_priorities', 'file_progress', 'files', 'hash', 'is_auto_managed', 'is_seed', 'max_connections', 'max_download_speed', 'max_upload_slots', 'max_upload_speed', 'message', 'move_on_completed', diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index 0aa4a56f8..7bf7abc6b 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -26,8 +26,11 @@ from deluge.log import LOG as log # Install the twisted reactor -from twisted.internet import gtk2reactor -reactor = gtk2reactor.install() +try: + from twisted.internet import gtk2reactor + reactor = gtk2reactor.install() +except ImportError: + log.error("You must install python-twisted") import gobject import gettext