Re: Re PDXLUG mbox to Maildir
Dylan Reinhardt <[email protected]>
| Newsgroups | gmane.org.user-groups.linux.pdxlug |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2004-05-04 at 08:55, Randal L. Schwartz wrote: > >>>>> "Dylan" == Dylan Reinhardt <[email protected]> writes: > > Dylan> os.system('sudo %s mb2md -s /home/%s/%s' % ( > Dylan> user_name, > Dylan> user_name, > Dylan> mbox_name)) > > I find Python syntax hard to read, but shouldn't that > be "sudo -u %s", and not "sudo %s"? Yes it should... good catch. Whatever is passed to os.system should be a valid shell command. As for the confusing syntax, perhaps there aren't enough brackets and dollar signs? :-) IMO, those who have programmed much in C would find this style of string formatting second nature, but there are certainly other ways to do it, such as: cmd = 'sudo -u '+user_name+' mb2md -s /home/'+ user_name+'/'+mbox_name os.system(cmd) Dylan