[Pythonmac-SIG] [pysqlite] sqlite and python

massimo di stefano massimodisasha at yahoo.it
Thu Mar 26 00:24:40 CET 2009


Yes that's true, i've notice that the load extension module is enabled  
by default int sqlite version >= 3.3.6
osx leopard come with sqlite3 included in the system, but i'm not  
using it i'm using a customized version of sqlite
that is avaiable here :


http://www.kyngchaos.com/files/software/unixport/

download to the .dmg framework :

http://www.kyngchaos.com/files/software/unixport/SQLite3_Framework-3.6.11-2.dmg

Note :
Includes the FTS3 search, ICU unicode, R-Tree indexing and Spatialite  
extensions, and Proxy Locking, Column Metadata and Memory Management  
features are enabled.



if i type in a terminal :

sqlite3 -version

i've :

macbook-pro-15-di-sasha:~ sasha$ sqlite3 -version
3.6.10


that is the framework version infact,
which sqlite give me  :

macbook-pro-15-di-sasha:~ sasha$ which sqlite3
/Library/Frameworks/SQLite3.framework/Programs/sqlite3

while :

locate sqlite3 give me the path to the system sqlite3 :

....
/usr/bin/sqlite3
/usr/include/sqlite3.h
/usr/include/sqlite3ext.h
/usr/lib/libsqlite3.0.8.6.dylib
/usr/lib/libsqlite3.0.dylib
/usr/lib/libsqlite3.dylib
/usr/lib/sqlite3
/usr/lib/sqlite3/libtclsqlite3.dylib
/usr/lib/sqlite3/pkgIndex.tcl
....

if i try to ask the version to the system sqlite3 i've :

macbook-pro-15-di-sasha:~ sasha$ /usr/bin/sqlite3 -version
3.4.0

it is under version -  3.3.6
so it has the "load_extension" limitation


so my opinion is that pysqlite detect the system version that is not  
able to load the extension,
maybe a solution is to force pysqlite2 to use the right version ()


... how can i force pysqlite to do it ?
can i modify something in the source ?

maybe in setup.cfg ???
the default setup.cfg is :

[build_ext]
#define=
#include_dirs=/usr/local/include
#library_dirs=/usr/local/lib
libraries=sqlite3
define=SQLITE_OMIT_LOAD_EXTENSION


can i change it to :

[build_ext]
#define=
include_dirs=/Library/Frameworks/SQLite3.framework/Versions/3/Headers/
library_dirs=//Library/Frameworks/SQLite3.framework/Versions/3/unix/lib
libraries=sqlite3
#define=SQLITE_OMIT_LOAD_EXTENSION




thanks for any suggestion

ciao,

Massimo

Il giorno 25/mar/09, alle ore 21:56, Ned Deily ha scritto:

> In article <2D7D319E-094D-4D0E-8DD9-9AD51056A003 at yahoo.it>,
> massimo di stefano <massimodisasha at yahoo.it>
> wrote:
>> i followed that way too,
>>
>> i downloaded the bynary version for pysqlite osx intel
>> i copied all the files under :
>>
>> /Users/Shared/source/spatialite/
>>                                                         |
>>                                                        bin/
>>                                                         |
>>                                                         lib/
>>                                                         |
>>                                                        include/
>>
>>
>>
>>
>> in my .bash_profile i added :
>>
>> LD_LIBRARY_PATH=/Users/Shared/source/spatialite/lib
>> export LD_LIBRARY_PATH
>>
>>
>> then i removed and reinstalled pysqlite :
>>
>> sudo rm -rf /Library/Python/2.5/site-packages/pysqlite2 /Library/
>> Python/2.5/site-packages/pysqlite-2.5.0-py2.5.egg-info
>>
>> quit terminal.app and open a new one,
>> rebuild pysqlite, these the log :
>>
>> http://www.geofemengineering.it/pysqlite_osx_log_2.txt
>>
>> then in python :
>>
>>
>>>>> from pysqlite2 import dbapi2 as sqlite
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "/Library/Python/2.5/site-packages/pysqlite2/dbapi2.py", line
>> 27, in <module>
>>     from pysqlite2._sqlite import *
>> ImportError: dlopen(/Library/Python/2.5/site-packages/pysqlite2/
>> _sqlite.so, 2): Symbol not found: _sqlite3_enable_load_extension
>>   Referenced from: /Library/Python/2.5/site-packages/pysqlite2/
>> _sqlite.so
>>   Expected in: dynamic lookup
>
> Ah, I see.  As far as I know, pysqlite2 is just the python wrapper  
> to a
> sqlite3 library, it doesn't include sqlite3 itself.  Note, the  
> cavaet in
> the spatialite install instructions:
>
> "the sqlite3 of standard distribution [10.5] doesn't supports the
> dynamic extension loading mechanism"
>
> So I think you'll need to download the sqlite3 (amalgamation?) source
> and build your own version along with pysqlite2.  Hopefully, someone
> with more experience with sqlite3 can give a definitive answer.
>
> Good luck!
>
> -- 
> Ned Deily,
> nad at acm.org
>
> _______________________________________________
> list-pysqlite mailing list
> list-pysqlite at lists.itsystementwicklung.de
> http://itsystementwicklung.de/cgi-bin/mailman/listinfo/list-pysqlite

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 



More information about the Pythonmac-SIG mailing list