[Tutor] Cannot open SQLite database
Timo
timomlists at gmail.com
Wed Feb 24 09:38:56 CET 2010
Hello all, my program uses SQLite as database and everything worked fine
until now.
I have over 3000 downloads of my program, but I got 2 mails this week
from people who get this error:
OperationalError: unable to open database file
I searched the net, and all problems seem to be of a not writeable
directory or passing a tilde to connect to the database.
As far as I know, this isn't the case with my program.
Here is some code:
# Get the application data folder
# This will return: C:\Documents and Settings\user\Application Data\myapp
PREFDIR = os.path.join(os.environ['APPDATA'], 'myapp')
# Connect to the database
def db_connect():
conn = sqlite3.connect(os.path.join(PREFDIR, 'myapp.db')) # This
line gives the error
conn.text_factory = str
cursor = conn.cursor()
return (conn, cursor)
I noticed that the 2 users that got the error are Russian, so I thought
that the Russian characters would cause problems. I tried on my Linux
and Windows machines with some Russian names, but thet doesn't seem the
problem.
Some help is appreciated :-).
Cheers,
Timo
More information about the Tutor
mailing list