Skip to content

Commit 75e93c5

Browse files
authored
Fix env loading in notebooks (#1266)
In monorepos it's possible to have multiple `.databricks` folders, while our extension will only put .env file in the root of the workspace. In that case notebook bootstrap code was trying (and failing) to loading `.env` file from the first `.databricks` folder. This change makes sure we load the `.env` file from the first folder that actually has it.
1 parent 937b46c commit 75e93c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/databricks-vscode/resources/python/00-databricks-init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def wrapper(*args, **kwargs):
5252
def load_env_from_leaf(path: str) -> bool:
5353
curdir = path if os.path.isdir(path) else os.path.dirname(path)
5454
env_file_path = os.path.join(curdir, ".databricks", ".databricks.env")
55-
if os.path.exists(os.path.dirname(env_file_path)):
55+
if os.path.exists(env_file_path):
5656
with open(env_file_path, "r") as f:
5757
for line in f.readlines():
5858
key, value = line.strip().split("=", 1)

0 commit comments

Comments
 (0)