add nicosenv to PATH before starting

asssure that PATH and therefore python venv ist the same when
starting frappy from NICOS and from commandline
This commit is contained in:
zolliker 2024-11-26 14:57:23 +01:00
parent 8b13e32ed7
commit 910f281b0c

View File

@ -24,7 +24,7 @@
import sys import sys
import json import json
import os import os
from os.path import expanduser, basename from os.path import expanduser, basename, exists
import subprocess import subprocess
import time import time
import re import re
@ -357,6 +357,9 @@ class ServiceManager:
os.chdir(start_dir) os.chdir(start_dir)
if start_dir not in sys.path: if start_dir not in sys.path:
sys.path.insert(0, start_dir) sys.path.insert(0, start_dir)
nicosenv = '/home/nicos/nicos/nicosenv/bin/'
if exists(nicosenv):
env['PATH'] = f"{nicosenv}:{env['PATH']}"
if wait: if wait:
proc = subprocess.Popen(cmd.split(), env=env) proc = subprocess.Popen(cmd.split(), env=env)
for _ in range(3): for _ in range(3):