comparison start_bots_from_xml_config.py @ 13:a9077fa9cac9

Added optional parameter to start_bots_from_xml_config.py Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Mon, 17 Aug 2009 13:19:37 +0200
parents 4c842d23d4ce
children 32a35f7eff70
comparison
equal deleted inserted replaced
12:fd695e2b5283 13:a9077fa9cac9
18 18
19 19
20 from bot import bot 20 from bot import bot
21 from time import sleep 21 from time import sleep
22 from xml.dom.minidom import parse 22 from xml.dom.minidom import parse
23 import sys
23 24
24 25
25 bots = [] 26 bots = []
26 27
27 try: 28 try:
28 config = parse('config.xml') 29 if len(sys.argv) > 1:
30 config = parse(sys.argv[1])
31 else:
32 config = parse('config.xml')
29 except IOError: 33 except IOError:
30 print 'Error: config.xml is missing or cannot be read' 34 print 'Error: configuration file is missing or cannot be read'
31 quit(1) 35 quit(1)
32 36
33 bots_jids = [] 37 bots_jids = []
34 for bot_el in config.getElementsByTagName('bot'): 38 for bot_el in config.getElementsByTagName('bot'):
35 if bot_el.getAttribute('jid') in bots_jids: 39 if bot_el.getAttribute('jid') in bots_jids: