-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDriver.py
34 lines (29 loc) · 1.07 KB
/
Driver.py
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
import sys
from Utility import FileProcessor
from Theater import MovieTheater
def main():
if len(sys.argv) > 0:
file = FileProcessor(sys.argv[0])
mt = MovieTheater()
try:
with open(sys.argv[1], "r") as f:
temp = f.readline()
while temp != "":
output = mt.reserveSeats(temp)
if output == 1:
print("Cannot process request", temp[0:4], "due to invalid number of seats")
if output == -1:
print("Cannot process request", temp[0:4], "due to insufficient seats")
temp = f.readline()
file.writeToFile(mt.getAllocation())
mt.printTheater()
mt.TheaterStats()
except FileNotFoundError:
print("Input File Not Found.")
exit()
except IOError:
print("IO Error")
except Exception as e:
print(e, "Exception Occurred")
if __name__ == "__main__":
main()