Re: [Tutor] error when using using subprocess.popen in Python wrapper script

2012-05-07 Thread Peter Otten
Rogelio wrote: > If I want to write this command to a file, would this be the right format? > > * > import subprocess > > (all my variables defined okay) > > perl_script=subprocess.call(['perl',perl_prog,ipfile,cmd,user,timeout,]) > > log=open('/tmp/pythonOutput

Re: [Tutor] error when using using subprocess.popen in Python wrapper script

2012-05-07 Thread Rogelio
If I want to write this command to a file, would this be the right format? * import subprocess (all my variables defined okay) perl_script=subprocess.call(['perl',perl_prog,ipfile,cmd,user,timeout,]) log=open('/tmp/pythonOutput.txt',w) log.write(subprocess.call(p

Re: [Tutor] error when using using subprocess.popen in Python wrapper script

2012-05-06 Thread Rogelio
On Sun, May 6, 2012 at 8:23 PM, Martin A. Brown wrote: > Or, if I were in your shoes, I would do something a bit more like > this: > >  cmd = [ '/usr/bin/perl', '/path/to/perlprog.pl', '-h' ] >  subprocess.call(cmd) Thank you, Martin. This was helpful. Installed Strace and found out that I mis

Re: [Tutor] error when using using subprocess.popen in Python wrapper script

2012-05-06 Thread Martin A. Brown
Hello, : perl_prog = "perl perlprog.pl" : perl_prog_h ="-h" : #this is where it breaks : subprocess.call([perl_prog, perl_prog_h]) This is asking your Linux to search your $PATH and execute a program called: 'perl perlprog.pl' Rather than to execute a program called 'perl' and pass as t

[Tutor] error when using using subprocess.popen in Python wrapper script

2012-05-06 Thread Rogelio
I am new to Python and am trying to figure out how to execute Linux commands via a Python wrapper. This works ** #this works okay import subprocess uname = "uname" uname_arg = "-a" subprocess.call([uname,uname_arg]) ** But this doesn't.