Re: changing current dir and executing a shell script

2011-05-28 Thread Albert Hopkins
On Sat, 2011-05-28 at 09:41 +0200, Peter Otten wrote: > > You don't want to do this because "cd" is a built-in shell command, > and > > subprocess does not execute within a shell (by default). > > The problem is not that cd is built-in, but that there is no shell at > all. > You can change that w

Re: changing current dir and executing a shell script

2011-05-28 Thread Peter Otten
Albert Hopkins wrote: > On Fri, 2011-05-27 at 14:25 -0700, suresh wrote: >> I want to execute the following command line stuff from inside python. >> $cd directory >> $./executable >> >> I tried the following but I get errors >> import subprocess >> subprocess.check_call('cd dir_name;./executabl

Re: changing current dir and executing a shell script

2011-05-27 Thread suresh
On Friday, May 27, 2011 3:19:22 PM UTC-7, Albert Hopkins wrote: > On Fri, 2011-05-27 at 14:25 -0700, suresh wrote: > > Hi, > > I want to execute the following command line stuff from inside python. > > $cd directory > > $./executable > > > > I tried the following but I get errors > > import subpr

Re: changing current dir and executing a shell script

2011-05-27 Thread Thorsten Kampe
* suresh (Fri, 27 May 2011 14:25:52 -0700 (PDT)) > I want to execute the following command line stuff from inside python. > $cd directory > $./executable > > I tried the following but I get errors > import subprocess > subprocess.check_call('cd dir_name;./executable') > > Due to filename path is

Re: changing current dir and executing a shell script

2011-05-27 Thread Albert Hopkins
On Fri, 2011-05-27 at 14:25 -0700, suresh wrote: > Hi, > I want to execute the following command line stuff from inside python. > $cd directory > $./executable > > I tried the following but I get errors > import subprocess > subprocess.check_call('cd dir_name;./executable') > > Due to filename p

Re: changing current dir and executing a shell script

2011-05-27 Thread Dan Stromberg
Each command will be run in a distinct subprocess. A CWD is typically local to a given subprocess. So after the first command/subprocess exits, your cd's change is no longer there. Try doing it in one command, with the two original commands separated by a semicolon. On Fri, May 27, 2011 at 2:25

changing current dir and executing a shell script

2011-05-27 Thread suresh
Hi, I want to execute the following command line stuff from inside python. $cd directory $./executable I tried the following but I get errors import subprocess subprocess.check_call('cd dir_name;./executable') Due to filename path issues, I cannot try this version. subprocess.check_call('./dir_n