From 76ef0554a974b146def6d5be6ff03625d0709ac4 Mon Sep 17 00:00:00 2001 From: sidya82 Date: Mon, 3 Mar 2014 00:52:36 +0100 Subject: [PATCH] =?UTF-8?q?=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20m/fi?= =?UTF-8?q?chier/conf=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20m/loadC?= =?UTF-8?q?onf.py=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20superTornad?= =?UTF-8?q?o.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- m/fichier/conf | 5 +++++ m/loadConf.py | 9 ++++++--- superTornado.py | 10 +++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/m/fichier/conf b/m/fichier/conf index 1a6eb2f..d7ccbbf 100644 --- a/m/fichier/conf +++ b/m/fichier/conf @@ -1,3 +1,8 @@ blind=1 camera=192.168.1.13 portCamera=80 + + + + + diff --git a/m/loadConf.py b/m/loadConf.py index 43d67f8..f4ff97f 100644 --- a/m/loadConf.py +++ b/m/loadConf.py @@ -3,9 +3,12 @@ class LoadConf(object): with open("m/fichier/conf", "r") as source : for ligne in source: data = ligne.rstrip('\n\r').split('=') - if data[0] in key : - source.close() - return data[1] + try : + if data[0] in key : + source.close() + return data[1] + except Exception, e : + pass source.close() return "error" diff --git a/superTornado.py b/superTornado.py index 8065194..de18b8d 100644 --- a/superTornado.py +++ b/superTornado.py @@ -154,7 +154,7 @@ application = tornado.web.Application([ cookie_secret="1213215656") if __name__ == "__main__": - print bcolors.HEADER + "HEADER->Loading configuration ... " + bcolors.ENDC + print bcolors.HEADER + "->Loading configuration ... " + bcolors.ENDC try : blind = config.isBlind() ipCamera = config.ipCamera() @@ -172,7 +172,7 @@ if __name__ == "__main__": print bcolors.FAIL + e.value print "Configuration Loading Failed ! Check Configuration File !" + bcolors.ENDC sys.exit(1) - print "->Configuration Server Load Successfully :" + print bcolors.OKGREEN + "->Configuration Server Load Successfully :" + bcolors.ENDC if blind == True: print " ->Blind unhabitant" else : @@ -182,12 +182,12 @@ if __name__ == "__main__": tornado.options.parse_command_line() try : - print("->Server Start ...") + print(bcolors.HEADER + "->Server Start ..."+ bcolors.ENDC) http_server = tornado.httpserver.HTTPServer(application) http_server.listen(portServ) - print "->Server Start Successfully !" + print bcolors.OKGREEN + "->Server Start Successfully !" + bcolors.ENDC tornado.ioloop.IOLoop.instance().start() except Exception, e : - print "Server Start Failed !" + print bcolors.FAIL + "Server Start Failed !" + bcolors.ENDC print e sys.exit(1)