Python 2.4.4 の .tex ファイルで pdflatex を実行しようとしています。サブプロセス (Mac の場合):
import subprocess
subprocess.Popen(["pdflatex", "fullpathtotexfile"], shell=True)
これは事実上何もしません。ただし、ターミナルで「pdflatex fullpathtotexfile」を問題なく実行でき、pdf を生成できます。私は何が欠けていますか?
[編集]回答の1つで提案されているように、私は試しました:
return_value = subprocess.call(['pdflatex', '/Users/Benjamin/Desktop/directory/ON.tex'], shell =False)
これは失敗します:
Traceback (most recent call last):
File "/Users/Benjamin/Desktop/directory/generate_tex_files_v3.py", line 285, in -toplevel-
return_value = subprocess.call(['pdflatex', '/Users/Benjamin/Desktop/directory/ON.tex'], shell =False)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/subprocess.py", line 413, in call
return Popen(*args, **kwargs).wait()
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/subprocess.py", line 543, in __init__
errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/subprocess.py", line 975, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
ファイルは存在pdflatex /Users/Benjamin/Desktop/directory/ON.tex
し、ターミナルで実行できます。pdflatex はかなりの数の警告をスローすることに注意してください...しかし、それは問題ではなく、これも同じエラーを出します:
return_value = subprocess.call(['pdflatex', '-interaction=batchmode', '/Users/Benjamin/Desktop/directory/ON.tex'], shell =False)