'Broken DAG: FileNotFoundError: [Errno 2] No such file or directory:
I have this snippet of code where it's delivering the error :
airflow_dir=Variable.get("airflow_dir")
#keys = yaml.safe_load(open(airflow_dir+'dags/config/keys.yml').read())
dagConfig = yaml.safe_load(open(airflow_dir+'dags/config/dw_base_gerencial_diaria_matinal.yml').read())
def represent_none(self, _):
return self.represent_scalar('tag:yaml.org,2002:null', '')
yaml.add_representer(type(None), represent_none)
default_args = {
'owner': 'airflow',
'depends_on_past': True,
'retries': 3
}
when run:
Broken DAG: [/opt/airflow/dags/dw_base_gerencial_diaria_matinal.py] Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/airflow/dags/dw_base_gerencial_diaria_matinal.py", line 18, in <module>
dagConfig = yaml.safe_load(open(airflow_dir+'dags/config/dw_base_gerencial_diaria_matinal.yml').read())
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/prado/Downloads/Desenvolvimento_pes/Airflow/dags/config/dw_base_gerencial_diaria_matinal.yml'
The file path is correct and the file exists within the directory.
The yaml.safe_load has the correct path and still displays the msg
I'm using Airflow on Windows with Docker.
I don't know if I need some kind of permission for Airflow to access this directory.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
