SQLite3; weird error

TYR a.harrowell at gmail.com
Mon Oct 29 12:38:44 CET 2007


Has anyone else experienced a weird SQLite3 problem?

Going by the documentation at docs.python.org, the syntax is as
follows:
foo = sqlite3.connect(dbname) creates a connection object representing
the state of dbname and assigns it to variable foo. If dbname doesn't
exist, a file of that name is created.

To do anything with it, you then need to create a cursor object by
calling foo's method cursor (bar = foo.cursor).

You can now pass an SQL query or command to the DB by calling the
cursor object's method execute() with the SQL query as a quoted
statement.

(bar.execute("SELECT FROM squid WHERE squamous=True")

And then do other stuff.

Fine. When I call the cursor object, though, I get an AttributeError;
('builtinfunction_or_method object has no attribute 'execute')

Am running Python 2.5.1 on Mandriva Linux '08.




More information about the Python-list mailing list