MRAB wrote:
Jay Jesus Amorin wrote:This is how i do it, but it runs with error. Kindly help#!/usr/bin/env python import csv, sys, os filename = (sys.argv[1])reader = csv.reader(open(filename, "rb"), delimiter=',', quoting=csv.QUOTE_NONE)try: for row in reader: os.popen("chown row[0] row[1]")This should be: os.popen("chown %s %s" % (row[0], row[1])) or: os.popen("chown %s %s" % tuple(row))
No, it should really be os.popen(("chown",row[0],row[1]))
or better yet,
for fmodes,fname in reader:
os.popen(("chown",fmodes,fname))
or even plus better:
for fmodes,fname in reader:
os.chmod(fname,fmodes)
(Both my examples avoid problems with unquoted filenames)
Regards
Tino
smime.p7s
Description: S/MIME Cryptographic Signature
-- http://mail.python.org/mailman/listinfo/python-list
