On May 15, 5:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: > > I'm trying to figure out why Popen captures the stderr of a specific > > command when it runs through the shell but not without it. IOW: > > > cmd = [my_exe, arg1, arg2, ..., argN] > > if 1: # this captures both stdout and stderr as expected > > pipe = Popen(' '.join(cmd), shell=True, stderr=PIPE, stdout=PIPE) > > else: # this captures only stdout > > pipe = Popen(cmd, shell=False, stderr=PIPE, stdout=PIPE) > > > # this prints the empty string if not run through the shell > > print "stderr:", pipe.stderr.read() > > # this prints correctly in both cases > > print "stdout:", pipe.stdout.read() > > > Any hints ? > > Post an example which replicates the problem!
I would, but the specific executable being spawned is not a python script, it's a compiled binary (it's not an extension module either; it's totally unrelated to python). I don't claim there is a bug or anything suspicious about Popen, but rather I'd like an explanation of how can a program display different behavior depending on whether it runs through the shell or not. George -- http://mail.python.org/mailman/listinfo/python-list