from configparser import *, light exception handling in initial value load
This commit is contained in:
parent
e792c22a8e
commit
398514a422
20
dr.botzo.py
20
dr.botzo.py
@ -1,16 +1,20 @@
|
|||||||
#!/usr/bin/env python3.1
|
#!/usr/bin/env python3.1
|
||||||
|
|
||||||
import configparser
|
from configparser import *
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = ConfigParser()
|
||||||
config.read([os.path.expanduser('~/.dr.botzo.cfg'), 'dr.botzo.cfg'])
|
config.read([os.path.expanduser('~/.dr.botzo.cfg'), 'dr.botzo.cfg'])
|
||||||
|
|
||||||
# load connection info
|
try:
|
||||||
server = config.get('IRC', 'server')
|
# load connection info
|
||||||
port = config.getint('IRC', 'port')
|
server = config.get('IRC', 'server')
|
||||||
channel = config.get('IRC', 'channel')
|
port = config.getint('IRC', 'port')
|
||||||
nick = config.get('IRC', 'nick')
|
channel = config.get('IRC', 'channel')
|
||||||
ircname = config.get('IRC', 'name')
|
nick = config.get('IRC', 'nick')
|
||||||
|
ircname = config.get('IRC', 'name')
|
||||||
|
except NoSectionError as e:
|
||||||
|
sys.exit(str(e))
|
||||||
|
|
||||||
# vi:tabstop=4:expandtab:autoindent
|
# vi:tabstop=4:expandtab:autoindent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user