Skip to content
Discussion options

You must be logged in to vote

Oh, thanks for the hint.
You are right, I forgot the except statement. It also works if I change the finally statement to an except path:

async def myPrinter():
    global subTask
    while(True):
        print("== Printing now ==")
        subTask = uasyncio.create_task(subPrinter())
        try:
            await uasyncio.wait_for(subTask, 10000)
        except:
            print("subtask exception")

Due to the missing exception handling for the subTask, the uasyncio.CancelledError will affect the printerTask too. But if I handle it, the printerTask keeps running.

Thank you for the idea.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rootfrogsMakes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants