Hey, I'm working my way trough the tutorial and I'...
# prefect-getting-started
j
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
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
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
ah, sorry, I should have looked closer. I think you need to add some code under my_task - even just
pass
j
No problem, I really appreciate the help! But here it doesn't work in any situation:
p
Hey Jordy - you need to do
Copy code
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
Copy code
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
Hey @Peyton Runyan,thank you! That solved indeed my problem. I put the
pass
on the wrong location. Thanks also @Jeff Hale
👍 1
p
No worries! Are you coming from another language, or is python your normal working language?
j
In my daily work I work mainly with Qlik (SQL like) and SQL. Besides that I'm learning Python and JavaScript.
🙌 3
p
Oh awesome - well welcome to both python and prefect!
j
Thanks! And thank you for the good help here. Great to have an active community on Slack.
🙌 2
❤️ 1