I would like to write Python scripts that can load Spatialite across Linux platforms and Spatialite versions. For Spatialite versions lower than 4.2, I can use this:
from pysqlite2 import dbapi2 as sql con = sql.connect("mydb.sqlite") con.enable_load_extension(True) con.execute('SELECT load_extension("libspatialite.so");')
For Spatialite versions >= 4.2, I must change the last line to:
Neither is cross compatible for me. Is there a solution for cross compatibility I am missing? I could invoke
except using both
load_extension commands, but I would prefer a one-line solution. Does one exist?