Hi, attempting to follow the getting started tutor...
# ask-community
b
Hi, attempting to follow the getting started tutorial, but getting stuck at about every turn. I believe I have my environment all set up correctly now and am attempting to run the hello_cereal example. Getting the below when I try
dagit -f hello_cereal.py
from within the \jobs directory.
Copy code
Error loading repository location hello_cereal.py:FileNotFoundError: [WinError 2] The system cannot find the file specified: 'hello_cereal.py'
daggy success 1
l
what do you see when you
ls
your current directory?
hello_cereal.py
should be there, otherwise you should point to the actual location of the file
dagit -f /path/to/hello_cereal.py
b
@Liezl Puzon Yep, I'm sitting in the directory. set DAGSTER_HOME=C:\users\bbaker\edw cd %DAGSTER_HOME%\edw\jobs Same error
I've also removed the python venv and tried running without.
When I run with the full path to the py file, the error changes to: Error loading repository location hello_cereal.pyNameError name 'job' is not defined
l
what’s in your
hello_cereal.py
file?
b
Copy code
import requests
import csv
from dagster import job, op, get_dagster_logger


@op
def hello_cereal():
    response = requests.get("<https://docs.dagster.io/assets/cereal.csv>")
    lines = response.text.split("\n")
    cereals = [row for row in csv.DictReader(lines)]
    get_dagster_logger().info(f"Found {len(cereals)} cereals")
@Liezl Puzon ..\ops\hello_cereal.py
The contents of ..\jobs\hello_cereal.py
Copy code
@job
def hello_cereal_job():
    hello_cereal()
l
you need to add the import line to
..\jobs\hello_cereal.py
if you add this to the top of the file it should work
from dagster import job
lots of boilerplate imports haha
oh also
i think you need to add this line to
..\jobs\hello_cereal.py
too:
from ops import hello_cereal
easiest setup is to just put everything in the
..\jobs\hello_cereal.py
just to make sure you can run (like how the tutorial has it in a single file)
b
@Liezl Puzon Ok, that's where I was getting tripped up. Tutorial says "make an op" and says to "save it as hello_cereal.py", but never says where to save it. Then never says to add the @job section to the same file and save it. And never shows them together, so I just had to guess that I was supposed to figure out where to save these files and why since it says I'm also supposed to be executing from the jobs directory.
👍 1
Thanks for your help
👍 1