
If the environment variable MANAGED_SPARK_CONNECT_ACTIVE_SESSION_FILE_PATH (or its deprecated alias) is configured as a relative path without any directory components (e.g., "session.json"), os.path.dirname(file_path) will return an empty string "". Calling os.makedirs("", exist_ok=True) will then raise a FileNotFoundError, crashing the session creation process.
To prevent this, ensure that os.makedirs is only called when the directory path is non-empty.
dir_name = os.path.dirname(file_path)
if dir_name:
os.makedirs(dir_name, exist_ok=True)
Originally posted by @gemini-code-assist[bot] in #188 (comment)
If the environment variable
MANAGED_SPARK_CONNECT_ACTIVE_SESSION_FILE_PATH(or its deprecated alias) is configured as a relative path without any directory components (e.g.,"session.json"),os.path.dirname(file_path)will return an empty string"". Callingos.makedirs("", exist_ok=True)will then raise aFileNotFoundError, crashing the session creation process.To prevent this, ensure that
os.makedirsis only called when the directory path is non-empty.Originally posted by @gemini-code-assist[bot] in #188 (comment)