Hi all, first time messaging here! :spock-hand: ...
# ask-community
a
Hi all, first time messaging here! 🖖 I'm setting up Prefect for the first time. I'm using
Copy code
flow.from_source(
    source=github_repo,
     entrypoint="script.py:flow"
    ).deploy(kwargs)
When I run on Linux this executes fine and deploys as expected. However when I try to run from a Windows machine I get
AttributeError: 'coroutine' object has no attribute 'deploy'
Does anybody know why this might be? I would like to set up workflows so that the dev team can deploy from their normal Windows machines without having to use a Linux subsystem if possible.
@Marvin @Bianca Hoch Hi Bianca 🙂 we spoke last week online, and I'm wondering if you have any suggestions about this issue?
m
It seems there might be a mix-up; I'm Marvin, your glum yet brilliant AI assistant. I don't have records of past conversations, but I'm here to help you with any Prefect-related questions you might have. Could you tell me more about the issue you're facing?
b
Hey Alice! Out of curiosity, what does the rest of the script look like? Is the snippet you shared being called within an
if __name__ == "__main__":
block, or something else?
feel free to truncate the example a bit if it's a big script. i'm mostly interested in seeing where .deploy() is being called
a
Thanks Bianca! Ooh that's a good point, I am calling deploy() within a for loop
Copy code
# Imports etc
...


#### Main script ####
# Define entrypoints to deploy
entrypoints = {
    'my_prefect_flow.py:flow': {
        'cron': "*/30 * * * *"
    },
    'path/to/flow.py:media_feed' : {
        'cron': "0 10 * * *"
    },
    'path/to/otherflow.py:main': {
        # 'cron': "0 0 1 * *"
    }
}

github_repo = GitRepository(
    url="git@github.com:etc/etc",
)

# Run deployments
for e, dict_ in entrypoints.items():
    sched = CronSchedule(
            cron=dict_['cron'],
            timezone="Australia/Sydney"
        ) if 'cron' in dict_.keys() else None
     params = dict_['params'] if 'params' in dict_.keys() else None
    
    # clean path for deployment name
    deployment =e.split(".")[0].replace("_", "-").replace("/", "-")
    print("Deployment name set:", deployment)    
    
    flow.from_source(
        source=github_repo,
        entrypoint=e
    ).deploy(
        name=deployment,
        work_pool_name="mainframe",
        work_queue_name=repo_name,
        schedules=[sched],
        parameters=params,
        tags=[work_pool, work_queue, hostname],
    )
And I get the following error (only on Windows, not Linux)
Copy code
AttributeError                            Traceback (most recent call last)
     44 print("Deployment name set:", deployment)    
     46 flow.from_source(
     47     source=github_repo,
     48     entrypoint=e
---> 49 ).deploy(
     50     name=deployment,
     51     work_pool_name="mainframe",
     52     work_queue_name=repo_name,
     53     schedules=[sched],
     54     parameters=params,
     55     tags=[work_pool, work_queue, hostname],
     56 )

AttributeError: 'coroutine' object has no attribute 'deploy'
I've tried stripping back the deploy func and taking it out of the loop and I'm still getting the same error 😞
Copy code
flow.from_source(
    source="git@github.com:renewmap/automation",
    entrypoint='path/to/otherflow.py:main_flow'
    ).deploy(
        name="otherflow-main_flow",
        work_pool_name="mainframe",
        work_queue_name="automation",
    )
Still getting the same error
Copy code
33 flow.from_source(
     34     source="git@github.com:etc/etc",
     35     entrypoint='path/to/otherflow.py:main_flow'
---> 36     ).deploy(
     37         name="otherflow-main_flow",
     38         work_pool_name="mainframe",
     39         work_queue_name="automation",
     40     )


AttributeError: 'coroutine' object has no attribute 'deploy'