I'm running python 2.5 and have bumped into an issue whereby the PIPE in subprocess.Popen locks up after taking too many characters. I found some documentation that discuss this problem and offers some ideas for solutions, the best one being to pass a file object into subprocess instead of PIPE. This will allow for much larger std output.

http://thraxil.org/users/anders/posts/2008/03/13/Subprocess-Hanging-PIPE-is-your-enemy/

The problem is that, while I can pass in a tempfile.TemporaryFile() and everything seems to go swimmingly, there doesn't seem to be anything written to file I handed Popen.

import tempfile
import subprocess

def awesome():
# I understand that not everyone has nuke, but it doesn't seem to matter what I run through it
    # the result is the same.
    my_cmd = '/usr/local/Nuke6.0v3/Nuke6.0 -V'

    my_stderr = tempfile.TemporaryFile()
    my_stdout = tempfile.TemporaryFile()

    process = subprocess.Popen(my_cmd, stderr=my_stderr, stdout=my_stdout)
    process.wait()

    print my_stderr.read()
    print my_stdout.read()

    print "Finished!!!"

Any help on this issue would be awesome! thanks!

Brandon L. Harris



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to