python / asyncio

asyncio historical repository
https://docs.python.org/3/library/asyncio.html
1.04k stars 177 forks source link

AttributeError: module 'asyncio' has no attribute 'ensure_future' #406

Closed qietingfengling closed 8 years ago

qietingfengling commented 8 years ago

when I import asyncssh

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/asyncssh-1.6.1/asyncssh/__init__.py", line 23, in <module>
    from .agent import SSHAgentClient, connect_agent
  File "/root/asyncssh-1.6.1/asyncssh/agent.py", line 18, in <module>
    from .misc import ChannelOpenError
  File "/root/asyncssh-1.6.1/asyncssh/misc.py", line 41, in <module>
    ensure_future = asyncio.ensure_future
AttributeError: module 'asyncio' has no attribute 'ensure_future'
Martiusweb commented 8 years ago

Hi,

ensure_future() has been introduced in Python 3.4.4. Which version of python are you using?

ajdavis commented 8 years ago

For compatibility with older versions of asyncio, try:

try:
    from asyncio import ensure_future
except ImportError:
    from asyncio import async as ensure_future