Skip to content

Commit

Permalink
Add PYTHONPATH to script environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyWong16 committed Jun 30, 2018
1 parent d4784df commit 4437a94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Tautulli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import sys

# Ensure lib added to path, before any other imports
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib/'))
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))

import argparse
import locale
Expand Down
18 changes: 10 additions & 8 deletions plexpy/notifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import os
import re
import requests
import shlex
import smtplib
import subprocess
import sys
import threading
import time
from urllib import urlencode
Expand Down Expand Up @@ -2993,13 +2993,15 @@ def list_scripts(self):

def run_script(self, script):
# Common environment variables
env = {'PLEX_URL': plexpy.CONFIG.PMS_URL,
'PLEX_TOKEN': plexpy.CONFIG.PMS_TOKEN,
'TAUTULLI_URL': helpers.get_plexpy_url(hostname='localhost'),
'TAUTULLI_APIKEY': plexpy.CONFIG.API_KEY,
'TAUTULLI_ENCODING': plexpy.SYS_ENCODING,
}
env.update(os.environ)
env = os.environ.copy()
env.update({
'PLEX_URL': plexpy.CONFIG.PMS_URL,
'PLEX_TOKEN': plexpy.CONFIG.PMS_TOKEN,
'TAUTULLI_URL': helpers.get_plexpy_url(hostname='localhost'),
'TAUTULLI_APIKEY': plexpy.CONFIG.API_KEY,
'TAUTULLI_ENCODING': plexpy.SYS_ENCODING,
'PYTHONPATH': (';' if os.name == 'nt' else ':').join(sys.path)
})

try:
process = subprocess.Popen(script,
Expand Down

0 comments on commit 4437a94

Please sign in to comment.