File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,10 @@ def buildProtocol(self, addr):
113113 return EvalProtocol (self .repl )
114114
115115
116- if urwid .VERSION < (1 , 0 , 0 ):
116+ # If Twisted is not available urwid has no TwistedEventLoop attribute.
117+ # Code below will try to import reactor before using TwistedEventLoop.
118+ # I assume TwistedEventLoop will be available if that import succeeds.
119+ if urwid .VERSION < (1 , 0 , 0 ) and hasattr (urwid , 'TwistedEventLoop' ):
117120 class TwistedEventLoop (urwid .TwistedEventLoop ):
118121
119122 """TwistedEventLoop modified to properly stop the reactor.
@@ -144,7 +147,7 @@ def wrapper(*args, **kwargs):
144147 self .reactor .crash ()
145148 return wrapper
146149else :
147- TwistedEventLoop = urwid . TwistedEventLoop
150+ TwistedEventLoop = getattr ( urwid , ' TwistedEventLoop' , None )
148151
149152
150153class StatusbarEdit (urwid .Edit ):
You can’t perform that action at this time.
0 commit comments