]> code.delx.au - bg-scripts/blob - lib/priv_options.py
RandomBG: Make Listener non-writeable
[bg-scripts] / lib / priv_options.py
1 #! /usr/bin/env python
2
3 import os
4
5 __all__ = ['load_options']
6
7 def load_options():
8 FILENAME = os.path.expanduser('~/priv/credentials.conf')
9 options = {}
10 try:
11 options_fd = open(FILENAME, "r")
12
13 for line in options_fd:
14 if line.startswith('#'):
15 continue
16 line = line.strip().split('=')
17 if len(line) < 2:
18 continue
19
20 key = line[0]
21 value = '='.join(line[1:])
22
23 options[key] = value
24
25 options_fd.close()
26 except:
27 pass
28 return options