load extension spatialite in windows

242 views
Skip to first unread message

Michael Lane

unread,
Jul 10, 2019, 10:39:04 AM7/10/19
to sqlalchemy
Try to reproduce this in windows. How to do that?



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:\\Scripts\\mod_spatialite.dll')
    # dbapi_conn.load_extension('C:\\Scripts\\libspatialite-4.dll')
# dbapi_conn.load_extension('mod_spatialite')
# dbapi_conn.load_extension('mod_spatialite.dll')
# dbapi_conn.execute("SELECT load_extension('C:\\pyramid\\risc\\api\\Scripts\\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:/Scripts\mod_spatialite.dll')



Can make it work, always getting:

dbapi_conn.load_extension('C:\\Scripts\\mod_spatialite.dll')
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) OsError 0xc1 (193)
(Background on this error at: http://sqlalche.me/e/e3q8)

Any hint will be appreciated.

Thanks

Mike Bayer

unread,
Jul 10, 2019, 10:58:27 AM7/10/19
to noreply-spamdigest via sqlalchemy
I have no information on that, this has to do with the sqlite3 module included with Python:

import sqlite3

conn = sqlite3.connect(":memory:")
conn.load_extension("c:\\path\\to\\dll")

Use cPython resources to get help and use the above code as what you're trying to get to work:

--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.
To post to this group, send email to sqlal...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Lane

unread,
Jul 10, 2019, 12:12:41 PM7/10/19
to sqlalchemy
I tried all combination for path with your exemple and always got the same error message:

    conn.load_extension('c:\\mydll\\mod_spatialite')
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) OsError 0xc1 (193)


conn = sqlite3.connect(":memory:")
conn.enable_load_extension(True)
conn.load_extension('c:\\mydll\\mod_spatialite')

If I don't add enable_load_extension, i got a "not authorized" message instead of the previous error.

Sorry for my ignorance but I don't understand what you tell me to do with cPython.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlal...@googlegroups.com.

Mike Bayer

unread,
Jul 10, 2019, 12:18:39 PM7/10/19
to noreply-spamdigest via sqlalchemy


On Wed, Jul 10, 2019, at 12:12 PM, Michael Lane wrote:
I tried all combination for path with your exemple and always got the same error message:

    conn.load_extension('c:\\mydll\\mod_spatialite')
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) OsError 0xc1 (193)


conn = sqlite3.connect(":memory:")
conn.enable_load_extension(True)
conn.load_extension('c:\\mydll\\mod_spatialite')

If I don't add enable_load_extension, i got a "not authorized" message instead of the previous error.

Sorry for my ignorance but I don't understand what you tell me to do with cPython.


Subscribe to this mailing list:


then ask them there about this error you get when you use sqlite3 directly.




To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.
To post to this group, send email to sqlal...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages