https://prefect.io logo
Title
j

Jordy Wegman

12/02/2022, 8:24 PM
Hey, I'm working my way trough the tutorial and I'm getting some errors on the 'flow and task configuration'. It keeps telling me it 'expected an indented block'. But the code seems fine as it's copied from the Prefect site. I found this link which explains it well, but it doesn't solve my issue since everything looks good. All other script examples do work for me. Anyone got an idea?
2
j

Jeff Hale

12/02/2022, 8:28 PM
Hi Jordy. Looks like you need to dedent the
description
and
tags
lines a space or two.
Those lines need to be even with the second vertical line.
j

Jordy Wegman

12/02/2022, 8:31 PM
Hey @Jeff Hale,thanks, I thought so too, but I already tried that. It still gives the issue:
They are both indented with a 'tab'.
j

Jeff Hale

12/02/2022, 8:36 PM
ah, sorry, I should have looked closer. I think you need to add some code under my_task - even just
pass
j

Jordy Wegman

12/02/2022, 8:39 PM
No problem, I really appreciate the help! But here it doesn't work in any situation:
p

Peyton Runyan

12/02/2022, 8:42 PM
Hey Jordy - you need to do
my_task():
    pass
Python won't let you do a completely empty function, so you have use
pass
in the function body for placeholder functions
👍 1
Here's the complete code that should run
from prefect import task, flow

@task(
    name="My example task",
    description="An example task for a tutorial",
    tags=["tut", "test-tag"]
)
def my_task():
    pass

@flow
def my_flow():
    my_task()

if __name__ == "__main__":
    my_flow()
j

Jordy Wegman

12/02/2022, 8:45 PM
Hey @Peyton Runyan,thank you! That solved indeed my problem. I put the
pass
on the wrong location. Thanks also @Jeff Hale
👍 1
p

Peyton Runyan

12/02/2022, 8:45 PM
No worries! Are you coming from another language, or is python your normal working language?
j

Jordy Wegman

12/02/2022, 8:48 PM
In my daily work I work mainly with Qlik (SQL like) and SQL. Besides that I'm learning Python and JavaScript.
🙌 3
p

Peyton Runyan

12/02/2022, 8:49 PM
Oh awesome - well welcome to both python and prefect!
j

Jordy Wegman

12/02/2022, 8:49 PM
Thanks! And thank you for the good help here. Great to have an active community on Slack.
🙌 2
❤️ 1