Mike
Mike

Reputation:

SQLite in Python 2.2.3

I've written a web-app in python using SQLite and it runs fine on my server at home (with apache and python 2.5.2). I'm now trying to upload it to my web host and there servers use python 2.2.3 without SQLite.
Anyone know of a way to use SQLite in python 2.2.3 e.g. a module that I can upload and import? I've tried butchering the module from newer versions of python, but they don't seem to be compatible.
Thanks,
Mike

Upvotes: 1

Views: 1040

Answers (4)

Roger Binns
Roger Binns

Reputation: 3348

In case anyone comes across this question, the reason why neither pysqlite nor APSW are available for Python 2.2 is because Python 2.3 added the simplified GIL API. Prior to Python 2.3 it required a lot of code to keep track of the GIL. (The GIL is the lock used by Python to ensure correct behaviour while multi-threading.)

Doing a backport to 2.2 would require ripping out all the threading code. Trying to make it also be thread safe under 2.2 would be a nightmare. There was a reason they introduced the simplified GIL API!

I am still astonished at just how popular older Python versions are. APSW for Python 2.3 is still regularly downloaded.

Upvotes: 0

Eric Holk
Eric Holk

Reputation: 1386

If you have shell access to your web server, you can probably build you're own version of Python and SQLite. This will let you use the latest version. Download the source code, then when you configure it, do something like "./configure --prefix=$HOME/packages".

Next, fiddle around with your .profile, or .bashrc or whatever it is to make sure $HOME/packages/bin comes first in your path. This will cause your private Python to override the one installed by your web server.

This page might give you a little more information for how to do this on a server like Dreamhost: http://wiki.dreamhost.com/Python

Upvotes: 0

Aaron Digulla
Aaron Digulla

Reputation: 328724

There is no out-of-the-box solution; you either have to backport the SQLlite module from Python 2.5 to Python 2.2 or ask your web hoster to upgrade to the latest Python version.

Python 2.2 is really ancient! At least for security reasons, they should upgrade (no more security fixes for 2.2 since May 30, 2003!).

Note that you can install several versions of Python in parallel. Just make sure you use "/usr/bin/python25" instead of "/usr/bin/python" in your scripts. To make sure all the old stuff is still working, after installing Python 2.5, you just have to fix the two symbolic links "/usr/bin/python" and "/usr/lib/python" which should now point to 2.5. Bend them back to 2.2 and you're good.

Upvotes: 2

S.Lott
S.Lott

Reputation: 391952

Look here: http://oss.itsystementwicklung.de/download/pysqlite/

From the release notes (http://oss.itsystementwicklung.de/trac/pysqlite/browser/doc/install-source.txt)

  1. Python: Python 2.3 or later

You may not be able to do what you're trying to do.

Upvotes: 1

Related Questions