Re: [Tutor] system call

2007-10-29 Thread Kent Johnson
James wrote: > The subprocess module is meant to replace spawn, popen2, os.system() > etc. if I'm not mistaken. Yes. > Take a look at this excellent resource I've used numerous times: > > http://www.python.org/dev/peps/pep-0324/ The same information (with better format but split between mult

Re: [Tutor] system call

2007-10-28 Thread John
Here is my actual code (a section of a long script): if os.path.isdir(ad) and aRun.split('_')[0]==STN_id[i] and in (aRun.split ('_')[1]): make_pages=os.path.join(BASEDIR,STN_id[i],SUBDIR[1],'make_pages') sedstr1="""cat %s | sed -e 's/ASYSmin=[0-9][0-9]*/ASYSmin=%s/g' > jnk""" % (make_webpage

Re: [Tutor] system call

2007-10-28 Thread Alan Gauld
"Eric Walker" <[EMAIL PROTECTED]> wrote > The problem is that I have another tool that has an initialization > period when you start it up. I want to see how long it takes Have you considered just using the Unix time command? > So, to time the entire init process, I want to use python. As a

Re: [Tutor] system call

2007-10-27 Thread Eric Walker
program. What do you think? python newbie... - Original Message From: Alan Gauld <[EMAIL PROTECTED]> To: tutor@python.org Sent: Saturday, October 27, 2007 4:09:35 PM Subject: Re: [Tutor] system call "Eric Walker" <[EMAIL PROTECTED]> wrote > I am trying to

Re: [Tutor] system call

2007-10-27 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote > for i in attempts: #attempts holds strings of shellscripts >cmd="%s which runs many different shell scripts and takes > about an > hour" % (i) >os.system(cmd) >#debugging >print "Finished with %s" % (i) >raw_input("More

Re: [Tutor] system call

2007-10-27 Thread Alan Gauld
"Eric Walker" <[EMAIL PROTECTED]> wrote > I am trying to run a timing script but I need the python program > to stop and wait for the executable to finish. Does anyone have > any examples of doing this? There are several ways to do it depending on what exactly you are trying to do. We need a

Re: [Tutor] system call

2007-10-27 Thread Ricardo Aráoz
John wrote: > I have the exact same situation, but system doesn't seem to wait. Here > is my pseudo code: > > for i in attempts: #attempts holds strings of shellscripts > cmd="%s which runs many different shell scripts and takes about > an hour" % (i) > os.system(cmd) > #d

Re: [Tutor] system call

2007-10-27 Thread James
How about using subprocess.Popen( ... ).wait()? I believe subprocess.call() will wait until the process is finished, too. The subprocess module is meant to replace spawn, popen2, os.system() etc. if I'm not mistaken. Take a look at this excellent resource I've used numerous times: http://ww

Re: [Tutor] system call

2007-10-27 Thread John
I have the exact same situation, but system doesn't seem to wait. Here is my pseudo code: for i in attempts: #attempts holds strings of shellscripts cmd="%s which runs many different shell scripts and takes about an hour" % (i) os.system(cmd) #debugging print "Fini

Re: [Tutor] system call

2007-10-27 Thread Eric Walker
disregard this one. I found the answer. I was using spawn instead of os.system. Thanks. - Original Message From: Eric Walker <[EMAIL PROTECTED]> To: tutor@python.org Sent: Saturday, October 27, 2007 9:55:05 AM Subject: [Tutor] system call Hello, I am trying to run a timing script but