ImportError with CGI
"H 121" <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
First of all thanks for a great piece of software :) I've used it in several
small projects and it's wonderful, but now I'm having some problems trying
to use it from a cgi script.
This is probably a configuration problem (on Apache?) but since I ran into
it with pysqlite I'm asking here :)
First of all, my environment is a bit weird because I don't have root
privileges to the Linux box I'm trying to run my cgi on. I've compiled both
sqlite3 and pysqlite2 and they are installed under my home directory.
Everything should be in order, though.
My test script that duplicates my problem looks like this:
#!/usr/bin/env python
print "Content-type: text/html\n\n<html><body><pre>"
import sys, os
sys.path.append('/my/home/dir/python24')
os.environ['LD_LIBRARY_PATH']='/my/home/dir/sqlite3/lib'
from pysqlite2 import test
test.test()
print "</pre></body></html>"
As you can see I'm telling Python where the sqlite3 libs live by setting
LD_LIBRARY_PATH. If I run this script in a shell I get more or less what I
expect:
Content-type: text/html
<html><body><pre>
................................................................................................................................................................................E
======================================================================
ERROR: CheckUsefulErrorMessage (pysqlite2.test.regression.RegressionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "my/home/dir/python24/pysqlite2/test/regression.py", line 105, in
CheckUsefulErrorMessage
if e.message != "cannot start a transaction within a transaction":
AttributeError: OperationalError instance has no attribute 'message'
----------------------------------------------------------------------
Ran 177 tests in 0.881s
FAILED (errors=1)
</pre></body></html>
Everything seems to work, though I'm not sure what that AttributeError is
about.
The script lives in my cgi-bin/ dir which contains other cgi scripts which
work fine. When I try to access the test script with a browser I get a blank
screen and the following in apache's error_log:
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] Traceback (most recent
call last):
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] File "foo.cgi", line
12, in ?
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] from pysqlite2
import test
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] File
"/my/home/dir/python24/pysqlite2/test/__init__.py", line 35, in ?
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] from
pysqlite2.testimport dbapi, types, userfunctions, factory,
transactions,\\
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] File
"/my/home/dir/python24/pysqlite2/test/dbapi.py", line 26, in ?
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] import
pysqlite2.dbapi2 as sqlite
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] File
"/my/home/dir/python24/pysqlite2/dbapi2.py", line 27, in ?
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] from
pysqlite2._sqlite import *
[Wed Jul 04 12:24:38 2007] [error] [client 1.2.3.4] ImportError:
libsqlite3.so.0: cannot open shared object file: No such file or directory
I'm at loss here since the LD_LIBRARY_PATH variable doesn't seem to help it
see the libs under my home dir. Is this a permissions problem? the sqlite3/
dir and the lib/ dir under it are both a+rx. Or do I need to talk my
administrator about Apache?
_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/pysqlite