Hi,
I tried to reproduce
this(https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html) in
windows. How can I do that?
I'm using Windows 10, my project use Pyramid Framework with Python 3.6.8.
Even though I put the dll file in a directory defined in %PATH% or try
with/without full path, with/without file extension, with '//' or '\', with
libspatialite-4.dll or using excute with all combination mentionned before...
dbapi_conn.execute("SELECT load_extension('mod_spatialite.dll')")
For example i tried this kind of combinaison:
def load_spatialite(dbapi_conn, connection_record):
dbapi_conn.load_extension('C:\\mydll\\mod_spatialite.dll') #
dbapi_conn.load_extension('C:\\mydll\\libspatialite-4.dll')
# dbapi_conn.load_extension('mod_spatialite')
# dbapi_conn.load_extension('mod_spatialite.dll')
# dbapi_conn.execute("SELECT load_extension('C:\\mydll\\mod_spatialite.dll')")
# dbapi_conn.execute("SELECT load_extension('mod_spatialite.dll')") #
dbapi_conn.execute("SELECT load_extension('mod_spatialite')") #
dbapi_conn.load_extension('C:/mydll\mod_spatialite.dll')
Can make it work, always getting:
dbapi_conn.load_extension('C:\\mydll\\mod_spatialite.dll')sqlalchemy.exc.OperationalError:
(sqlite3.OperationalError) OsError 0xc1 (193)
(Background on this error at: http://sqlalche.me/e/e3q8)
(
'http://www.google.com/url?qdhttp%3A%2F%2Fsqlalche.me%2Fe%2Fe3q8sadDsntzd1usgdAFQjCNERkh6zEzVSQLk5naEvDfK-IlHbLg';return
true;"
onmousedown="this.href='http://www.google.com/url?qdhttp%3A%2F%2Fsqlalche.me%2Fe%2Fe3q8sadDsntzd1usgdAFQjCNERkh6zEzVSQLk5naEvDfK-IlHbLg';return
true;" style="CURSOR: pointer; TEXT-DECORATION: none; BORDER-TOP: 0px;
BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; COLOR: rgb(102,17,204); PADDING-BOTTOM:
0px; PADDING-TOP: 0px; PADDING-LEFT: 0px; MARGIN: 0px; BORDER-LEFT: 0px;
PADDING-RIGHT: 0px" href="http://sqlalche.me/e/e3q8)" rel=nofollow
target=_blank)
I've been told to use import sqlite3 so I make it a try with this code:
conn = sqlite3.connect(":memory:")
conn.enable_load_extension(True)
conn.load_extension('c:\\mydll\\mod_spatialite') Try too with
'c:/mydll/mod_sptatialite' But I got the same error.
conn.load_extension('c:\\mydll\\mod_spatialite')
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) OsError 0xc1 (193)
(Background on this error at: http://sqlalche.me/e/e3q8)
My directory contain the unzip of:
http://www.gaia-gis.it/gaia-sins/windows-bin-x86/mod_spatialite-4.3.0a-win-x86.7z
The directory is set in %PATH%
Any hint will be appreciated.
Thanks
Michael
--
https://mail.python.org/mailman/listinfo/python-list