python - Not getting any error messages from failed subprocess.Popen -
python - Not getting any error messages from failed subprocess.Popen -
i set subprocess.popen generate pdf through pdflatex. code snippet:
process = subprocess.popen(command, stdout=subprocess.pipe, shell=true) output, err = process.communicate() print output print err
it works fine, problem error message. if pdflatex doesn't manage generate file, e.g. message "fatal error occured, no output pdf file produced!"
@ end of printed output, still "none"
printed out err.
any insight appreciated
edit: adding stderr=subprocess.pipe
helps. don't "none"
anymore, blank error message regardless of whether or not generation of pdf successful. looks this:
process = subprocess.popen(command, stdout=subprocess.pipe, stderr=subprocess.pipe, shell=true) same above
try this:
fout = open("temp.txt", "w") process = subprocess.popen(cmd, stdout=subprocess.pipe, stderr=fout, shell=true)
i prefer subprocess.check_output(), more convenient.
python subprocess popen pdflatex communicate
Comments
Post a Comment