New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix python3 pyspatialite import #3534
Conversation
Hi @dmarteau |
Hi @mhugo, Actually, this is going to be a problem on OSX: the default implementation for python module sqlite does not enable load_extension: mac users will have to use a patched versions of python sqlite which is a core module: I don't know about homebrew but Macport currently adopt the OSX way - and I hope that is going to be fixed soon: https://trac.macports.org/ticket/49317. David |
Ok, so on OSX with your patch and the compilation flag WITH_PYSPATIALITE, pyspatialite should now be usable in Python 3 ? Cool. |
Actually, this is really a pain to install pyspatialite on OSX because the official pyspatialite module is totally deprecated and the right way is to use load_extension from python (which is deactivated on OSX - it does not even compile). The actual QGIS implementation is 'de facto' the only way to use pyspatialite on OSX without patching python. |
@@ -329,7 +329,11 @@ static struct PyModuleDef _sqlite3module = { | |||
}; | |||
#endif | |||
|
|||
#if PY_MAJOR_VERSION < 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason to check that, we no longer need to support python 2 on master
This was a missing bit of 6e4e845. |
pyspatialite is broken under python 3.5+:
buffer()
is removed in python3 in favor ofmemoryview
- see https://docs.python.org/2/c-api/buffer.html.memoryview
works in 2.7 and support the object implementing buffer protocol. I did not see any explicit reference tobuffer()
in the qgis (buffer
is aliased asBinary
indbapi2.py
) but I cannot speak for plugins.