X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=xsetbg_db.py;h=ba5ab6c7630cccbdd55cd717000d8ab111f207a4;hb=HEAD;hp=dfa65fce7f307daaaac90c88daadb1143be63674;hpb=1d0a0014b008e5428fb63ed21109f70d39682661;p=xsetbg.git diff --git a/xsetbg_db.py b/xsetbg_db.py index dfa65fc..ba5ab6c 100755 --- a/xsetbg_db.py +++ b/xsetbg_db.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """XSetBg database """ @@ -11,7 +11,7 @@ from xsetbg_conf import xsetbg_conf __all__ = ['xsetbg_db_path', 'xsetbg_db'] # octal; -rw-------; make the database file(s) readable only by the user -os.umask(0066) +os.umask(0o066) class XSetBg(SQLObject): @@ -49,9 +49,10 @@ class SQLiteMassInsert(object): return txn def __exit__(self, *args, **kw): - sqlhub.processConnection.commit() + sqlhub.processConnection.commit(close=True) connection = sqlhub.processConnection = self.connection connection.query("VACUUM") + connection.close() db_dirs = [] @@ -88,5 +89,5 @@ else: xsetbg_db = None if __name__ == '__main__': - print "DB dirs:", db_dirs - print "DB file:", xsetbg_db_path + print("DB dirs:", db_dirs) + print("DB file:", xsetbg_db_path)