As explained in this post, I've been attempting to use the web2py database abstraction layer's SpatiaLite adapter, and I'm receiving a "RuntimeError: Failure to connect, tried 5 times" message.
I've installed the SpatiaLite DLLs into Windows' /System32 folder, and I'm able to do the following:
import sqlite3
conn = sqlite3.connect(":memory:")
conn.enable_load_extension(True)
conn.execute('SELECT load_extension("libspatialite-2.dll")')
SpatiaLite version ..: 2.2 Supported Extensions:
- 'VirtualShape' [direct Shapefile access]
- 'VirtualText' [direct CSV/TXT access]
- 'RTree' [Spatial Index - R*Tree]
- 'MbrCache' [Spatial Index - MBR cache]
- 'SpatiaLite' [Spatial SQL - OGC]
PROJ.4 Rel. 4.6.1, 21 August 2008
GEOS version 3.0.0-CAPI-1.4.1
<sqlite3.Cursor object at 0x0202B360>
So it appears that my python installation can use SpatiaLite. However, the presence of the SpatiaLite DLLs doesn't seem to resolve the web2py "Failure to connect" error. Any suggestions on how to get SpatiaLite working with web2py?
On Windows, it looks like you have to rename the DLL to libspatialite.dll
.