finding a module

Giorgi Lekishvili gleki at gol.ge
Fri Jan 25 18:54:54 EST 2002


Kevin Dahlhausen wrote:

> I'm having a little trouble finding a c extension.  Here's the
> situation:
>
> I have a web host that allows python cgi.  I've also written a wrapper
> for a library.  The wrapper is a subdirectory with an __init__.py
> file.  In the same subdirectory is a swig-generated c wrapper (
> sqlitec.so ) that is imported by one of the files imported by
> __init__.py.  The main web application sits in the directory above the
> module directory:
>
>   .....\webapp\main.cgi               (imports sqlitedb)
>   .....\webapp\sqlitedb\__init__.py   (imports wrapper)
>   .....\webapp\sqlitedb\wrapper.py    (imports sqlitec)
>   .....\webapp\sqlitedb\sqlitec.so
>
> The code on 'main.cgi' contains an import: 'import sqlitedb'.
> Python finds the sqlitedb python files, but can not find sqlitec.so.
> They are runing Python 1.6.

The SWIG generated module MUST be called sqlitemodule.so... Note the
difference.
Try this..
GRTZ,
Giorgi

>
>
> How can I allow Python to see the loadable module?   It is
> possible/common for the web providers to disallow import of native
> code modules?
>
> I've tried adding the following to main.cgi:
>
>   import sys
>   sys.path.append(".")
>   sys.path.append("./sqlitedb")
>
>   import sqlitedb
>
> but that did did not fix anything.
>
> Any ideas?
>
> If this works, we would be very close to having thread-safe
> python-based web sites w/an sql database but without an sql server.
> (Sqlite is a file-based database similar to gadfly).




More information about the Python-list mailing list