subprocess.Popen failing in macOs High Sierra 10.13.6

假如想象 提交于 2019-12-25 01:18:00

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!