本文是小编为大家收集整理的关于python phanthomjs不能与nohup一起工作的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。
问题描述
我正在使用phanthomjs运行硒,如果我触发它为:
python my_script.py
但是,当我尝试使用NOHUP时:
nohup python my_script.py &
我有以下错误:
selenium.common.exceptions.WebDriverException: Message: Service phantomjs unexpectedly exited. Status code was: 8
推荐答案
现在可能为时已晚,但是我只是使用另一个代码遇到了类似的错误,我找到了一个解决方案.因此,当您运行NOHUP时
Traceback (most recent call last): me/fanar/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running File "main.py", line 51, in <module> Work() File "main.py", line 41, in Work TakeImage() # start o 16 File "main.py", line 9, in TakeImage driver = webdriver.PhantomJS() File "/home/fanar/.local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 52, in __init__ self.service.start() File "/home/fanar/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 96, in start self.assert_process_still_running() File "/home/fanar/.local/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: 1
解决方法是去
.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py
和评论
self.assert_process_still_running()
其他推荐答案
指定参数对我有用:
driver = webdriver.PhantomJS(executable_path = '/usr/lib/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs')
问题描述
I'm running selenium using phanthomjs, the script is running perfectly if when I trigger it as:
python my_script.py
But when I try to using nohup:
nohup python my_script.py &
I got the following error:
selenium.common.exceptions.WebDriverException: Message: Service phantomjs unexpectedly exited. Status code was: 8
推荐答案
It's probably too late but I just met similar error just with another code and I've found a solution. So, when you run nohup your program's output is redirected to nohup.out, and the file for me was like this:
Traceback (most recent call last): me/fanar/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running File "main.py", line 51, in <module> Work() File "main.py", line 41, in Work TakeImage() # start o 16 File "main.py", line 9, in TakeImage driver = webdriver.PhantomJS() File "/home/fanar/.local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 52, in __init__ self.service.start() File "/home/fanar/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 96, in start self.assert_process_still_running() File "/home/fanar/.local/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: 1
The workaround was to go to the
.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py
and comment out line
self.assert_process_still_running()
其他推荐答案
Specifying the parameters works for me:
driver = webdriver.PhantomJS(executable_path = '/usr/lib/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs')
相关标签/搜索
苹果vscode菜单栏
xml转成map字段顺序不变
radio选择对于input变化
ubantu局域网屏幕共享
linux虚拟内存不足怎么解决
繁体中文 中文输入-半角-中文符号 1025
数据库“WSS_Content_Sms”的事务日志已满
为什么redis-cli看不到数据
html中使用rgb函数字体颜色
GIS破解未标记为正在进行时
windows rocksdb编译成lib
Okhttp设置ss代理
linux
sudo
nohup
python
heroku
flask
python-3.x
anaconda
dbm
gdbm