[QGIS-trac] [Quantum GIS] #3433: GEOSException not exposed through
python bindings
Quantum GIS
qgis at qgis.org
Sun Jan 23 20:21:08 EST 2011
#3433: GEOSException not exposed through python bindings
------------------------------------------------+---------------------------
Reporter: rcoup | Owner: borysiasty
Type: enhancement | Status: new
Priority: major: does not work as expected | Milestone:
Component: Python plugins and bindings | Version: 1.6.0
Keywords: geos | Platform_version:
Platform: Debian | Must_fix: No
Status_info: 0 |
------------------------------------------------+---------------------------
If you try and parse some invalid WKT (or do a number of other bad
things), GEOS will throw an error you '''can't catch''' from Python,
causing the interpreter to crash.
{{{
>>> from qgis.core import QgsGeometry
>>> # WKT has a missing ')'
>>> QgsGeometry.fromWkt("POLYGON((0 0, 1 0, 1 1, 0 0)")
terminate called after throwing an instance of 'GEOSException'
Aborted
}}}
ideally a developer should be able to catch it with:
{{{
>>> from qgis.core import QgsGeometry, GEOSException
>>> try:
>>> QgsGeometry.fromWkt("POLYGON((0 0, 1 0, 1 1, 0 0)")
>>> except GEOSException, e:
>>> print "uh oh, WKT error: %s" % e
}}}
--
Ticket URL: <https://trac.osgeo.org/qgis/ticket/3433>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats
More information about the QGIS-trac
mailing list