SQLite and Python 2.4
Guilherme Polo
ggpolo at gmail.com
Tue Jul 1 21:14:50 EDT 2008
On Tue, Jul 1, 2008 at 9:51 PM, Joe Goldthwaite <joe at goldthwaites.com> wrote:
> I'm confused. (Not a new experience). I've got a web application running
> under Zope. I use the Wing IDE for testing and debugging. When trying to
> recreate problems that come up on the web, I wrote some little routines that
> pull my cookies out of the Firefox cookies.txt file into my code. That way,
> I'm working with all the same options under Wing that my app uses when
> running under Zope.
>
> That's worked great until I upgraded to Firefox 3. Firefox 3 moved their
> cookies from cookies.txt to cookies.sqlite. I haven't worked with SQLite at
> all so I started searching for examples and found this;
>
> import sqlite3
> conn = sqlite3.connect('test.db')
> c = conn.cursor()
> rows = c.execute('SELECT * from somefile')
>
> Looks simple enough but I can't get it to work. Here are my questions;
>
> 1. How do you get sqlite3 for Python 2.4? I can't find it anywhere.
You need sqlite itself (www.sqlite.org) and bindings, pysqlite 2
(http://oss.itsystementwicklung.de/trac/pysqlite/) or aspw
(http://code.google.com/p/apsw/)
>
> 2. If sqlite3 is only for Python 2.5, does sqlite2 work the same way?
>
You are confused, yes. The sqlite3 package that comes with python2.5
is actually pysqlite2, which interfaces with sqlite3.
Also, sqlite3 and sqlite2 files format are not compatible.
> 3. Looking at the cookies.sqlite file, I see some text right at the top
> "SQLite format 3". Does that mean that I need to use sqlite3?
Yes
>
> I kind of got the above example using pysqlite2.4.1 for python 2.4. I get
> through the part where I create the connection object but the resulting
> object doesn't have a cursor method. I thought that maybe it wasn't
> recognizing the cookies.sqlite file as a SQLite database so I tried the same
> code giving it a junk text file instead and it behaved the same way. Since
> I didn't get an error message, I'm thinking that I've got the wrong version
> for the Firefox cookies.sqlite file.
>
> I don't have a clue as to where else to look to trace it down. I'm hoping
> that someone here is more familiar with it and can give me some pointers.
>
> Thanks,
>
> Joe Goldthwaite
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
-- Guilherme H. Polo Goncalves
More information about the Python-list
mailing list