Hi Prefect family. I'm running the example below i...
# ask-community
b
Hi Prefect family. I'm running the example below in Visual Studio Code in my local machine Windows 10 and getting the error displayed. Any guidance?
k
I couldn’t see the error very well. Could you paste it here?
also I don’t see the use of
fn
in your code
b
Exactly, I'm not using Fn
The error says: 'fn' must be callable
It is a TypeError
m
Hey @Bertangela Loret de Mola what version of prefect are you running?
b
m
So the syntax for your code is written for 1.0 it should actually look more like this
Copy code
import prefect
from prefect import task, flow

@task
def hello_task():
    logger = prefect.logging.get_run_logger()
    <http://logger.info|logger.info>("Hello World!")

@flow
def hello_flow():
    hello_task()

hello_flow()
basically you can define a flow as you would any other python function with just a simple task decorator and then just call the function to run it. I'd also suggest updating to the latest version of prefect as we're no longer in Beta there have been a lot of changes to the functionality 😄
b
Thank you Mason. How do I update the prefect version? I did: "pip install prefect"
On the other hand, the code you sent is giving me this error: raise util.CommandError(resolution) from re alembic.util.exc.CommandError: Can't locate revision identified by '88c2112b668f'
can you pleas assist?
m
Copy code
pip install prefect
should install the latest version, are you running in a virtual environment? if you are you might try starting in a clean environment and install prefect there and try again, I'm not getting any errors when running the code snippet but let me know if you still do when running it in a new environment or after removing and reinstalling prefect.
b
yeah, I'm in a virtual environment. Will try and let you know. Thanks
c
@Bertangela Loret de Mola Hey I got the same problem, unsure about the root cause, but a quick (but potentially destructive) solution is to delete
.prefect
directory (most likely to be in $HOME). Orion started up without issue after