I’m still seeing this error, even with my flow ent...
# prefect-community
I’m still seeing this error, even with my flow entirely created in the main script:
Copy code
File "/usr/scratch/sasher/pyenvs/prefect/lib/python3.6/site-packages/prefect/utilities/storage.py", line 85, in extract_flow_from_file
    raise ValueError("No flow found in file.")
ValueError: No flow found in file.
Full code:
Copy code
from prefect import Flow
from prefect.environments import LocalEnvironment
from prefect.environments.storage import Local

import logging

if __name__ == "__main__":
    with Flow(
        "Daily DAG",
        storage=Local(stored_as_script=True, path=__file__)
    ) as flow:
        from x import construct_dag, prefectize
        tasks = prefectize(construct_dag(), flow)
        for task in tasks:
I’m game to try another type of storage, but I’m concerned about pickling for my complicated classes.
if __name__ == "__main__":
is not true when
is run. It loads the code from your file and then executes it (but not as a script i.e. not in the main thread) then looks for your variable.
ah, i’m an idiot, now i understand what you’re saying
i totally misread your colleague’s response before
🙃 it happens
Goofy python behavior