views:

414

answers:

4

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

+1  A: 

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.

S.Lott
Damn you, S.Lott! (Beat me by 4 seconds) :P
Charles Duffy
+2  A: 

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.

Aaron Digulla
A: 

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

Eric Holk