id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc 2688,"On Windows, after calling ogr.UseExceptions(), Python crashes when OGR error occurs",jjr8,hobu,"As I understand it, Python programs should be able to call ogr.!UseExceptions() to instruct OGR to raise exceptions on error rather than writing error messages to stderr / stdout stream (I'm not sure which it uses). But on Windows, when you call ogr.!UseExceptions() and then provoke an error, the python.exe process crashes with the ""python.exe has encountered a problem and needs to close"" message. The exception code is 0xC0000005 (access violation). Repro steps: 1. Install Python 2.5.2 to normal location (C:\Python25). 2. Install GDAL for Python, following instructions on http://pypi.python.org/pypi/GDAL: a. Download http://download.osgeo.org/gdal/win32/1.5/gdalwin32exe150.zip and unzip to C:\gdalwin32-1.5 b. Add C:\gdalwin32-1.5\bin to the PATH and set GDAL_DATA to C:\gdalwin32-1.5\data c. Download and run http://peak.telecommunity.com/dist/ez_setup.py d. From a CMD shell, run C:\Python25\Scripts\easy_install gdal. 3. From a CMD shell, run C:\Python25\python.exe and run this: {{{ #!python >>> from osgeo import ogr >>> driver = ogr.GetDriverByName(""ESRI Shapefile"") >>> ds = driver.CreateDataSource(""C:\\Test"") >>> ds.ExecuteSQL('asdf') ERROR 1: SQL: Missing keyword SELECT >>> ogr.UseExceptions() >>> ds.ExecuteSQL('asdf') # This causes python.exe to crash }}} In this example, I provoked an error by specifying invalid syntax to ExecuteSQL(). But the problem is not with the ExecuteSQL() statement specifically. You can provoke errors with different OGR APIs and the same problem will happen: python.exe will crash. The expected result is that a Python exception will be raised. Please advise me if this is not correct. If exceptions are not supposed to be supported on Python, can you say how it is that the program can obtain error messages, short of trying to hijack the stderr stream and capture the output? For GUI applications, the user cannot even see the output streams so the program must be able to provide the error message some other way. Thanks for looking at this. I picked the 1.6.0 milestone for this ticket but I do not presume to know your priorities. Please prioritize appropriately. ",defect,closed,high,1.5.4,PythonBindings,1.5.2,normal,fixed,exceptions,warmerdam