What am I doing wrong? When I run this,
import asyncio
def oneSecond():
await asyncio.sleep(1)
I get this:
File "<string>", line 3
await asyncio.sleep(1)
^
SyntaxError: invalid syntax
Using Python 3.3
What am I doing wrong? When I run this,
import asyncio
def oneSecond():
await asyncio.sleep(1)
I get this:
File "<string>", line 3
await asyncio.sleep(1)
^
SyntaxError: invalid syntax
Using Python 3.3
You are using the await keyword with Python 3.3 but it has not been added to Python before version 3.5. You should upgrade your Python version.
Also you will have to define your function as async:
async def oneSecond():
await asyncio.sleep(1)