From f76f51a316a67f5877c78ec788066e58d8e40723 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Mon, 26 May 2014 20:41:52 -0400 Subject: [PATCH] Fix imports for the new version of trollius, which changed its package name. --- tornado/platform/asyncio.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tornado/platform/asyncio.py b/tornado/platform/asyncio.py index 162b36735..5d8f30738 100644 --- a/tornado/platform/asyncio.py +++ b/tornado/platform/asyncio.py @@ -10,7 +10,6 @@ unfinished callbacks on the event loop that fail when it resumes) """ from __future__ import absolute_import, division, print_function, with_statement -import asyncio import datetime import functools import os @@ -18,6 +17,17 @@ import os from tornado.ioloop import IOLoop from tornado import stack_context +try: + # Import the real asyncio module for py33+ first. Older versions of the + # trollius backport also use this name. + import asyncio +except ImportError as e: + # Asyncio itself isn't available; see if trollius is (backport to py26+). + try: + import trollius as asyncio + except ImportError: + # Re-raise the original asyncio error, not the trollius one. + raise e class BaseAsyncIOLoop(IOLoop): def initialize(self, asyncio_loop, close_loop=False): -- 2.47.2