[ubuntu-us-in] Ubuntu-us-in Digest, Vol 15, Issue 7

Vern Ceder vceder at canterburyschool.org
Sun May 4 05:14:06 BST 2008


On Sat, May 3, 2008 at 11:35 PM, Rob Ludwick <rob at rcludw.no-ip.org> wrote:
> 
> Of course a neat trick in python is to use popen2() and use dd without
> an "of" paramter.  dd sends the data to standard out, which in python
> through popen2() becomes a file.  (Yay!)  You know how many bytes you
> get because you you can count them and you would get an EOF before you
> were done reading blocksize.  At this point you would adjust your dd
> parameters to start at the next 512 byte block on the drive.  And then
> you can just use python to interleave the 4k blocks.  
> 
Actually, the whole Python popen family - popen2, popen3 and popen4 - 
have been deprecated. You can now do exactly the same things a bit more 
cleanly using the subprocess module. I just discovered this myself a 
couple of weeks ago while writing some sysadmin-ish scripts.

Cheers,
Vern


-- 
This time for sure!
    -Bullwinkle J. Moose
-----------------------------
Vern Ceder, Director of Technology
Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
vceder at canterburyschool.org; 260-436-0746; FAX: 260-436-5137



More information about the Ubuntu-us-in mailing list