1

I'm going through the web.py 0.3 tutorials and once I get here I import sqlite3 and set dbn='sqlite3' but it won't work. Has anyone done this before?

Edit - I figured it out. I used the code in the link posted by John and made the following script:

import sqlite3
conn = sqlite3.connect('c:\users\user\py\database')
c = conn.cursor()
c.execute('''
CREATE TABLE todo (id integer primary key, title text, created date, done boolean default 'f');
''')
c.execute('''
CREATE TRIGGER insert_todo_created after insert on todo
begin
update todo set created = datetime('now')
where rowid = new.rowid;
end;
''')
c.execute('''
insert into todo (title) values ('Learn web.py');
''')
conn.commit()
c.close()
asked Feb 20, 2011 at 6:01
2
  • What OS are you on? if not on Windows or Mac, what Linux distribution is it? Furthermore, is it python 2.5 or higher? Even if it is 2.5 or higher, if you don't compile your python with sqlite3 support, you won't have it. Commented Feb 20, 2011 at 6:08
  • It's 2.7 32-bit and I'm on Windows 7. Also I got it to work with Django, so I'm pretty sure I have it. Commented Feb 20, 2011 at 6:31

2 Answers 2

2

Shouldn't it be just dbn='sqlite'?

answered Feb 20, 2011 at 6:09
Sign up to request clarification or add additional context in comments.

Comments

1

Google is your friend. Look at this.

answered Feb 20, 2011 at 6:13

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.