Bug report #10917

Python error with QGIS Clip

Added by Randal Hale about 6 years ago. Updated over 3 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Processing/QGIS
Affected QGIS version:master Regression?:
Operating System: Easy fix?:
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:19280

Description

I'm attempting to clip a shapefile of contours by a small study area. This will be a bit long - sorry: On Ubuntu-unstable at 34% complete:
--------------------------------------------------------------------------------------------------------
An error has occured while executing Python code:

Traceback (most recent call last):
File "/usr/share/qgis/python/plugins/fTools/tools/doGeoprocessing.py", line 316, in run
geos, feature, match, error = self.clip()
File "/usr/share/qgis/python/plugins/fTools/tools/doGeoprocessing.py", line 1537, in clip
geom = QgsGeometry( inFeatA.geometry() )
TypeError: arguments did not match any overloaded call:
QgsGeometry(): too many arguments
QgsGeometry(QgsGeometry): argument 1 has unexpected type 'NoneType'

Python version:
2.7.6 (default, Mar 22 2014, 23:03:41)
[GCC 4.8.2]

QGIS version:
2.4.0-Chugiak Chugiak, exported

Python path: ['/usr/share/qgis/python/plugins/processing', '/home/rjhale/.qgis2/python/plugins/opengeo/ext-libs/httplib2-0.8-py2.7.egg', '/home/rjhale/.qgis2/python/plugins/opengeo/ext-libs/requests-2.0.1-py2.7.egg', '/home/rjhale/.qgis2/python/plugins/opengeo/ext-libs/raven-3.5.1-py2.7.egg', '/home/rjhale/.qgis2/python/plugins/opengeo/ext-libs/gsconfig-0.6.6-py2.7.egg', '/home/rjhale/.qgis2/python/plugins/opengeo/ext-libs/gsimporter-0.1-py2.7.egg', '/home/rjhale/.qgis2/python/plugins/opengeo/ext-libs/nose-1.3.0-py2.7.egg', '/home/rjhale/.qgis2/python/plugins/opengeo/ext-libs/nose_html-1.1-py2.7.egg', '/home/rjhale/.qgis2/python/plugins/opengeo/ext-libs/coverage-3.7-py2.7-win32.egg', '/usr/share/qgis/python', u'/home/rjhale/.qgis2/python', u'/home/rjhale/.qgis2/python/plugins', '/usr/share/qgis/python/plugins', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', '/home/rjhale/.qgis2/python/plugins/opengeo/ext-libs', '/home/rjhale/.qgis2/python/plugins/DigitizingTools/tools', '/home/rjhale/.qgis2/python/plugins/MetaSearch/ext-libs', '/usr/share/qgis/python/plugins/fTools/tools']
------------------------------------------------------------------------------------------

on windows at 35%:
-------------------------------------------------------------------------------------------------
An error has occured while executing Python code:

Traceback (most recent call last):
File "C:\\OSGEO4~1\\apps\\qgis\\python\\plugins\\fTools\\tools\\doGeoprocessing.py", line 316, in run
geos, feature, match, error = self.clip()
File "C:\\OSGEO4~1\\apps\\qgis\\python\\plugins\\fTools\\tools\\doGeoprocessing.py", line 1537, in clip
geom = QgsGeometry( inFeatA.geometry() )
TypeError: arguments did not match any overloaded call:
QgsGeometry(): too many arguments
QgsGeometry(QgsGeometry): argument 1 has unexpected type 'NoneType'

Python version:
2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]

QGIS version:
2.4.0-Chugiak Chugiak, 8fdd08a

Python path: ['C:/OSGEO4~1/apps/qgis/./python/plugins\\\\processing', 'C:/OSGEO4~1/apps/qgis/./python', u'C:/Users/rjhale/.qgis2/python', u'C:/Users/rjhale/.qgis2/python/plugins', 'C:/OSGEO4~1/apps/qgis/./python/plugins', 'C:\\\\OSGEO4~1\\\\bin\\\\python27.zip', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\DLLs', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\plat-win', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\lib-tk', 'C:\\\\OSGEO4~1\\\\bin', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\PIL', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\jinja2-2.7.2-py2.7.egg', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\markupsafe-0.23-py2.7-win-amd64.egg', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\pytz-2012j-py2.7.egg', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32\\\\lib', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\Pythonwin', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\Shapely-1.2.18-py2.7-win-amd64.egg', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\six-1.3.0-py2.7.egg', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\wx-2.8-msw-unicode', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\xlrd-0.9.2-py2.7.egg', 'C:\\\\OSGEO4~1\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\xlwt-0.7.5-py2.7.egg', 'C:\\\\OSGEO4~1\\\\apps\\\\qgis\\\\python\\\\plugins\\\\fTools\\\\tools']

History

#1 Updated by Giovanni Manghi about 6 years ago

  • Subject changed from Bug with Geoprocessing Clip on Ubuntu 1404 and OSGEO4w 64bit to Python error with QGIS Clip
  • Affected QGIS version changed from 2.4.0 to master
  • OS version deleted (Windows 7 OSGEO4W 64 bit)
  • Operating System deleted (Ubuntu 14.04 Windows 7)
  • Category changed from GDAL Tools to 44

Sample data is here

https://drive.google.com/folderview?id=0B8WLtz606XDdOTNkN0xhenVCX0k&usp=sharing

The error is confirmed as well in the same tool in the Processing Toolbox. The equivalent tool in SAGA (always in Processing) also fails with a "corrupted shapefile" error.

This made me think, so before running the clip operation (in the Processing toolbox) I made a select by location with the clip polygon, then clipped. This way it works. So it seems there is some geometry that created issues to the clipping tool, not only QGIS one.

I would be nice to catch the error and throw a better error message.

Anyway using GRASS v.overlay (always in the procssing toolbox) works without issue, even without making the selection beforehand.

#2 Updated by Giovanni Manghi about 6 years ago

This made me think, so before running the clip operation (in the Processing toolbox) I made a select by location with the clip polygon, then clipped. This way it works. So it seems there is some geometry that created issues to the clipping tool, not only QGIS one.

PS
because in the Processing toolbox there is the option (by default) to make the tools work using just the selected features.

#3 Updated by Alexander Bruy over 4 years ago

  • Status changed from Open to Feedback

Test data not available anymore. Can you upload them somewhere?

#4 Updated by Alexander Bruy over 4 years ago

Shold be fixed in master. Please check

#5 Updated by Randal Hale over 4 years ago

  • Status changed from Feedback to Closed

#6 Updated by Giovanni Manghi over 3 years ago

The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.

Also available in: Atom PDF