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
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
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
* 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
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
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
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