运行一段时间后发生异常

时间:2019-02-04 02:52:18

标签: python-3.x multithreading centos selenium-chromedriver

我在服务器上运行了python搜寻器,但几次成功尝试后都会发生异常。

我正在使用centos 7.5服务器运行我的python代码。主要思想是通过每小时获取每个用户的“最近播放列表”来监视240个Net Ease Music用户(在某些国家可能无法访问)。因此,平均而言,请求频率为15秒,低于IP不受限制的阈值。最初,代码可以正常运行以获取数据,即持续7个小时。然后在所有线程中发生异常。然后,如果我尝试运行与硒有关的代码,则会遇到相同的异常。我必须重新启动服务器,并且我可以再次运行代码,但是运行7小时后,再次出现相同的问题。代码和异常消息在这里:

代码:

https://github.com/TianxingWang0/NetEase_Music_Spider/blob/master/NetEaseUserRecentPlay.py

异常消息:

Exception in thread Thread-1460:
Traceback (most recent call last):
File "/usr/local/python3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/python3/lib/python3.6/threading.py", line 1182, in run
    self.function(*self.args, **self.kwargs)
File "NetEaseUserRecentPlay.py", line 39, in exec_callback_
self.__callback_proc(*self.__args, **self.__kwargs)
File "NetEaseUserRecentPlay.py", line 75, in start
driver = webdriver.Chrome(options=option)
File "/usr/local/python3/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/python3/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/python3/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/python3/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/python3/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 3.10.0-957.1.3.el7.x86_64 x86_64)

0 个答案:

没有答案
相关问题