Errors should never pass silently ... unless explicitly silenced.

Just just at xs4all.nl
Fri Feb 7 10:17:51 EST 2003


In article <2259b0e2.0302070638.3d648959 at posting.google.com>,
 mis6 at pitt.edu (Michele Simionato) wrote:

> In Linux I am doing
> 
>   sys.stderr=file('/dev/null','w')
> 
> Is there a better way of doing that? I would be interested in a portable
> way, valid for Windows too.

This is usually enough:

class DevNull:
   def write(self, data):
      pass

sys.stderr = DevNull()


Just




More information about the Python-list mailing list