Skip to content

Commit bf49e29

Browse files
author
Alexander Smishlajev
committed
sqlite database creation requires existing directory.
create the database directory in sql_open_connection() if the directory does not exist.
1 parent 58f32d9 commit bf49e29

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

roundup/backends/back_sqlite.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_sqlite.py,v 1.34 2004-10-08 05:37:44 richard Exp $
1+
# $Id: back_sqlite.py,v 1.35 2004-10-16 12:52:53 a1s Exp $
22
'''Implements a backend for SQLite.
33
44
See https://pysqlite.sourceforge.net/ for pysqlite info
@@ -60,6 +60,11 @@ def sql_open_connection(self):
6060
6161
pysqlite will automatically BEGIN TRANSACTION for us.
6262
'''
63+
# make sure the database directory exists
64+
# database itself will be created by sqlite if needed
65+
if not os.path.isdir(self.config.DATABASE):
66+
os.makedirs(self.config.DATABASE)
67+
6368
db = os.path.join(self.config.DATABASE, 'db')
6469
self.config.logging.getLogger('hyperdb').info('open database %r'%db)
6570
conn = sqlite.connect(db=db)

0 commit comments

Comments
 (0)