Hi All,
i'm running python 2.5.1 on a mac osx 10.5.6 (the system pyrhon)
i've problems to enable spatialite extension [1]
in python using pysqlite2
maybe there are problems to enable the support for the dyn-extensions
but i have no clue on how to fix it;
i downloaded the sources for pysqlite2 from :
https://launchpad.net/ubuntu/jaunty/+source/python-pysqlite2/2.5.0-2ubuntu1/+files/python-pysqlite2_2.5.0.orig.tar.gz
Unlucky on OSX, the pysqlite don't recognize the sqlite spatial
extension :
these is the build log :
http://www.geofemengineering.it/data/pysqlite_build_log.txt.zip
tring it in python it don't works :
macbook-pro-15-di-sasha:pysqlite-2.5.0 sasha$ python
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pysqlite2 import dbapi2 as sqlite
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pysqlite2/dbapi2.py", line 27, in <module>
from pysqlite2._sqlite import *
ImportError: No module named _sqlite
>>>
while on linux i can symply do :
in the pysqlite source:
> python setup.py build
> sudo python setup.py install
and test it on a spatialite database [2]
downloaded from the spatialite sites test files:
i create a file :
test.py:
-------------
from pysqlite2 import dbapi2 as sqlite
DB = sqlite.connect('./test-2.3.sqlite');
DB.enable_load_extension(True);
DB.execute('SELECT load_extension("libspatialite.so")');
DBCursor = DB.cursor()
strSQL = 'SELECT Name, GeometryType(geometry), area(geometry) ';
strSQL += 'FROM regions ORDER BY Area(geometry) DESC';
DBCursor.execute( strSQL );
for row in DBCursor:
print( row[0] + ' ' + row[1] + ' ' + str(row[2])
DBCursor.close();
DB.close();
---------------
running it :
> python test.py
------------------
SICILIA MULTIPOLYGON 26074081211.3
PIEMONTE MULTIPOLYGON 25391974998.1
SARDEGNA MULTIPOLYGON 24125601024.3
LOMBARDIA MULTIPOLYGON 24069782849.5
TOSCANA MULTIPOLYGON 22971611856.6
EMILIA-ROMAGNA MULTIPOLYGON 22112626674.3
PUGLIA MULTIPOLYGON 19535533607.9
VENETO MULTIPOLYGON 18091146695.8
LAZIO MULTIPOLYGON 17075567463.4
CALABRIA MULTIPOLYGON 15357477642.6
CAMPANIA MULTIPOLYGON 13671884537.6
TRENTINO-ALTO ADIGE MULTIPOLYGON 13636192197.0
ABRUZZI MULTIPOLYGON 10921890033.0
BASILICATA MULTIPOLYGON 10082620411.6
MARCHE MULTIPOLYGON 9801006025.43
UMBRIA MULTIPOLYGON 8511757763.65
FRIULI-VENEZIA GIULIA MULTIPOLYGON 7571067911.64
LIGURIA MULTIPOLYGON 5451586208.43
MOLISE MULTIPOLYGON 4534700124.13
VALLE D'AOSTA MULTIPOLYGON 3309252833.27
SAN MARINO MULTIPOLYGON 60108921.7828
------------------
it works ....
[1] - http://www.gaia-gis.it/spatialite/index.html
[2] - test-2.3.7z
have you any suggestion on what i need to get it working on osx too ?
thanks a lot for any help!
Massimo Di Stefano
massimodisa...@yahoo.it
epifanio on irc.freenode.net /join gfoss
Massimo Di Stefano
massimodisa...@yahoo.it
epifanio on irc.freenode.net /join gfoss
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig