And the mystery continues...
The code below works, with the same database that my larger code
fails on, even though I've pretty much copied and pasted. I need to
make sure that there is no other difference between the 2.
This means it can't be a permissions problem, or a seqname or id
problem.
I'll let you know what I come up with.
thanks,
Brian Blais
On Mar 7, 2008, at Mar 7:11:26 AM, Brent Pedersen wrote:
>
> is the directory containing the db writable by your web/apache user?
> iirc, the directory has to be writable, not just the file.
>
> On Fri, Mar 7, 2008 at 8:21 AM, Brian Blais <[EMAIL PROTECTED]> wrote:
>>
>> Hello,
>>
>> I am trying to insert rows into a sqlite database, and am getting
>> the
>> error: SQL logic error or missing database. This only happens with
>> inserts, not selects, which are working fine.
>>
>> I am not sure how to debug this one. The insert command I have is:
>>
>> web.insert('comments',who=user._id_,
>> comment=comment,
>> filename=pic.filename,
>> family_id=pic.family_id,
>> person_id=pic.person_id,
>> created=datetime.now(),
>> picture=pic._id_)
>>
>>
#!/usr/bin/env python
from datetime import date,datetime
import os,sys
import web
urls = (
'.*', 'index'
)
class index(object):
def GET(self):
print """<form method="post" action="">
<input type="submit" value="Add" /></p>
</form>"""
def POST(self):
print "<html><body>"
print """<form method="post" action="">
<input type="submit" value="Add" /></p>
</form>"""
print "<plaintext>"
pic_id=2
comment='hello there'
commentsdb = web.select('comments')
comments=[x for x in commentsdb]
print "comments: ",comments
picdb=web.select('pics')
p=[x for x in picdb if x.id==pic_id]
pic=p[0]
userdb = web.select('users')
users=[x for x in userdb]
user=users[1]
print "users: ",users
print "USER: ",user
res=web.insert('comments',who=user.id,
comment=comment,
filename=pic.filename,
family_id=pic.family_id,
person_id=pic.person_id,
created=datetime.now(),
picture=pic.id)
print 'RES: ',res
commentsdb = web.select('comments')
comments=[x for x in commentsdb]
print comments
print "</plaintext>"
print "</body></html>"
web.webapi.internalerror = web.debugerror
web.config.db_parameters = dict(dbn='sqlite', db='family_database.db')
if __name__ == "__main__":
web.run(urls, globals(),web.reloader)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---