[Tutor] Cannot open SQLite database

Christian Witts cwitts at compuscan.co.za
Wed Feb 24 09:59:33 CET 2010


Timo wrote:
> 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
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
Is that folder write-able for the user/application under Windows Vista/7 
?  There are some older games for example that cannot be installed in 
the default locations due to being denied write access to their own data.

-- 
Kind Regards,
Christian Witts




More information about the Tutor mailing list