Hello,
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.)
Thanks,
Jim
............... ... /home/ftpmaint/test.pl........ ........
#!/usr/bin/env perl
print "\$0 is -->$0<--\n";
print "\$ARGV[0] is -->$ARGV[0]<--\n";
die "usage: $0 PKGNAME\n" unless @ARGV == 1;
............... ./home/ftpmaint/subtest.py..... ............
import os,subprocess
args=['/home/ftpmaint/test.pl','a']
p=subprocess.Po pen(args,shell= True,stdout=sub process.PIPE,st derr=subprocess .PIPE,cwd=os.ge tcwd())
retCode=p.wait( )
print "retCode=",retC ode
print "stdout>>",p.st dout.read()
print "stderr>>",p.st derr.read()
............ some command line work ..............
ftpmaint@millst one:~$ ./test.pl
$0 is --./test.pl--
$ARGV[0] is --><--
usage: ./test.pl PKGNAME
ftpmaint@millst one:~$ ./test.pl a
$0 is --./test.pl--
$ARGV[0] is -->a<--
ftpmaint@millst one:~$ python subtest.py
retCode= 255
stdout= $0 is --/home/ftpmaint/test.pl--
$ARGV[0] is --><--
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.)
Thanks,
Jim
............... ... /home/ftpmaint/test.pl........ ........
#!/usr/bin/env perl
print "\$0 is -->$0<--\n";
print "\$ARGV[0] is -->$ARGV[0]<--\n";
die "usage: $0 PKGNAME\n" unless @ARGV == 1;
............... ./home/ftpmaint/subtest.py..... ............
import os,subprocess
args=['/home/ftpmaint/test.pl','a']
p=subprocess.Po pen(args,shell= True,stdout=sub process.PIPE,st derr=subprocess .PIPE,cwd=os.ge tcwd())
retCode=p.wait( )
print "retCode=",retC ode
print "stdout>>",p.st dout.read()
print "stderr>>",p.st derr.read()
............ some command line work ..............
ftpmaint@millst one:~$ ./test.pl
$0 is --./test.pl--
$ARGV[0] is --><--
usage: ./test.pl PKGNAME
ftpmaint@millst one:~$ ./test.pl a
$0 is --./test.pl--
$ARGV[0] is -->a<--
ftpmaint@millst one:~$ python subtest.py
retCode= 255
stdout= $0 is --/home/ftpmaint/test.pl--
$ARGV[0] is --><--
Comment