Opened 2 years ago

Closed 2 years ago

#6075 closed defect (fixed)

gdal.OpenEx() ignores gdal.UseExceptions()

Reported by: cdestigter Owned by: hobu
Priority: normal Milestone: 2.1.0
Component: PythonBindings Version: svn-trunk
Severity: normal Keywords:
Cc: antonio


gdal.OpenEx('bogus.filename') doesn't trigger an exception, even if gdal.GetUseExceptions() == 1

Change History (4)

comment:1 Changed 2 years ago by antonio

Cc: antonio added

comment:2 Changed 2 years ago by Even Rouault

With gdal.OpenEx?() verbose errors have to be explicitly asked with gdal.OpenEx?(filename, gdal.OF_VERBOSE_ERROR), and when UseExceptions?() is set, this will cause the exception to be triggered.

I've a local patch that if GetUseExceptions?() is set will also set gdal.OF_VERBOSE_ERROR, so that an exception is automatically thrown, but I'm somewhat ambivalent about it. Opinions welcome.

comment:3 Changed 2 years ago by cdestigter

Thanks, I'll add that flag.

IMHO making UseExceptions() set OF_VERBOSE_ERROR would be ideal :)

comment:4 Changed 2 years ago by Even Rouault

Milestone: 2.1.0
Resolution: fixed
Status: newclosed

trunk r29716 "Python bindings: make gdal.OpenEx?() throw a Python exception in case of failed open when exceptions are enables with gdal.UseExceptions?() (#6075)"

Note: See TracTickets for help on using tickets.