No command runs in Subprocess [closed]

▼魔方 西西 提交于 2019-12-13 09:04:16

问题


I have used a subprocess to convert Docx file to Pdf file in Django. On the server when I run the project with python manage.py runserver command. All things working file but if I run the application with Gunicorn my subprocess not work. Simple "ls" command is also not working. My server has ubuntu 18.04.

I knew that this is related to services which we have to create to run the application on the server but I am not able to find the issue. Thanks in advance.

To generate pdf I have use preview-generator package its working on my local machin but on server this is the error I am having

Command '['libreoffice', '--headless', '--convert-to', 'pdf:writer_pdf_Export', '/root/form_builder/static/temp_folder/d2f851423dd1fecb2ed535c04a603705.pdf.docx', '--outdir', '/root/form_builder/static/temp_folder/', '-env:UserInstallation=file:///tmp/LibreOffice_Conversion_${USER}']' returned non-zero exit status 127.

So to generate pdf I have used custom code which is having subprocess

proc = subprocess.Popen([officepath, '--headless', '--convert-to','pdf:writer_pdf_Export', output_folder, input_file],env=env,stdout=subprocess.PIPE,
        stderr=subprocess.PIPE, cwd='/root/form_builder/static/temp_folder/2/', shell=True)

来源:https://stackoverflow.com/questions/59155672/no-command-runs-in-subprocess

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