Re: [Tutor] using python to execute from Dir A in Dir B

2007-10-05 Thread Alan Gauld
Not sure what happened to the formatting here... It should be: - "Alan Gauld" <[EMAIL PROTECTED]> wrote The given example for os.system is: sts = os.system("mycmd" + " myarg") ==> p = Popen("mycmd" + " myarg", shell=True) sts = os.waitpid(p.pid, 0) To which you would need to

Re: [Tutor] using python to execute from Dir A in Dir B

2007-10-05 Thread Alan Gauld
"Andre Walker-Loud" <[EMAIL PROTECTED]> wrote > this module.class - if someone with more experience would feel > inclined to provide an example, I would be very much appreciative. The subprocess module documentation has several examples of using both the Popen class and the call function. Th

Re: [Tutor] using python to execute from Dir A in Dir B

2007-10-04 Thread Andre Walker-Loud
Thank you everyone for the help. I have two solutions, but I would love one that uses the subprocess.Popen() - I have no experience with this module.class - if someone with more experience would feel inclined to provide an example, I would be very much appreciative. SOLUTION 1 (my brute for

Re: [Tutor] using python to execute from Dir A in Dir B

2007-10-04 Thread Alan Gauld
"Andre Walker-Loud" <[EMAIL PROTECTED]> wrote > If I were using CSH, I could do all this very simply by having these > lines in my script > > ### .csh file > > cd /scratch > my_exe.csh The best answer is to use subprocess as Kent suggested but you can also use os.chdir(path) before using os.syste

Re: [Tutor] using python to execute from Dir A in Dir B

2007-10-04 Thread Tiago Saboga
On Thu, Oct 04, 2007 at 03:15:41PM -0400, Andre Walker-Loud wrote: > what I need to do is have my python script run another executable, > but it must do it from a directory different from the one I am in, it > needs to run in the /scratch/ directory (again not my choice) > > Is this possible,

Re: [Tutor] using python to execute from Dir A in Dir B

2007-10-04 Thread Kent Johnson
Andre Walker-Loud wrote: > Hi All, > > lets say I am in Dir A (out of my control because I have submitted a > job to a queuing system) > > and I have a python script which is running in this directory - the > one I submitted to the queue > > what I need to do is have my python script run ano

[Tutor] using python to execute from Dir A in Dir B

2007-10-04 Thread Andre Walker-Loud
Hi All, lets say I am in Dir A (out of my control because I have submitted a job to a queuing system) and I have a python script which is running in this directory - the one I submitted to the queue what I need to do is have my python script run another executable, but it must do it from a