Modify ↓
Opened 14 years ago
Closed 14 years ago
#9841 closed defect (worksforme)
SQLite database connector doesn't work on existing directories
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | database backend | Version: | 0.12.1 |
Severity: | major | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The SQLite database connector doesn't work on existing directories. This can easily verified by creating a new Trac env and using this database URI:
sqlite:/path/that/exists/tractest.db
where the directory /path/that/exists
already exists but tractest.db
doesn't (obviously).
In this case you get the following error:
Database connection string [sqlite:db/trac.db]> sqlite:/mnt/hgfs/Linux-Share/tractest.db Creating and Initializing Project Initenv for '/srv/tracsandbox/testenv2' failed. Failed to create environment. [Errno 17] File exists: '/mnt/hgfs/Linux-Share' Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/admin/console.py", line 422, in do_initenv options=options) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/env.py", line 213, in __init__ self.create(options) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/env.py", line 401, in create DatabaseManager(self).init_db() File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/db/api.py", line 146, in init_db connector.init_db(**args) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/db/sqlite_backend.py", line 187, in init_db os.makedirs(os.path.split(path)[0]) File "/usr/lib/python2.6/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 17] File exists: '/mnt/hgfs/Linux-Share'
I've attached a patch that fixes this problem.
Attachments (1)
Change History (3)
by , 14 years ago
Attachment: | sqlite_mkdirs.patch added |
---|
comment:2 by , 14 years ago
Milestone: | 0.12.2 |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
Heh, I seem to have fixed that already in [10231].
Note:
See TracTickets
for help on using tickets.
Patch against Trac 0.12.1