问题
Good morning.
I'm using the following code to generate pdf documents with LaTeX.
cmd = ['pdflatex','-interaction','nonstopmode', name + '.tex']
proc = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
proc.communicate()
Variable name is, obviously, the name of a file previously written, and I have perfectly checked that the file exists and it's valid. However, using this code in macOs High Sierra 10.13.6 gives me the following error in the second line (proc = ...):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
On the other hand, the code works perfectly in Ubuntu 16.04.
Many thanks you in advance!
来源:https://stackoverflow.com/questions/55197121/subprocess-popen-failing-in-macos-high-sierra-10-13-6