Bug report #5983

import Qgis-Layer to spatialite db via db Manager and Qspatialite is broken

Added by Gerhard Spieles over 11 years ago. Updated over 11 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:DB Manager
Affected QGIS version:1.8.0 Regression?:No
Operating System:win Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:15398

Description

Import a QGis-Layer in dB manager via drag and drop is broken.
The import via Qspatialite reports the following errors and freeze mouse sandclock :

Fehler bei der Ausführung von Python-Code:

Traceback (most recent call last):
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\importQgis\\importQgis.py", line 64, in run
    if not self.parent.db.uploadQgisVectorLayer(layer, tableName=self.tablenames[i], srid=self.srid, selected=self.selected):
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\Classes\\Database.py", line 253, in uploadQgisVectorLayer
    cursor.execute("""INSERT INTO "%s" VALUES (%s,%s)"""%(tableName,','.join([unicode(value).encode('utf-8') for value in values_auto]),','.join('?'*len(values_perso))),tuple([unicode(value) for value in values_perso]))
OperationalError: no such function: CastToMulti

Python-Version:
2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

QGIS-Version:
1.8.0-Lisboa Lisboa, 6416f38

Python-Pfad: ['C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\\\sextante', 'C:/PROGRA~1/Quantum GIS Lisboa/apps/qgis/./python', 'C:/Dokumente und Einstellungen/gerhard/.qgis//python', 'C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins', 'C:/PROGRA~1/Quantum GIS Lisboa/apps/qgis/./python/plugins', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\bin\\\\python27.zip', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\DLLs', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\lib', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\lib\\\\plat-win', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\lib\\\\lib-tk', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\qgis\\\\bin', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\lib\\\\site-packages', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\PIL', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32\\\\lib', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\Pythonwin', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\wx-2.8-msw-unicode', 'C:\\\\Dokumente und Einstellungen\\\\gerhard\\\\.qgis\\\\python\\\\plugins\\\\mmqgis/forms', '/usr/share/qgis/python', 'C:\\\\PROGRA~1\\\\Quantum GIS Lisboa\\\\apps\\\\qgis\\\\python\\\\plugins\\\\fTools\\\\tools']

import_qgis_layer_in_to_spatialite_db_broken.jpg (492 KB) Gerhard Spieles, 2012-07-09 01:18 PM

import_qgis_layerspatialite_broken_osgeo4w_installation.jpg (383 KB) Gerhard Spieles, 2012-07-10 10:14 AM

dbmanager_statuspanel_postgis_no_module.jpg (492 KB) Gerhard Spieles, 2012-07-10 02:12 PM

dbmaanger_drag_drop_import_broken_spatiallite.jpg (484 KB) Gerhard Spieles, 2012-07-11 10:38 AM

History

#1 Updated by Jürgen Fischer over 11 years ago

pyspatialite in the standalone installer uses and old internal version of spatialite. Please try the OSGeo4W version, which has spatialite 3.0.1.

#2 Updated by Giovanni Manghi over 11 years ago

  • Status changed from Open to Feedback

#3 Updated by Gerhard Spieles over 11 years ago

Installed QGIS 1.8.0.3 and dev from OSGeo4W. Starting QGIS, popup window reports following messages. DBManager window is empty an qspatialite is not available.

Konnte Erweiterung QspatiaLite nicht laden wegen eines Fehler beim Aufruf seiner classFactory()-Methode

Traceback (most recent call last):
  File "C:/OSGeo4W/apps/qgis-dev/./python\\qgis\\utils.py", line 164, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\__init__.py", line 34, in classFactory
    from qspatialite import QspatiaLite
  File "C:/OSGeo4W/apps/qgis-dev/./python\\qgis\\utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\qspatialite.py", line 29, in 
    from QspatiaLiteApp import QspatiaLiteApp
  File "C:/OSGeo4W/apps/qgis-dev/./python\\qgis\\utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\QspatiaLiteApp.py", line 27, in 
    from Classes.Database import *
  File "C:/OSGeo4W/apps/qgis-dev/./python\\qgis\\utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\Classes\\Database.py", line 1, in 
    from pyspatialite import dbapi2 as sqlite #Load PySpatiaLite
  File "C:/OSGeo4W/apps/qgis-dev/./python\\qgis\\utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/OSGeo4W/apps/qgis-dev/./python\\pyspatialite\\dbapi2.py", line 27, in 
  File "C:/OSGeo4W/apps/qgis-dev/./python\\qgis\\utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named _spatialite

Python-Version:
2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

QGIS-Version:
1.9.0-Master Master, cbde7d4

Python-Pfad: ['C:/OSGeo4W/apps/qgis-dev/./python', 'C:/Dokumente und Einstellungen/gerhard/.qgis//python', 'C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins', 'C:/OSGeo4W/apps/qgis-dev/./python/plugins', 'C:\\\\OSGeo4W\\\\bin\\\\python27.zip', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\DLLs', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\plat-win', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\lib-tk', 'C:\\\\OSGeo4W\\\\bin', 'C:\\\\OSGeo4W\\\\apps\\\\Python27', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\PIL', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32\\\\lib', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\Pythonwin', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\wx-2.8-msw-unicode', 'C:\\\\Dokumente und Einstellungen\\\\gerhard\\\\.qgis\\\\python\\\\plugins\\\\mmqgis/forms', '/usr/share/qgis/python']

#4 Updated by Jürgen Fischer over 11 years ago

gespiel - wrote:

Installed QGIS 1.8.0.3 and dev from OSGeo4W. Starting QGIS, popup window reports following messages. DBManager window is empty an qspatialite is not available.

[...]

Hm, looks like you're running qgis-dev and not qgis-1.8.0-3 and a version of qgis-dev that still includes and internal copy of pyspatialite - which the current version doesn't.

#5 Updated by Gerhard Spieles over 11 years ago

QGIS 1.8.0.3 from OSGeo4W produce the same result.

Konnte Erweiterung QspatiaLite nicht laden wegen eines Fehler beim Aufruf seiner classFactory()-Methode

Traceback (most recent call last):
  File "C:/OSGeo4W/apps/qgis/./python\\qgis\\utils.py", line 164, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\__init__.py", line 34, in classFactory
    from qspatialite import QspatiaLite
  File "C:/OSGeo4W/apps/qgis/./python\\qgis\\utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\qspatialite.py", line 29, in 
    from QspatiaLiteApp import QspatiaLiteApp
  File "C:/OSGeo4W/apps/qgis/./python\\qgis\\utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\QspatiaLiteApp.py", line 27, in 
    from Classes.Database import *
  File "C:/OSGeo4W/apps/qgis/./python\\qgis\\utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins\\QspatiaLite\\Classes\\Database.py", line 1, in 
    from pyspatialite import dbapi2 as sqlite #Load PySpatiaLite
  File "C:/OSGeo4W/apps/qgis/./python\\qgis\\utils.py", line 309, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named pyspatialite

Python-Version:
2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

QGIS-Version:
1.8.0-Lisboa Lisboa, 6416f38

Python-Pfad: ['C:/OSGeo4W/apps/qgis/./python', 'C:/Dokumente und Einstellungen/gerhard/.qgis//python', 'C:/Dokumente und Einstellungen/gerhard/.qgis//python/plugins', 'C:/OSGeo4W/apps/qgis/./python/plugins', 'C:\\\\OSGeo4W\\\\bin\\\\python27.zip', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\DLLs', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\plat-win', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\lib-tk', 'C:\\\\OSGeo4W\\\\apps\\\\qgis\\\\bin', 'C:\\\\OSGeo4W\\\\apps\\\\Python27', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\PIL', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32\\\\lib', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\Pythonwin', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\wx-2.8-msw-unicode', 'C:\\\\Dokumente und Einstellungen\\\\gerhard\\\\.qgis\\\\python\\\\plugins\\\\mmqgis/forms', '/usr/share/qgis/python']

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

gespiel - wrote:

QGIS 1.8.0.3 from OSGeo4W produce the same result.

[...]

not quite. It didn't find pyspatialite this time - not the old version. Is the pyspatialite package installed?

#7 Updated by Gerhard Spieles over 11 years ago

Have just updated from OSGeo4W pyspatial 2.3.1-3. Startupmessages dissapear in 1.8.0.3 and import in qspatial works.
Thanks

In db Manager, drag and drop a shp-layer from Qgis to spatiallite is further not possible.
In the status panel, dbmager reports: "postgis: No module named psycopg2" (see attached jpg)

#8 Updated by Jürgen Fischer over 11 years ago

gespiel - wrote:

Have just updated from OSGeo4W pyspatial 2.3.1-3. Startupmessages dissapear in 1.8.0.3 and import in qspatial works.
Thanks

In db Manager, drag and drop a shp-layer from Qgis to spatiallite is further not possible.
In the status panel, dbmager reports: "postgis: No module named psycopg2" (see attached jpg)

retry the upgrade please - pyspatialite and psycopg2 should be a dependency of qgis now (before dbmanager inclusion both were optional and only installed with qgis-full - that's why the standalone installer made from qgis-full has both).

#9 Updated by Giuseppe Sucameli over 11 years ago

In db Manager, drag and drop a shp-layer from Qgis to spatiallite is further not possible.
In the status panel, dbmager reports: "postgis: No module named psycopg2" (see attached jpg)

DBManager should work even if one of psycopg2 or pyspatialite is missing, so the problem you get importing a shape shouldn't depend on the message displayed on the status bar.

A message box with the error should be displayed when the import fails. If so, could you report the error in a new ticket, please?
If instead it works after installing psycopg2, please report here.

#10 Updated by Gerhard Spieles over 11 years ago

have installed the latest osgeo4w package. Postgissymbol appears in db manager and statusbar is clean. (see attached jpg)
Drag and drop shp-layer into spatialite db in dbmanager window is further not possible.
Mousepointer change form to stop-marker, while trying to drop it in db-manager window.

#11 Updated by Giovanni Manghi over 11 years ago

Mousepointer change form to stop-marker, while trying to drop it in db-manager window.

drag and drop muste be done from within the qgis browser, it doesn't work from the TOC. Just to be sure you are doing the right way. Cheers!

#12 Updated by Gerhard Spieles over 11 years ago

  • Resolution set to fixed
  • Status changed from Feedback to Closed

Yes, all works fine. A lot of thanks for your work.

Best regards
Gerhard

Also available in: Atom PDF