Compare commits

...

2 Commits

Author SHA1 Message Date
panni b865dd48a0 core: core: also clean PYTHONHOME when calling external notification app 2019-03-17 22:32:46 +01:00
panni d32c891611 log stuff 2019-03-17 06:51:41 +01:00
+7 -2
View File
@@ -286,6 +286,7 @@ def notify_executable(exe_info, videos, subtitles, storage):
"subtitle_language", "subtitle_path", "subtitle_filename", "provider", "score", "storage", "series_id",
"series", "title", "section", "filename", "path", "folder", "season_id", "type", "id", "season"
)
to_clean = ("PYTHONPATH", "PYTHONHOME")
exe, arguments = exe_info
for video, video_subtitles in subtitles.items():
for subtitle in video_subtitles:
@@ -321,14 +322,18 @@ def notify_executable(exe_info, videos, subtitles, storage):
env = dict(os.environ)
# clean out any Plex-PYTHONPATH that may bleed through the spawned process
if "PYTHONPATH" in env and "plex" in env["PYTHONPATH"].lower():
del env["PYTHONPATH"]
for v in to_clean:
if v in env and "plex" in env[v].lower():
del env[v]
try:
proc = subprocess.Popen(quote_args([exe] + prepared_arguments), stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True, env=env, cwd=os.path.dirname(exe))
output, errors = proc.communicate()
Log.Info("Executable: %s, Env: %s, Exe_info: %s, Output: %s, Errors: %s"
% (quote_args([exe] + prepared_arguments), env, exe_info, output, errors))
if proc.returncode == 1:
Log.Error(u"Calling %s with args %s failed: output:\n%s, error:\n%s", exe, prepared_arguments,
output, errors)