Skip to content Skip to sidebar Skip to footer

Import Error In Vscode Despite Setting The Pythonpath

I have an airflow environment locally deployed on WSL, and I am using VScode to debug and code. My app folder structure is as follows: ~/workspaces |--- .env |---organization/gcp/d

Solution 1:

Add the following statement at the beginning of the file "facebook_operators.py" to help VSCode find the file that needs to be imported:

import os,sys 
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

(VSCode defaults to find the file from the parent folder of the currently opened file. We can use the above statement to add the file path that needs to be imported to the system path, and then VSCode can find it.)

enter image description here

Post a Comment for "Import Error In Vscode Despite Setting The Pythonpath"