Arsenic with chromedriver on ubuntu: FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver'

倾然丶 夕夏残阳落幕 提交于 2021-01-29 09:55:12

问题


FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver' I am using docker to build my app on ubuntu server.

Dockerfile:

FROM python:latest

WORKDIR /src
COPY requirements.txt /src
RUN pip install -r requirements.txt
COPY . /src

docker-compose.yml :

version: '3.1'

services:

  tgbot:
    container_name: bot
    build:
      context: .
    command: python app.py
    restart: always
    environment:
      WEBAPP_PORT: 3001
    env_file:
      - ".env"
    ports:
      - 8443:3001
    networks:
      - botnet
    volumes:
      - ./:/src

    chrome:
        image: selenium/standalone-chrome:latest
        hostname: chrome
        networks:
            - botnet
        privileged: true

networks:
      botnet:
        driver: bridge

requirements.txt include arsenic~=20.9

My python code with arsenic that works on my windows PC (i have chrome installed, +chromedriver file in app folder):

from arsenic import get_session, keys, browsers, services
async def arsenic_scraper(url):
    service = services.Chromedriver()
    browser = browsers.Chrome()
    async with get_session(service, browser) as session:
        await session.get(url)

来源:https://stackoverflow.com/questions/65196914/arsenic-with-chromedriver-on-ubuntu-filenotfounderror-errno-2-no-such-file-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!