Skip to content

dag import error when using sys.path.append(str(Path('.').absolute().parent)) #17714

@ezerkar

Description

@ezerkar

Apache Airflow version:

v2.1.2

OS:

Ubuntu 20.04.1 LTS

Deployment:

local

What happened:

have a file in a parent directory I want to import from, so did this:

import sys
from pathlib import Path
sys.path.append(str(Path('.').absolute().parent))
from get_data_functions import *

this seem to be working in general python but airflow gives out a DAG import error:
ModuleNotFoundError: No module named 'get_data_functions'

Are you willing to submit a PR?
No idea how to fix this, but if you give me some hints I could try

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugThis is a clearly a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions