Bug report #16720

Pyspatialite in QGIS 3 crash

Added by Hugo Mercier almost 3 years ago. Updated over 2 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Python bindings / sipify
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:24619

Description

To reproduce, in a Python console:

from pyspatialite import dbapi2
conn = dbapi2.connect("")
cur = conn.cursor()
cur.execute("select * from whatever")

Crash report:

h2. User Feedback

h2. Report Details

*Crash ID*: 69b1a2351fc0e2533da4af70098845753375fea9

*Stack Trace*
((unknown module)) _pysqlite_query_execute (unknown file):(unknown line)
(python36) PyCFunction_FastCallDict (unknown file):(unknown line)
(python36) PyObject_GenericGetAttr (unknown file):(unknown line)
(python36) PyEval_EvalFrameDefault (unknown file):(unknown line)
(python36) PyErr_Occurred (unknown file):(unknown line)
(python36) PyEval_EvalCode (unknown file):(unknown line)
(python36) PyDict_SetItemId (unknown file):(unknown line)
(python36) PyDict_SetItemId (unknown file):(unknown line)
(python36) PyCFunction_FastCallDict (unknown file):(unknown line)
(python36) PyObject_GenericGetAttr (unknown file):(unknown line)
(python36) PyEval_EvalFrameDefault (unknown file):(unknown line)
(python36) PyObject_GenericGetAttr (unknown file):(unknown line)
(python36) PyEval_EvalFrameDefault (unknown file):(unknown line)
(python36) PyErr_Occurred (unknown file):(unknown line)
(python36) PyObject_GenericGetAttr (unknown file):(unknown line)
(python36) PyEval_EvalFrameDefault (unknown file):(unknown line)
(python36) PyErr_Occurred (unknown file):(unknown line)
(python36) PyObject_GenericGetAttr (unknown file):(unknown line)
(python36) PyEval_EvalFrameDefault (unknown file):(unknown line)
(python36) PyObject_GenericGetAttr (unknown file):(unknown line)
(python36) PyEval_EvalFrameDefault (unknown file):(unknown line)
(python36) PyObject_GenericGetAttr (unknown file):(unknown line)
(python36) PyEval_EvalFrameDefault (unknown file):(unknown line)
(python36) PyFunction_FastCallDict (unknown file):(unknown line)
(python36) PyObject_CallFunctionObjArgs (unknown file):(unknown line)
(python36) PyObject_Call (unknown file):(unknown line)
((unknown module)) PyInit_sip (unknown file):(unknown line)
((unknown module)) PyInit_Qsci (unknown file):(unknown line)
(Qt5Widgets) QWidget::event (unknown file):(unknown line)
(Qt5Widgets) QFrame::event (unknown file):(unknown line)
(Qt5Widgets) QAbstractScrollArea::event (unknown file):(unknown line)
((unknown module)) PyInit_Qsci (unknown file):(unknown line)
(Qt5Widgets) QApplicationPrivate::notify_helper (unknown file):(unknown line)
(Qt5Widgets) QApplication::notify (unknown file):(unknown line)
((unknown module)) QgsApplication::notify (unknown file):(unknown line)
(Qt5Core) QCoreApplication::notifyInternal2 (unknown file):(unknown line)
(Qt5Widgets) QSizePolicy::QSizePolicy (unknown file):(unknown line)
(Qt5Widgets) QSizePolicy::QSizePolicy (unknown file):(unknown line)
(Qt5Widgets) QApplicationPrivate::notify_helper (unknown file):(unknown line)
(Qt5Widgets) QApplication::notify (unknown file):(unknown line)
((unknown module)) QgsApplication::notify (unknown file):(unknown line)
(Qt5Core) QCoreApplication::notifyInternal2 (unknown file):(unknown line)
((unknown module)) QGuiApplicationPrivate::processKeyEvent (unknown file):(unknown line)
((unknown module)) QWindowSystemInterface::sendWindowSystemEvents (unknown file):(unknown line)
(Qt5Core) QEventDispatcherWin32::processEvents (unknown file):(unknown line)
((unknown module)) CallWindowProcW (unknown file):(unknown line)
((unknown module)) DispatchMessageW (unknown file):(unknown line)
(Qt5Core) QEventDispatcherWin32::processEvents (unknown file):(unknown line)
((unknown module)) qt_plugin_query_metadata (unknown file):(unknown line)
(Qt5Core) QEventLoop::exec (unknown file):(unknown line)
(Qt5Core) QCoreApplication::exec (unknown file):(unknown line)
((unknown module)) main (unknown file):(unknown line)
((unknown module)) WinMain (unknown file):(unknown line)
((unknown module)) __scrt_common_main_seh (unknown file):(unknown line)
((unknown module)) BaseThreadInitThunk (unknown file):(unknown line)
((unknown module)) RtlUserThreadStart (unknown file):(unknown line)

*Plugins*

*Project Info*

*QGIS Info*
QGIS Version: 2.99.0-Master
QGIS code revision: c69c596
Compiled against Qt: 5.7.1
Running against Qt: 5.7.1
Compiled against GDAL: 2.2.0
Running against GDAL: 2.2.0

*System Info*
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 10.0.14393

History

#1 Updated by Giovanni Manghi almost 3 years ago

  • Priority changed from Normal to High

#2 Updated by Hugo Mercier almost 3 years ago

  • Operating System deleted (Windows)
  • Category changed from Windows Package to Python bindings / sipify
  • Assignee deleted (Jürgen Fischer)

Reproduced also on Linux with WITH_INTERNAL_PYSPATIALITE, not specific to Windows

#3 Updated by Jürgen Fischer over 2 years ago

  • Subject changed from Pyspatialite in QGIS 3 crash on Windows to Pyspatialite in QGIS 3 crash

#4 Updated by gcarrillo - over 2 years ago

  • Status changed from Open to Closed

#5 Updated by Andreas Kositz over 2 years ago

gcarrillo - wrote:

This was fixed with the help of Jürgen F.

See 6402160526e3176d1d41f422d6ecab59aa7ac68d, 6415fad07281367ddb628520cb93c9d191fbeaef, and e52378094513a27be87ab837526fa27910ec2c76

Does fixed mean, pyspatialite was removed? How do I access or create SpatiaLite Layer using Python without pySpatialite? Sqlite3 does not provide any functionality.

#6 Updated by Jürgen Fischer over 2 years ago

Andreas Kositz wrote:

Does fixed mean, pyspatialite was removed? How do I access or create SpatiaLite Layer using Python without pySpatialite? Sqlite3 does not provide any functionality.

Yes. Load the extension (see 6402160526e3176d1d41f422d6ecab59aa7ac68d).

#7 Updated by Andreas Kositz over 2 years ago

I am very sorry, but what is meant by "load the extension"?
My old way was:
from pyspatialite import dbapi2 as sqlite
con = sqlite.connect(db_path)

The assumed new way is:
import sqlite3
con = sqlite3.dbapi2.connect(db_path)
con.enable_load_extension(True)
conn.execute("SELECT load_extension('mod_spatialite')")

Which does not work.
Loading any Spatialite-DB in the DB-Manager is also not possible anymore, which seems a little related.

@Jürgen Fischer & gcarillo, thanks for the effort, works now!

#8 Updated by gcarrillo - over 2 years ago

Andreas, see my answer to your question at GIS.SE: https://gis.stackexchange.com/a/260679/4972

Also available in: Atom PDF