Skip to content

asyncio.run() and create_task() fail on Feather Bluefruit Sense (nRF52840) with TaskQueue push_head error #73

@muhammadawais92

Description

@muhammadawais92

When running any code that uses asyncio.run() or asyncio.create_task() on the Adafruit Feather Bluefruit Sense (nRF52840), the program fails with the following error:
Traceback (most recent call last):
File "code.py", line XX, in
File "/lib/asyncio/core.py", line XXX, in run
File "/lib/asyncio/core.py", line XXX, in create_task
AttributeError: 'TaskQueue' object has no attribute 'push_head'

Steps to reproduce:

  1. Use Feather Bluefruit Sense (nRF52840) with CircuitPython 10.x.
  2. Install adafruit_asyncio from the Adafruit bundle.
  3. Run a minimal asyncio script such as:
import asyncio
async def main():
    while True:
        print("Hello")
        await asyncio.sleep(0.5)
asyncio.run(main())

Expected behavior:

  • The coroutine should run, printing “Hello” every 0.5 seconds.

Observed behavior:

  • The program crashes immediately with TaskQueue push_head AttributeError.

Additional context:

  • This appears to be a hardware/library limitation.
  • Using a single while loop without asyncio.run() works as a workaround.

Environment:

Board: Feather Bluefruit Sense (nRF52840)

  • CircuitPython: 10.x
  • adafruit_asyncio version: latest bundle

Workaround:

  • Use a normal while loop or a single async function without create_task() or asyncio.run().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions