https://kedro.org/ logo
#questions
Title
# questions
a

Allen Ma

11/03/2022, 5:59 AM
Hi All: What is the difference between
kedro run
and
metadata = bootstrap_project(Path.cwd())
with KedroSession.create(metadata.package_name) as session:
session.run()
kedro run
can succeed but the second way can’t
n

Nok Lam Chan

11/03/2022, 10:23 AM
Good question! We are about to add more docs. What errors did you get? Kedro need to work from the project root directory, so your path.cwd need to be where the pyproject.toml is Exceptions are the Kedro Jupyter command, where we try to search the root directory for users and that’s the magic behind the “%reload_magic”
a

Allen Ma

11/03/2022, 10:52 AM
Hi @Nok Lam Chan
n

Nok Lam Chan

11/03/2022, 10:55 AM
And Kedro run would work? This is weird the error you shown is not related to Kedro it seems to be your node logic?
Could you share the run.py ? Which command did you run to execute this file and from which directory
a

Allen Ma

11/03/2022, 10:56 AM
python run.py
It doesn’t work
but
python cli.py
It works
n

Nok Lam Chan

11/03/2022, 11:07 AM
Could it be running from different Python environment? From your run.py you are using lots of protected method which shouldn’t be needed, you may want to remove that. It’s unclear what’s wrong here since session.run seems working fine since the error you are got is about your data
a

Allen Ma

11/03/2022, 11:12 AM
This is where it gets weird 😂 In addition to the fact that run.py and cli.py are different, Everything else is the same
hi @Nok Lam Chan
this problem is solved add
if __name__ == '__main__'
before
session.run()
fix it
1
3 Views