Kayvan Shah

05/26/2022, 7:36 AM
What does this error trace mean?
Traceback (most recent call last):
  File "/home/kayvan/anaconda3/envs/prefect-conda/lib/python3.9/site-packages/prefect/", line 468, in orchestrate_flow_run
    result = await run_sync_in_worker_thread(flow_call)
  File "/home/kayvan/anaconda3/envs/prefect-conda/lib/python3.9/site-packages/prefect/utilities/", line 54, in run_sync_in_worker_thread
    return await anyio.to_thread.run_sync(call, cancellable=True)
  File "/home/kayvan/anaconda3/envs/prefect-conda/lib/python3.9/site-packages/anyio/", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/kayvan/anaconda3/envs/prefect-conda/lib/python3.9/site-packages/anyio/_backends/", line 937, in run_sync_in_worker_thread
    return await future
  File "/home/kayvan/anaconda3/envs/prefect-conda/lib/python3.9/site-packages/anyio/_backends/", line 867, in run
    result =, *args)
  File "/home/kayvan/projects/prefect-demo/flows/", line 55, in spire_current_weather
    sample = random.choice(conf)
  File "/home/kayvan/anaconda3/envs/prefect-conda/lib/python3.9/", line 346, in choice
    return seq[self._randbelow(len(seq))]
TypeError: object of type 'PrefectFuture' has no len()
using random.choice() to select randomly from a list
Gotcha Was randomly choosing from list in a function wrapped by @flow

Kevin Kho

05/26/2022, 2:09 PM
Are you good now? You can get the result of the PrefectFuture by doing
and then you can use the

Kayvan Shah

05/26/2022, 3:49 PM
Yeah this one's resolved Thank You for the super fast response