sqlite3.OperationalError
- From:
- kracekumar ramaraju
- Date:
- 2011-06-24 @ 08:49
hello
I have created new app called Heap,which will store one liner message.
https://github.com/kracekumar/heap,app has most of the code similar to
flaskr.
Now when I start the app I get the error
OperationalError: no such table: contents
So I tried
kracekumar@python-lover:~/codes/python/heap$ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from heap import init_db;init_db()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "heap.py", line 28, in init_db
db.cursor().execute(f.read())
sqlite3.OperationalError: table contents already exists
kracekumar@python-lover:~/codes/python/heap$ sqlite3 heap.db
SQLite version 3.7.4
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables;
Error: unknown command or invalid arguments: "tables;". Enter ".help" for
help
sqlite> .tables
contents
Now table contents exists but the error is below
Traceback (most recent call last):
File
"/usr/local/lib/python2.7/dist-packages/Flask-0.6.1-py2.7.egg/flask/app.py",
line 889, in __call__
return self.wsgi_app(environ, start_response)
File
"/usr/local/lib/python2.7/dist-packages/Flask-0.6.1-py2.7.egg/flask/app.py",
line 879, in wsgi_app
response = self.make_response(self.handle_exception(e))
File
"/usr/local/lib/python2.7/dist-packages/Flask-0.6.1-py2.7.egg/flask/app.py",
line 876, in wsgi_app
rv = self.dispatch_request()
File
"/usr/local/lib/python2.7/dist-packages/Flask-0.6.1-py2.7.egg/flask/app.py",
line 695, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/kracekumar/codes/python/heap/heap.py", line 44, in show_entries
cur=g.db.execute('select quote,created_at from contents order by id desc')
OperationalError: no such table: contents
Is some thing wrong with my code?I am beginning flask.
--
winning regards
kracekumar