How to define a db file for sqlite?

Muddy Coder cosmo_general at yahoo.com
Sun Mar 8 03:32:45 EDT 2009


Hi Folks,

I just downloaded and installed pysqlite, and I can import sqlite3
smoothly. Then, I need to connect sqlite by syntax:

>>>conn = sqlite3.connect('adirectory/db')

I wish the data will be stored into directory ---> adirectory, with a
file named in db. But I got kicked out with an error message as:

Unable to open database file

I wonder: does pysqlite open a database file db for me? Or, do I need
to create an empty file inside adirectory with my text editor? Anyway,
somebody please help me out here. After I can connect it, the rest
will be easy to go, thanks!

Muddy coder



More information about the Python-list mailing list