[Wolves] Andy as per our discussion last night

Dave Morley davmor2 at davmor2.co.uk
Thu Jan 23 14:44:23 UTC 2014


On 23/01/14 14:34, andy at wild-flower.co.uk wrote:
> 
>> On 23 January 2014 at 14:22 Dave Morley <davmor2 at davmor2.co.uk> wrote:
>>
>>
>> It is subprocess.check_output that checks the result of running a
>> command so nicely and reads it back into python :) dir(subprocess) help
>> me find it and then help(subprocess.check_output) gave me how to use it
>> :) As I say gotta love python :)
>> --
>> You make it, I'll break it!
>>
>> I love my job :)
>> http://www.ubuntu.com
>> http://www.canonical.com
>>
>  
> Yep, that's the one I was using:
>  
> # Get a list of existing snapshots using zfs list
> # All snapshots starting with data/db are potentially eligible for culling
> print "Enumerating snapshots..."
> cull_list=[ (s.split()[0],mkdate(s.split()[0])) for s in
>                     subprocess.check_output(["zfs", "list", "-r", "-t",
> "snapshot", ]).splitlines()
>                         if s.startswith("data/db") ]
> 
> :D andydj
> 
> 

Bingo mine looks like:

    result = subprocess.check_output(["adb", "shell",
"system-image-cli", "-n"])
    while result == "Already up-to-date\r\n":
.......


-- 
You make it, I'll break it!

I love my job :)
http://www.ubuntu.com
http://www.canonical.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.lug.org.uk/pipermail/wolves/attachments/20140123/58dab29c/attachment.pgp>


More information about the Wolves mailing list