From 05b4cb554645a3f0be0f7ee20e0df6b81620ea56 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 18 Nov 2014 12:03:41 +0000 Subject: [PATCH] [GTKUI] Fix ImportError with ReactorAlreadyInstalledError Older systems such as Ubuntu Lucid encountered this import error as Twisted versions < 10 don't have the exception type ReactorAlreadyInstalledError. --- deluge/ui/gtkui/gtkui.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index fab40ebfd..8c38c0eeb 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -39,11 +39,16 @@ gobject.set_prgname("deluge") # Install the twisted reactor from twisted.internet import gtk2reactor -from twisted.internet.error import ReactorAlreadyInstalledError + +try: + from twisted.internet.error import ReactorAlreadyInstalledError +except ImportError: + # ReactorAlreadyInstalledError not available in Twisted version < 10 + pass try: reactor = gtk2reactor.install() -except ReactorAlreadyInstalledError, e: +except ReactorAlreadyInstalledError: # Running unit tests so trial already installed a rector pass