我有一个名为stock_automation.sh的脚本,它是一个名为stock_automation.py的python脚本。 当我从终端运行它时,它工作得非常好,但当我尝试使用cron自动运行它时,它会给selenium chromedriver带来一个错误
我的crontab条目如下:25 14 * * * /home/user/project-scrapers/stock_automation.sh >> /home/daniel/amazon-project-scrapers/stock_automation.sh.log 2>&1
我的脚本内容如下:
#!/usr/bin/env bash
echo "Hello!"
source /home/user/.local/share/virtualenvs/project-scrapers-kMVxSu_o/bin/activate
python /home/user/project-scrapers/stock_automation.py
我的日志文件中的错误如下:
Hello!
/home/user/.local/share/virtualenvs/project-scrapers-kMVxSu_o/lib/python3.7/site-packages/pandas/compat/__init__.py:117: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.
warnings.warn(msg)
Traceback (most recent call last):
File "/home/user/project-scrapers/stock_automation.py", line 235, in <module>
dfs = stock(webpage, MAXIMUM_VALUE)
File "/home/user/project-scrapers/stock_automation.py", line 24, in stock
executable_path=executable_path)
File "/home/user/.local/share/virtualenvs/project-scrapers-kMVxSu_o/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "/home/user/.local/share/virtualenvs/project-scrapers-kMVxSu_o/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/home/user/.local/share/virtualenvs/project-scrapers-kMVxSu_o/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/user/.local/share/virtualenvs/project-scrapers-kMVxSu_o/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/user/.local/share/virtualenvs/project-scrapers-kMVxSu_o/lib/python3.7/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: Chrome failed to start: crashed.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
If you suspect this is an IPython 7.13.0 bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
%config Application.verbose_crash=True
目前没有回答
相关问题 更多 >
编程相关推荐