Created attachment 864823 [details] Bourne shell script to reproduce, demonstrate the problem Description of problem: The Python sqlite3 module does not allow the loading of SQLite extension libraries. Version-Release number of selected component (if applicable): python-2.7.5 (and also python3-3.3.2), and all previous releases of this How reproducible: 100% reproducible Steps to Reproduce: See the attached Bourne shell script; test_script.sh Actual results: AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension' Expected results: The loading of extensions is a core feature of SQLite, and should be enabled, (e.g. for using things like libspatialite) Additional info: This problem has been reported on Bugzilla before, but probably was not routed to the correct person, see; https://bugzilla.redhat.com/show_bug.cgi?id=814905 The upstream documentation from python.org for the sqlite3 module states that the loading of extensions is disabled by default in the source tarball. See the footnote[1] at the very end of the page for more detail; http://docs.python.org/2/library/sqlite3.html There should not be any issues with allowing extensions on Linux. Note that loading of extensions is enabled in the stand alone sqlite3 application (using the ".load" command). This is a separate package sqlite-3.7.11, which builds a separate SQLite library. The fix for this is straight forward. When building the Python RPM, the line in the setup.py script that sets SQLITE_OMIT_LOAD_EXTENSION should be commented out. The following patch does the trick; --- Python-2.7.5/setup.py.orig 2013-05-11 20:32:54.000000000 -0700 +++ Python-2.7.5/setup.py 2014-02-18 14:16:07.999004901 -0800 @@ -1168,7 +1168,7 @@ class PyBuildExt(build_ext): sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"')) # Comment this out if you want the sqlite3 module to be able to load extensions. - sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1")) + #sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1")) if host_platform == 'darwin': # In every directory on the search path search for a dynamic
Created attachment 864825 [details] Proposed patch for the Python SRPM
Seems reasonable and it's an easyfix, will do. AFAICS there is a configuration option for this in Python 3, so I'll enable it there too - not with patch, but using that option. Thanks for the report.
python-2.7.5-11.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/python-2.7.5-11.fc20
Package python-2.7.5-11.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing python-2.7.5-11.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-2796/python-2.7.5-11.fc20 then log in and leave karma (feedback).
Created attachment 866746 [details] Update to original test script, to more throughly test the fix. The fix worked as expected for me. I am now able to load extension libraries from the sqlite3 module. (Positive Karma left on Bohdi). I have attached an update to the test script I originally posted to demo the problem that enables loading of extensions, and then loads the SpatiaLite extension library (/usr/lib64/libspatialite.so). You must have the libspatialite-devel RPM installed.
python-2.7.5-11.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.
*** Bug 814905 has been marked as a duplicate of this bug. ***