1

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

asked Apr 10, 2009 at 12:40
2
  • oO Python 2.2.3 was released.. 6 years ago.. Perhaps you could convince your web-host to support 2.5 or 2.6..? Perhaps try #!/usr/bin/env python2.5 as the shbang in the script? Commented Apr 10, 2009 at 13:44
  • If your web host won't upgrade for you, find a new one. wiki.python.org/moin/PythonHosting Commented Nov 4, 2010 at 21:40

4 Answers 4

2

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.

answered Apr 10, 2009 at 13:26
Sign up to request clarification or add additional context in comments.

Comments

1

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.

answered Apr 10, 2009 at 13:21

1 Comment

Damn you, S.Lott! (Beat me by 4 seconds) :P
0

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

answered Apr 11, 2009 at 0:40

Comments

0

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.

answered Nov 1, 2010 at 5:06

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.