Python: Print only the message on warnings -


I am issuing many warnings in a verifier, and I want to suppress everything in stdout except the message Warnings. Warn () . , now I'm looking at it:

  ./ file.py:123: user warning: my  

I would like to see: < / P> Edit 2: Overriding warnings.showwarning () went to work:

  def _warning (message, category = user Warning, file name = '', linin = -1): print (messages) ... warnings.shovaling = _warning warnings.warn ('foo')  

< Div class = "post-text" itemprop = "text">

Monkey patches with their own custom function


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -