May 12, 2004

PyOne - oooh, nasty. In a good way.

Also new (to me, at least) and cool (to me, at least) in the world of Python - EasyDialogs and Win32 Screensaver.

Posted to Python by Simon Brunning at May 12, 2004 01:18 PM

Thanks for this link - pyone fills a gap I've felt for a while (being a reformed perl user). Python is particularly good for one-liners because the exception handling means you don't need error checks all over the place.

Here's my first use of this:

pyone -i tarfile -f os,sys 't =, mode="w|gz"); for dir, names, fnames in walk(".") { for name in fnames { path = "%s/%s" % (dir, name); if stat(path).st_mode & 0222 { t.add(path, "t-new/" + path) } } }' | ssh otherhost tar xzf -

What it does: find all writable files below the current directory, put them in a gzipped tar file on stdout (with every path prefixed by "t-new/"), and send that to another host. Sure, you could do this with find and tar but I can never remember find's syntax.

I think it would be worth adding this functionality to python via a command line flag.

Posted by: Mark Russell on May 13, 2004 03:05 PM
Post a comment

Email Address:



Remember info?