Skip to content

Instantly share code, notes, and snippets.

Created February 12, 2015 14:40
Show Gist options
  • Save anonymous/5612e3df3c111ef8cc09 to your computer and use it in GitHub Desktop.
Save anonymous/5612e3df3c111ef8cc09 to your computer and use it in GitHub Desktop.
from subprocess import Popen, PIPE
p = Popen(["hcitool", "lescan"], stdout=PIPE, bufsize=1)
for line in iter(p.stdout.readline, b''):
print line
p.communicate() # close p.stdout, wait for the subprocess to exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment