-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSASRun.py
More file actions
36 lines (31 loc) · 1.65 KB
/
SASRun.py
File metadata and controls
36 lines (31 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import subprocess
import argparse
from pathlib import Path
# CONSOLE FORMATTING
from colorama import init; init()
from colorama import Fore, Back, Style
logError = '\n[LOG]' + Fore.RED + Style.BRIGHT + ' [ERROR] ' + Style.RESET_ALL
def runSAS(projectPath):
if Path(projectPath).is_file():
print('\n--------------------------------------------------------------------------')
print('Launching SAS Project From:\n' + projectPath)
print('--------------------------------------------------------------------------')
print(Back.BLUE)
subprocess.check_call('cscript run.vbs "' + projectPath + '"') # Call SAS and Run Program
print(Style.RESET_ALL)
print('\n[LOG] SAS Project Complete')
else:
print(logError + 'PROJECT FILE NOT FOUND')
#------------------------------------------------------------------------------------------------------------
#############################################################################################################
#------------------------------------------------------------------------------------------------------------
def main():
#--------------------------------------------------------------------------------------------------------
ap = argparse.ArgumentParser() # Intilialize Argument Parser
ap.add_argument('-p', '--project', help = 'Project Path')
args = vars(ap.parse_args()) # Gather Arguments
#--------------------------------------------------------------------------------------------------------
projectPath = args['project']
runSAS(projectPath)
if __name__ == '__main__':
main()