command line arguments using subprocess

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 15 18:02:49 EDT 2007


En Wed, 14 Mar 2007 16:51:04 -0300, Jim <jhefferon at smcvt.edu> escribió:

> I'm trying to use subprocess to drive a Perl script.  I'm having some
> trouble getting it to spot the command line arguments.  Basically, if
> I call subprocess(args).wait() where args has a second item, I can't
> convince the Perl script to see it.  Below is a pretty small example.
> If someone could get me unstuck, I'd appreciate it.  (Python 2.4.4c1,
> if that helps.)
> args=['/home/ftpmaint/test.pl','a']
> p=subprocess.Popen(args,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE,cwd=os.getcwd())

Try with 'perl' explicitely as first argument, or without shell=True; if  
cwd is the current dir, there is no need to include it.

-- 
Gabriel Genellina




More information about the Python-list mailing list