twitter.common.concurrent cannot be imported with Python 3 due to the rename of Queue to queue. Additionally, the current exception handling code is incompatible with Python 3 scoping changes.
Solution
A few of imports in this repo have already been fixed to fail gracefully. Adopt the same workaround for all usages of Queue
Result
The following code runs with Python 3.6 as expected:
from twitter.common.concurrent import deadline
def myfunctor_happy():
return "I am running deferred"
def myfunctor_unhappy():
raise Exception("I am failing deferred")
print(deadline(myfunctor_happy, propagate=True))
print(deadline(myfunctor_unhappy, propagate=True))
Problem
twitter.common.concurrent
cannot be imported with Python 3 due to the rename ofQueue
toqueue
. Additionally, the current exception handling code is incompatible with Python 3 scoping changes.Solution
A few of imports in this repo have already been fixed to fail gracefully. Adopt the same workaround for all usages of
Queue
Result
The following code runs with Python 3.6 as expected: