1 |
< |
#!/usr/bin/python |
1 |
> |
#!/usr/bin/env python |
2 |
|
|
3 |
|
## |
4 |
|
## MAIN PROGRAM |
5 |
|
## |
6 |
|
|
7 |
< |
import sys |
7 |
> |
import getopt,sys |
8 |
|
from DashboardAPI import report |
9 |
|
|
10 |
|
if __name__ == '__main__' : |
11 |
< |
args = sys.argv[1:] |
11 |
> |
try: |
12 |
> |
opts, args = getopt.getopt(sys.argv[1:], "f:") |
13 |
> |
except getopt.GetoptError: |
14 |
> |
# print help information and exit: |
15 |
> |
print "Unknown option" |
16 |
> |
sys.exit(1) |
17 |
> |
if len( opts)==1 : |
18 |
> |
copt=opts[0] |
19 |
> |
filename=copt[1] |
20 |
> |
try: |
21 |
> |
rfile=open(filename) |
22 |
> |
except IOError, ex: |
23 |
> |
print "Can not open input file" |
24 |
> |
sys.exit(1) |
25 |
> |
lines=rfile.readlines() |
26 |
> |
for line in lines : |
27 |
> |
args.append(line.strip()) |
28 |
> |
# print args |
29 |
> |
# print "********************" |
30 |
|
report(args) |
31 |
+ |
# print "***" |
32 |
+ |
# print opts |
33 |
+ |
# print "###" |
34 |
+ |
# print args |
35 |
|
sys.exit(0) |
36 |
+ |
|