ImgKit 将 html 文件转换为 jpg 文件的时间太长3 分钟

问题描述

imgkit.from_file(html_filename,image_filename,options={"width": 660,"disable-smart-width": ""}) 这就是我跑的,出于某种原因,大多数时候,这需要 3 分钟才能运行,就在昨天,仅在昨天,它的运行时间是 3 到 10 秒左右。我正在尝试呈现的 html 并不重要,因为“www.google.com”也会发生同样的问题,大约 3 分钟。我在 Ubuntu 20.04 上运行。

额外细节: 大部分时间控制台没有输出,只有最后几秒才出现输出

Loading page (1/2)
Rendering (2/2)                                                    
Done                                                               

当我在中间键盘中断时,该功能似乎卡在了似乎是超时的范围内。

Traceback (most recent call last):
  File "test.py",line 11,in <module>
    html_to_image("result.html","result.jpg")
  File "test.py",line 6,in html_to_image
    imgkit.from_file(html_filename,"disable-smart-width": ""})
  File "/home/smi/.local/lib/python3.8/site-packages/imgkit/api.py",line 64,in from_file
    return rtn.to_img(output_path)
  File "/home/smi/.local/lib/python3.8/site-packages/imgkit/imgkit.py",line 225,in to_img
    stdout,stderr = result.communicate(input=string)
  File "/usr/local/lib/python3.8/subprocess.py",line 1024,in communicate
    stdout,stderr = self._communicate(input,endtime,timeout)
  File "/usr/local/lib/python3.8/subprocess.py",line 1866,in _communicate
    ready = selector.select(timeout)
  File "/usr/local/lib/python3.8/selectors.py",line 415,in select
    fd_event_list = self._selector.poll(timeout)

如果有人能伸出援手,将不胜感激!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...