summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-11-25 22:27:05 +0100
committeremkael <emkael@tlen.pl>2016-11-25 22:27:05 +0100
commit33159ab536d15adab09da18e0012889023887ec9 (patch)
tree00598d1b8beaf6589d5696579339b3dc6d5ca77c
parent6d5ae86eac297cbc62d56c0479582e50207b05bd (diff)
Wrapping app entry point in method
-rw-r--r--quick_lineup.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/quick_lineup.py b/quick_lineup.py
index 237bc19..965922e 100644
--- a/quick_lineup.py
+++ b/quick_lineup.py
@@ -2,18 +2,23 @@ import sys
from ql.console import Console
-if len(sys.argv) < 3 or len(sys.argv) > 4:
- print('Give correct parameters: round, segment and (optionally) table')
- sys.exit(1)
+def main():
+ if len(sys.argv) < 3 or len(sys.argv) > 4:
+ print('Give correct parameters: round, segment and (optionally) table')
+ sys.exit(1)
-round = int(sys.argv[1])
-segment = int(sys.argv[2])
-if len(sys.argv) == 4:
- table = int(sys.argv[3])
-else:
- table = None
+ round = int(sys.argv[1])
+ segment = int(sys.argv[2])
+ if len(sys.argv) == 4:
+ table = int(sys.argv[3])
+ else:
+ table = None
-try:
- Console(round, segment, table).run()
-except:
- print('ERROR: %s' % sys.exc_info()[1])
+ try:
+ Console(round, segment, table).run()
+ except:
+ print('ERROR: %s' % sys.exc_info()[1])
+
+
+if __name__ == '__main__':
+ main()