diff --git a/gns3server/utils/asyncio/pool.py b/gns3server/utils/asyncio/pool.py index 8a900722..22750ead 100644 --- a/gns3server/utils/asyncio/pool.py +++ b/gns3server/utils/asyncio/pool.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys import asyncio @@ -39,7 +40,11 @@ class Pool(): while len(self._tasks) > 0 or len(pending) > 0: while len(self._tasks) > 0 and len(pending) < self._concurrency: task, args, kwargs = self._tasks.pop(0) - pending.add(asyncio.create_task(task(*args, **kwargs))) + if sys.version_info >= (3, 7): + t = asyncio.create_task(task(*args, **kwargs)) + else: + t = asyncio.get_event_loop().create_task(task(*args, **kwargs)) + pending.add(t) (done, pending) = await asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED) for task in done: if task.exception():