mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 08:16:06 -07:00
Add PYTHONPATH to script environment variables
This commit is contained in:
parent
d4784dff23
commit
4437a94675
2 changed files with 11 additions and 9 deletions
|
@ -25,7 +25,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Ensure lib added to path, before any other imports
|
# 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 argparse
|
||||||
import locale
|
import locale
|
||||||
|
|
|
@ -23,9 +23,9 @@ from paho.mqtt.publish import single
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
import shlex
|
|
||||||
import smtplib
|
import smtplib
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
|
@ -2993,13 +2993,15 @@ class SCRIPTS(Notifier):
|
||||||
|
|
||||||
def run_script(self, script):
|
def run_script(self, script):
|
||||||
# Common environment variables
|
# Common environment variables
|
||||||
env = {'PLEX_URL': plexpy.CONFIG.PMS_URL,
|
env = os.environ.copy()
|
||||||
|
env.update({
|
||||||
|
'PLEX_URL': plexpy.CONFIG.PMS_URL,
|
||||||
'PLEX_TOKEN': plexpy.CONFIG.PMS_TOKEN,
|
'PLEX_TOKEN': plexpy.CONFIG.PMS_TOKEN,
|
||||||
'TAUTULLI_URL': helpers.get_plexpy_url(hostname='localhost'),
|
'TAUTULLI_URL': helpers.get_plexpy_url(hostname='localhost'),
|
||||||
'TAUTULLI_APIKEY': plexpy.CONFIG.API_KEY,
|
'TAUTULLI_APIKEY': plexpy.CONFIG.API_KEY,
|
||||||
'TAUTULLI_ENCODING': plexpy.SYS_ENCODING,
|
'TAUTULLI_ENCODING': plexpy.SYS_ENCODING,
|
||||||
}
|
'PYTHONPATH': (';' if os.name == 'nt' else ':').join(sys.path)
|
||||||
env.update(os.environ)
|
})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(script,
|
process = subprocess.Popen(script,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue