Cross platform /dev/null in Python

Posted by Tristan on Stack Overflow See other posts from Stack Overflow or by Tristan
Published on 2010-05-28T14:34:08Z Indexed on 2010/05/28 15:02 UTC
Read the original article Hit count: 164

Filed under:

I'm using the following code to hide stderr on Linux/OSX for a Python library I do not control that writes to stderr by default:

f = open("/dev/null","w")
zookeeper.set_log_stream(f)

Is there an easy cross platform alternative to /dev/null? Ideally it would not consume memory since this is a long running process.

© Stack Overflow or respective owner

Related posts about python