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

Rogelio scubacuda at gmail.com
Mon May 7 06:07:30 CEST 2012


On Sun, May 6, 2012 at 8:23 PM, Martin A. Brown <martin at linux-ip.net> 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 mispelled something.  :b

I suspect that I'm having a problem with it reading a long string, but
I'm not sure why.  (Need to escape a char? Or perhaps something is
timing out?)

This works

cmd = ['perl','/path/to/my/script.pl, '-h']
subprocess.call(cmd)

But this does not

cmd = ['perl','/path/to/my/script.pl, '-x arg1 -y arg2 -z arg3']
subprocess.call(cmd)

strace gives me this output

***************

MY COMMAND: strace -e process python myProg.py

OUTPUT

execve("/usr/bin/python", ["python", "myProg.py"], [/* 22 vars */]) = 0
arch_prctl(ARCH_SET_FS, 0x2b75cfb731e0) = 0
clone(child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x2b75cfb73270) = 15883
wait4(15883, +-------------------------------------------------------------------------------+
|   (output from script file)

ERROR: You must specify either a command to be executed or an a
command file for execution
[{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 15883
--- SIGCHLD (Child exited) @ 0 (0) ---
exit_group(0)                           = ?
*************************************


More information about the Tutor mailing list