Portable way to refer to the null device?

skip at pobox.com skip at pobox.com
Fri Feb 6 22:51:13 EST 2009

    Roy> I need to run a command using subprocess.Popen() and have stdin
    Roy> connected to the null device. 

os.path.devnull should do what you want:

    >>> os.path.devnull
    >>> import ntpath
    >>> ntpath.devnull

Skip Montanaro - skip at pobox.com - http://www.smontanaro.net/

More information about the Python-list mailing list