从 shell 脚本使用 Xvfb 运行 PyQt Webkit 脚本
我正在尝试使用 xvfb 在无头服务器上运行涉及 PyQt Webkit 的 Python 脚本。当我从命令行运行以下命令时,它有效,但不能从 bash 脚本运行:
# !/bin/bash
xvfb-run -a -e /path/to/error.log python script.py
错误日志在两种情况下都显示以下内容:
[dix] 无法初始化字体路径元素 /var/lib/defoma/x-ttcidfont- conf.d/dirs/TrueType,从列表中删除!
我读到的内容可以忽略。当 bash 脚本只是:
# !/bin/bash
python script.py
又名没有 Xvfb 时,脚本运行良好。 bash 环境是否存在某些问题会阻止脚本与 xvfb 一起运行?我被难住了!
I am trying to run a Python script that involves PyQt Webkit on a headless server using xvfb. The following command works when I run it from the command line, but not from a bash script:
# !/bin/bash
xvfb-run -a -e /path/to/error.log python script.py
The error log shows the following in both instances:
[dix] Could not init font path element /var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType, removing from list!
which I read could be ignored. The script runs fine when the bash script is just:
# !/bin/bash
python script.py
aka without Xvfb. Is there something about the bash environment that would prevent the script from running with xvfb? I'm stumped!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不会忽略这个错误。如果您尝试执行屏幕捕获,它会导致字体渲染不正确。要消除该错误(希望是您更大的问题),您需要按如下方式安装 TrueType 字体(此处为 Ubuntu 语法):(
您必须启用 multiverse 存储库才能获取 ttf-mscorefonts-installer)
接受ttf-mscorefonts-installer 的 EULA 条款。
然后:(
选择 freetype 字体)。
然后您应该已经清除了错误,这将有望解决您的问题并导致字体正确呈现。
I wouldn't ignore that error. It leads to incorrectly rendered fonts if you're attempting to perform screen captures. To get rid of the error (and hopefully your larger issue), you'll need to install the TrueType fonts as follows (Ubuntu syntax here):
(you'll have to enable the multiverse repo to get ttf-mscorefonts-installer)
Accept the EULA terms for ttf-mscorefonts-installer.
Then:
(choose the freetype fonts).
You should then have cleared the error which will hopefully both fix your issue and cause fonts to render correctly.