]> git.phdru.name Git - xsetbg.git/blob - xsetbg_db.py
Expand tilde in the database path
[xsetbg.git] / xsetbg_db.py
1 #! /usr/bin/env python
2 """XSetBg database
3
4 """
5
6 __author__ = "Oleg Broytman <phd@phdru.name>"
7 __copyright__ = "Copyright (C) 2014 PhiloSoft Design"
8 __license__ = "GNU GPL"
9
10 __all__ = ['xsetbg_db']
11
12 import anydbm
13 import os
14 import shelve
15 from xsetbg_conf import xsetbg_conf
16
17 xsetbg_db_path = os.path.expanduser(xsetbg_conf.get('xsetbg', 'database'))
18
19 try:
20     xsetbg_db = shelve.open(xsetbg_db_path, 'r')
21 except anydbm.error:
22     xsetbg_db = None