test loading from a config file

This commit is contained in:
Brian S. Stephan 2010-07-24 09:54:38 -05:00
parent 10554dd4a5
commit f45712a94e
1 changed files with 18 additions and 0 deletions

18
dr.botzo.py Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3.1
import configparser
import os
config = configparser.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')
name = config.get('IRC', 'name')
print(server + " " + str(port) + " " + channel + " " + nick + " " + name)
# vi:tabstop=4:expandtab:autoindent