469,616 Members | 1,792 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,616 developers. It's quick & easy.

SQLite and Python 2.4

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.

2. If sqlite3 is only for Python 2.5, does sqlite2 work the same way?

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?

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

Jul 2 '08 #1
2 3655
Hi Joe!

Am Tue, 01 Jul 2008 17:51:35 -0700 schrieb Joe Goldthwaite:
I'm confused. (Not a new experience).
Everyone looking for help in the usenet asking for help is sharing your
disease.
I've got a web application
running under Zope. I use the Wing IDE for testing and debugging.
Okay, you use the best development tool I've spotted so far...
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.
Which is quite handssome :-)
I haven't worked with
SQLite at all so I started searching for examples and found this;

import sqlite3 <<-- This works only if you're using Python >=2.5.x
1. How do you get sqlite3 for Python 2.4? I can't find it anywhere.
Never ever. Use http://www.pysqlite.org instead.
2. If sqlite3 is only for Python 2.5, does sqlite2 work the same way?
Think so. Never spotted problems.
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?
No, not really.
But if I may make a suggestion, before you start spinning your brain off
with SQL syntax, analyze the database setup of firefox3 a bit and take a
look at SQLalchemy. I use it a lot and I bet you will like it - you just
have to care about your objects (in your case cookie checking) not about
the SQL at all.
I like it :-)

Regards,
Steffen
Jul 4 '08 #2
There is an "SQLite Manager" add-on for Firefox which is pretty neat.
Have a look at
https://addons.mozilla.org/en-US/fir...sqlite&cat=all. Might
be useful to you!

Tim

Steffen Mutter wrote:
Hi Joe!

Am Tue, 01 Jul 2008 17:51:35 -0700 schrieb Joe Goldthwaite:

>I'm confused. (Not a new experience).

Everyone looking for help in the usenet asking for help is sharing your
disease.

> I've got a web application
running under Zope. I use the Wing IDE for testing and debugging.

Okay, you use the best development tool I've spotted so far...

> 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.

Which is quite handssome :-)

> I haven't worked with
SQLite at all so I started searching for examples and found this;

import sqlite3 <<-- This works only if you're using Python >=2.5.x

>1. How do you get sqlite3 for Python 2.4? I can't find it anywhere.

Never ever. Use http://www.pysqlite.org instead.

>2. If sqlite3 is only for Python 2.5, does sqlite2 work the same way?

Think so. Never spotted problems.

>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?

No, not really.
But if I may make a suggestion, before you start spinning your brain off
with SQL syntax, analyze the database setup of firefox3 a bit and take a
look at SQLalchemy. I use it a lot and I bet you will like it - you just
have to care about your objects (in your case cookie checking) not about
the SQL at all.
I like it :-)

Regards,
Steffen
--
http://mail.python.org/mailman/listinfo/python-list

Jul 7 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by John Salerno | last post: by
14 posts views Thread by 7stud | last post: by
3 posts views Thread by ricardo.turpino | last post: by
1 post views Thread by mikhail.savitsky | last post: by
3 posts views Thread by kyosohma | last post: by
reply views Thread by Guilherme Polo | last post: by
reply views Thread by Joe Goldthwaite | last post: by
20 posts views Thread by timotoole | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.