vim python: substitute 'spaces' indent to 'tabs'?

2007-04-01 Thread Rocky Zhou
I am accustomed to vi my pthon scripts with 'tab' indent. But when I copy some code to my script, the indent may be 'spaces'. So I wanna a way to substitute those 'spaces' to be 'tabs' conveniently. For example, I: expand -t4 test.py >/tmp/test2.py vi /tmp/test2.py Then in vim, the indents should

python unzip: os.popen3("unzip ...") or import zipfile?

2007-04-01 Thread Rocky Zhou
python unzip At first, I tried to use 'os.popen3("unzip ...") like this: fin, fout, ferr = os.popen3("unzip -o -d %s %s" % (dest, zipfile)) strerr = ferr.read() # This makes the program hanging up if strerr: print >> sys.stderr, strerr outlog.error(strerr) I want to know is this caused by

Re: getopt or optparse options/arguments wrapping?

2007-03-18 Thread Rocky Zhou
Well, I think I must have more explanation on my script. The script's usage is like this: ~# fs_backup Lack of backup identity name program usage: fs_backup [OPTIONS] $identity OPTIONS: -a|--append [t/x[L]:$path, append 1 dir or file to $identity t/x: include/exclude list, as -T/-X

getopt or optparse options/arguments wrapping?

2007-03-16 Thread Rocky Zhou
I wonder is there any way to make the wrapper program can wrap options && arguments for the the subprocess/command the wrapper will execute? by getopt or optparse module? This is something like the shell script like this: optwrap="" while [ $# -gt 0 ]; do case $1 in -a) do-something; s