我一直在努力解决这个异常问题。 我只是想使用pydf库将字符串保存为pdf。这在here中非常简单。如果我在一个独立的python脚本中运行以下脚本,它可以正常工作
import pydf
alarm_report = "test"
file_name = "test.pdf"
pdf = pydf.generate_pdf(alarm_report)
with open(str(file_name), 'w') as f:
f.write(pdf)
然而,当我尝试将其集成到我正在开发的软件中时,我得到以下异常:
File "/home/cayman/multiviewer/src/alarm_log/alarm_db_utils.py", line 116, in db_export_to_pdf
pdf = pydf.generate_pdf(str(alarm_report)) File "/usr/local/lib/python2.7/dist-packages/pydf/wkhtmltopdf.py", line 121, in generate_pdf
return gen_pdf(html_file.name, cmd_args) File "/usr/local/lib/python2.7/dist-packages/pydf/wkhtmltopdf.py", line 105, in gen_pdf
_, stderr, returncode = execute_wk(*cmd_args) File "/usr/local/lib/python2.7/dist-packages/pydf/wkhtmltopdf.py", line 23, in execute_wk
stdout, stderr = p.communicate() File "/usr/lib/python2.7/subprocess.py", line 799, in communicate
return self._communicate(input) File "/usr/lib/python2.7/subprocess.py", line 1409, in _communicate
stdout, stderr = self._communicate_with_poll(input) File "/usr/lib/python2.7/subprocess.py", line 1439, in
_communicate_with_poll
poller = select.poll()
知道是什么导致了这个问题吗?