[redland-dev] Suppressing parser warnings from Python

Dave Beckett dave at dajobe.org
Sat Jun 11 04:24:52 CEST 2011


On 6/10/11 3:28 PM, Ryan Shaw wrote:
> Hello,
> 
> Is there any way to suppress Raptor's parser warnings when using the
> Python bindings?
> 
> I was hoping that
> 
> import warnings
> warnings.filterwarnings('ignore')
> 
> would do the trick, but no such luck.

You can set your own error handler with the handler option on the
model.parse_into_model,  model.load methods, model.parse_string_into_model

Docs say:
       If handler is given, an error handler with the signature
         def handler(code, level, facility, message, line, column, byte,
file, uri)
       is called.

then you can choose what to do with the warnings - in this case, ignore them

Dave


More information about the redland-dev mailing list