I've created a database in a directory called Ujimadata on my C: drive. I'm
using sqlite in Django project. Here is the code I'm using in Komodo when I
get the "sqlite3.OperationalError: unable to open database file" error.


import sqlite3
from sluggy import slugify

conn = sqlite3.connect('c:\Ujimadata\aid.sqlite')
cursor = conn.cursor()
cursor.execute("""SELECT country_code, country_name FROM country""")
for country_code, country_name in cursor.fetchall():
       cursor.execute("UPDATE country SET slug=%s WHERE country_code=%s",
                       (slugify(country_name), country_code))
       conn.commit()


Here is the error message:

Traceback (most recent call last):
  File "C:\Python25\ron_scripts\sqliteConn.py", line 4, in <module>
    conn = sqlite3.connect('c:\Ujimadata\aid.sqlite')
sqlite3.OperationalError: unable to open database file

I also tried to use sqlite within python on the command line.

import sqlite3
conn = sqlite3.connect('c:\Ujimadata\aid.sqlite')
c = conn.cursor()
c.execute("select * from country")

I get this error

Traceback (most recent call last):


sqlite3.OperationalError: unable to open database file

Anyone have any ideas how to fix this problem?

-- 
View this message in context: 
http://www.nabble.com/sqlite3.OperationalError%3A-unable-to-open-database-file-tp24380858p24380858.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to