summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-05-09 03:01:08 +0200
committeremkael <emkael@tlen.pl>2017-05-09 03:01:08 +0200
commit927beef1350c93083f28b884d5f393eca396d1b5 (patch)
treed4cbb08d95d6d885101666c8bc0399a06699ef77
parent18ec03f6033113472bd8a1e34322a764a2783fac (diff)
Global error handling
-rw-r--r--butler.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/butler.py b/butler.py
index 00644f5..362213d 100644
--- a/butler.py
+++ b/butler.py
@@ -1,26 +1,28 @@
import sys
-from ausbutler.config import load_config
-from ausbutler.goniec import Goniec
-from ausbutler.interface import Interface
-
-
def main():
nowait = 'nowait' not in sys.argv
args = [arg for arg in sys.argv[1:] if arg != 'nowait']
if len(args) == 0:
args = ['calculate', 'generate', 'send']
- i = Interface(load_config('butler'))
+ try:
+ from ausbutler.config import load_config
+ from ausbutler.goniec import Goniec
+ from ausbutler.interface import Interface
+
+ i = Interface(load_config('butler'))
- if 'calculate' in args:
- i.calculate_all()
+ if 'calculate' in args:
+ i.calculate_all()
- if 'generate' in args:
- files = i.generate_all()
- if 'send' in args:
- client = Goniec(load_config('goniec'))
- client.send(files)
+ if 'generate' in args:
+ files = i.generate_all()
+ if 'send' in args:
+ client = Goniec(load_config('goniec'))
+ client.send(files)
+ except Exception as e:
+ print str(e)
if nowait:
raw_input('Press any key to continue...')