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
|
||||
|
||||
import configparser
|
||||
from configparser import *
|
||||
import os
|
||||
import sys
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config = ConfigParser()
|
||||
config.read([os.path.expanduser('~/.dr.botzo.cfg'), 'dr.botzo.cfg'])
|
||||
|
||||
# load connection info
|
||||
server = config.get('IRC', 'server')
|
||||
port = config.getint('IRC', 'port')
|
||||
channel = config.get('IRC', 'channel')
|
||||
nick = config.get('IRC', 'nick')
|
||||
ircname = config.get('IRC', 'name')
|
||||
try:
|
||||
# load connection info
|
||||
server = config.get('IRC', 'server')
|
||||
port = config.getint('IRC', 'port')
|
||||
channel = config.get('IRC', 'channel')
|
||||
nick = config.get('IRC', 'nick')
|
||||
ircname = config.get('IRC', 'name')
|
||||
except NoSectionError as e:
|
||||
sys.exit(str(e))
|
||||
|
||||
# vi:tabstop=4:expandtab:autoindent
|
||||
|
|
Loading…
Reference in New Issue