Model for cross-module globals

This commit is contained in:
SillyLossy
2023-04-07 15:23:41 +03:00
parent ec7a839324
commit ed3324fadc
3 changed files with 15 additions and 14 deletions

View File

@ -1,11 +1,10 @@
import os
import time
import subprocess
import globals
def runServer():
global params
cmd = f"python server.py {' '.join(params)}"
cmd = f"python server.py {' '.join(globals.params)}"
print(cmd)
extras_process = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd='/TavernAI-extras', shell=True)
@ -21,7 +20,6 @@ def runServer():
def extractUrl():
global extras_url
subprocess.call(
'nohup lt --port 5100 > ./extras.out 2> ./extras.err &', shell=True)
print('Waiting for lt init...')
@ -33,8 +31,8 @@ def extractUrl():
for x in range(len(lines)):
if ('your url is: ' in lines[x]):
print('TavernAI Extensions URL:')
extras_url = lines[x].split('your url is: ')[1]
print(extras_url)
globals.extras_url = lines[x].split('your url is: ')[1]
print(globals.extras_url)
break
if (os.path.getsize('./extras.err') > 0):
with open('./extras.err', 'r') as f: