Hi,

On Fri, May 27 2011, Henry Vélez Molina wrote:
> Also you could use this script:
> 
> #!/usr/bin/python -tt
> import subprocess
> getserial = subprocess.Popen(['cat /ofw/serial-number'], shell=True,
> stdout=subprocess.PIPE)
> for line in getserial.stdout:
>   print(line.decode().strip())

There's no need to spawn a shell, and then spawn cat inside a shell.
Python knows how to open files:

print open("/ofw/serial-number").readline().strip()

-- 
Chris Ball   <c...@laptop.org>   <http://printf.net/>
One Laptop Per Child
_______________________________________________
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel

Reply via email to