Skip to content

Instantly share code, notes, and snippets.

@Hodapp87
Created April 4, 2014 20:50
Show Gist options
  • Save Hodapp87/9982871 to your computer and use it in GitHub Desktop.
Save Hodapp87/9982871 to your computer and use it in GitHub Desktop.
subprocess with string to stdin
# Will require changes (due to how strings are handled) on Python 3.x
import subprocess
f = open("test.jpg")
jpegString = f.read()
ret = subprocess.Popen(["./jpeg_check.o", "-"], stdin = subprocess.PIPE)
ret.communicate(jpegString)
print(ret.returncode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment