https://prefect.io logo
Title
a

Alon Barad

05/09/2023, 10:19 AM
Hey, I'm trying to execute my deployment but keep getting an import error
File "/Users/barad/Desktop/Code/prefect/venv/lib/python3.11/site-packages/prefect/utilities/importtools.py", line 164, in load_script_as_module
    raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'quotes_flow.py' encountered an exception: ModuleNotFoundError("No module named 'common'")
How can I change the working directory?
m

Miguel Moncada

05/09/2023, 10:25 AM
Hey @Alon Barad you can do something similar to what it's done in this template https://github.com/Mmoncadaisla/data-flows-template
TL;DR the deployment is defined within the Python package (in my case named
dataflows
) but called from the root of the repository from the
deployments.py
script
This script is being ran from GitHub actions in this case, so whenever the flow or the deployment is modified, the script is called with the corresponding file name.
I'd also recommend reviewing the python package structure in general. I haven't checked it exhaustively but you might encounter dependency import issues as it is
a

Alon Barad

05/09/2023, 10:49 AM
Ill check Thanks!