Skip to content

Instantly share code, notes, and snippets.

@seiichi
Created September 17, 2013 02:40
Show Gist options
  • Save seiichi/6589458 to your computer and use it in GitHub Desktop.
Save seiichi/6589458 to your computer and use it in GitHub Desktop.
handling subprocess.DEVNULL under both python2 and python3 (taken from youtube-dl)
try:
from subprocess import DEVNULL
compat_subprocess_get_DEVNULL = lambda: DEVNULL
except ImportError:
compat_subprocess_get_DEVNULL = lambda: open(os.path.devnull, 'w')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment