"Timo" <timomli...@gmail.com> wrote

OperationalError: unable to open database file

Does the file actually exist where you say it does?

# This will return: C:\Documents and Settings\user\Application Data\myapp
PREFDIR = os.path.join(os.environ['APPDATA'], 'myapp')

Do you check that APPDATA is actually set?

# Connect to the database
def db_connect():
    conn = sqlite3.connect(os.path.join(PREFDIR, 'myapp.db')) # This

Do you do an is file exists check before trrying to use it?
And that the permissions on both directory and file are set up correctly?

That would be my guess at likely errors.


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to