[mod_python] Problems w/ sqlite3

Graham Dumpleton graham.dumpleton at gmail.com
Thu Dec 18 06:20:08 EST 2008


2008/12/18 Pawel Oleksik <oleksik at awa.mat.agh.edu.pl>:
> On Thu, Dec 18, 2008 at 09:10:54PM +1100, Graham Dumpleton wrote:
>> Did you try disabling PHP altogether and then see if your code worked?
>> This would eliminate PHP still causing a conflict.
>
> You are absolutely right, I should be more thorough.
> After commenting out the line that loads php (and restarting server) there is
> still the problem. So indeed it seems to not be a conflict w/ php.
>
>> And how do you know it is not a permissions problem? Apache/mod_python
>> runs as special user and SQLite has a requirement that both the
> I read about this problem, so for test time set rights to 777 (for directory)
> and 555 (for file).  (No danger at this moment: the server is not connected to
> world.) Owner of parent directory and file is now apache:apache.
> All up-to-root path is readable and searchable.
>
>> So, how about actually posting what the error tracebacks are you are
>> getting so can see what actual problem is rather than what you think
>> it is.
>>
>> Graham
>
> OK. Full log is quite long, so I'm pasting the most important lines.
>
> Script output:
>
> sqlite version: 2.3.2
> sqlite3 version: 3.6.6.2
> /usr/lib/python2.5/sqlite3/__init__.pyc
> user: 80, GID: 80
> groups: [80]
> effective:
>    EUID:80 EGID: 80
>
> Test:
>
> ## here is an exception and below its traceback (partial):
>
> MOD_PYTHON ERROR
>
> ServerName:     '127.0.0.1'
> DocumentRoot:   '/srv/httpd/htdocs'
> URI:            '/py-test/one.py'
> Location:       None
> Directory:      '/home/ftp/py-test/'
> Filename:       '/home/ftp/py-test/one.py'
> PathInfo:       ''
> Phase:          'PythonHandler'
> Handler:        'one'
>
> Traceback (most recent call last):
>  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537 ..
>  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229 ..
>  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128 ..
>
>  File "/home/ftp/py-test/one.py", line 16, in handler
>    request.write( open_db() )
>
>  File "/home/ftp/py-test/one.py", line 48, in open_db
>    conn = sqlite3.connect('/home/ftp/DB/db_test')
>
> SystemError: NULL result without error in PyObject_Call

Did you check other Apache modules for dependencies like originally suggested.

http://www.mail-archive.com/[email protected]/msg34866.html

In particular, are you loading mod_mem_cache?

There is lots of other discussion around about this error as well and
other reasons it could occur as well. How many of them have you looked
at?

One thing to make sure you do, do a full stop of Apache and not just a
restart/reload. If the latter is done it can in some circumstances not
unloaded libraries properly and class may still exist.

Graham


More information about the Mod_python mailing list