Skip to content

Fix PATH corruption on Unix/Linux: use os.pathsep instead of hardcoded semicolons#119

Open
YusDyr wants to merge 1 commit into
TeamPyOgg:masterfrom
YusDyr:fix/pathsep-unix
Open

Fix PATH corruption on Unix/Linux: use os.pathsep instead of hardcoded semicolons#119
YusDyr wants to merge 1 commit into
TeamPyOgg:masterfrom
YusDyr:fix/pathsep-unix

Conversation

@YusDyr
Copy link
Copy Markdown

@YusDyr YusDyr commented May 22, 2026

Summary

  • Replace hardcoded ";" with os.pathsep in library_loader.py lines 104-105 and 120-121
  • os.pathsep is : on Unix/Linux/macOS and ; on Windows — correct for both platforms

Problem

The current code unconditionally uses ; (Windows PATH separator) when appending to os.environ["PATH"]. On Unix systems this corrupts PATH for the entire process and all child subprocesses, making executables in later PATH entries unreachable.

Real-world impact: In Home Assistant (Linux/Docker), importing PyOgg causes /bin/date, /bin/ln, /bin/stat to become unavailable in shell subprocesses, while /usr/bin/ffmpeg (before the corruption point) still works. This creates extremely confusing failures in unrelated components.

Fix

-os.environ["PATH"] += ";" + ";".join((os.getcwd(), _here))
-if paths: os.environ["PATH"] += ";" + ";".join(paths)
+os.environ["PATH"] += os.pathsep + os.pathsep.join((os.getcwd(), _here))
+if paths: os.environ["PATH"] += os.pathsep + os.pathsep.join(paths)

Applied to both load_other() and load_windows() methods.

Fixes #118

🤖 Generated with Claude Code

…d semicolons

The PATH separator is `:` on Unix and `;` on Windows. Using hardcoded
semicolons corrupts PATH on non-Windows platforms, making executables
in later PATH directories unreachable for the entire process and all
child subprocesses.

Fixes TeamPyOgg#118

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

library_loader.py corrupts PATH on Unix/Linux by using semicolons instead of colons

1 participant