python执行js文件报错_python 在调用 Phantomjs 时报错

python 在调用 Phantomjs 对视频网站进行抓取时报错

selenium.common.exceptions.WebDriverException: Message: Service phantomjs unexpectedly exited. Status code was: 127

Bash

[root@localhost clog]# python manage.py getmovie

movielist over

Traceback (most recent call last):

File "manage.py", line 22, in

execute_from_command_line(sys.argv)

File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line

utility.execute()

File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "/usr/lib64/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv

self.execute(*args, **cmd_options)

File "/usr/lib64/python2.7/site-packages/django/core/management/base.py", line 330, in execute

output = self.handle(*args, **options)

File "/data/clog/blog/management/commands/getmovie.py", line 21, in handle

tv=tvshow()

File "/data/clog/blog/moviebot.py", line 58, in tvshow

driver = selenium.webdriver.PhantomJS()

File "/usr/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 52, in __init__

self.service.start()

File "/usr/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 96, in start

self.assert_process_still_running()

File "/usr/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running

% (self.path, return_code)

selenium.common.exceptions.WebDriverException: Message: Service phantomjs unexpectedly exited. Status code was: 127123456789101112131415161718192021222324

此为系统中缺少相应的组件导致的。

在centos 中 使用 yum install /y fontconfig

在ubuntu中使用 apt-get install libfontconfig

结果如下

Bash

Installed:

fontconfig.x86_64 0:2.10.95-10.el7

Dependency Installed:

fontpackages-filesystem.noarch 0:1.44-8.el7

Complete!

[root@localhost clog]# python manage.py getmovie

movielist over

tvlist over

movie suggest over

later play over

all over

[root@localhost clog]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值