18 lines
440 B
Python
18 lines
440 B
Python
|
import os
|
||
|
import subprocess
|
||
|
|
||
|
|
||
|
HOSTNAME = '127.0.0.1'
|
||
|
WCSCTL = os.environ.get('WCSCTL')
|
||
|
|
||
|
|
||
|
def run_wcs_script(wcs_dir, script, script_name):
|
||
|
'''Run python script inside w.c.s. environment'''
|
||
|
script_path = wcs_dir / (script_name + '.py')
|
||
|
with script_path.open('w') as fd:
|
||
|
fd.write(script)
|
||
|
|
||
|
subprocess.check_call(
|
||
|
[WCSCTL, 'runscript', '--app-dir', str(wcs_dir), '--vhost', HOSTNAME,
|
||
|
str(script_path)])
|