What is the reason that this code throws `RuntimeE...
# ask-community
n
What is the reason that this code throws
RuntimeError: Tasks cannot be run outside of a flow
? The
parse
function is a task.
Copy code
with ThreadPoolExecutor() as executor
   res = [executor.submit(parse, root, n) for n in range(0, table_count, 5)]

data = [r.result() for r in as_completed(res)]
a
Not sure it is the cause of the error, but I think you’re missing a
:
after
with ThreadPoolExecutor() as executor