Edit: Oops! I accidentally posted code that didn't match my question. I started writing this post before I was done experimenting, so I posted code from an intermediate point in my testing process. I've amended this question to reflect what I really meant to post by changing the code slightly.
The following Python code works as expected with one problem: unless I If verbose == False, the file produced by the Perl script is not created. Why do I have to call output.stdout.read() for the underlying Perl script to successfully create a file?
cmdStringList = ["perl","script.pl","arg1",...]
output = subprocess.Popen(cmdStringList,stdout=subprocess.PIPE)
if verbose:
print output.stdout.read()
I didn't even realize anything was wrong until I tried to execute my Python script with verbose=False in a production environment. I did some google-fu to try to understand the behavior of Popen and subprocess, but I haven't come up with a reason for this behavior. Any help would be greatly appreciated.
output.stdout.read()causes it to fail, and you also said it started to fail when verbose was set to false. Which one is it? Did you post the wrong code?