[GRASS-user] Handling exceptions with Python

kungphil phil.wilkes at dse.vic.gov.au
Tue Oct 4 20:54:49 EDT 2011


Hi

I am fairly new to both Python and Grass...

I am trying to catch exceptions thrown up by GRASS using try/except but
can't seem to get it working!

For example

try:
grass.run_command('v.in.ogr', dsn=sLayer, output=sLayerName, quiet=True)
except:
...

With the above I am trying to load a vector layer with the wrong projection,
the error prints to screen and then continues with the rest of the script
when I want to catch the error, log it and then exit.  I have looked at the
error def here http://grass.osgeo.org/programming7/core_8py_source.html but
can't make sense of it!

Any help greatly appreciated.

Regards, Phil 

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Handling-exceptions-with-Python-tp6860620p6860620.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list