Skip to content

await-outside-async (PLE1142)#

Derived from the Pylint linter.

What it does#

Checks for uses of await outside of async functions.

Why is this bad?#

Using await outside of an async function is a syntax error.

Example#

import asyncio


def foo():
    await asyncio.sleep(1)

Use instead:

import asyncio


async def foo():
    await asyncio.sleep(1)

References#