Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Ubuntu BrokenPipeError上的Selenium/Geckodriver_Python_Selenium Webdriver_Web Scraping - Fatal编程技术网

Python Ubuntu BrokenPipeError上的Selenium/Geckodriver

Python Ubuntu BrokenPipeError上的Selenium/Geckodriver,python,selenium-webdriver,web-scraping,Python,Selenium Webdriver,Web Scraping,我有一个web scraping Django应用程序,它使用Selenium python库和geckodriver收集数据。它使用代理。该应用程序在我本地的Windows机器上运行得非常好,但在Ubuntu服务器上,我遇到以下错误: .py", line 318, in execute response = self.command_executor.execute(driver_command, params) File "/usr/local/lib/python3.5/di

我有一个web scraping Django应用程序,它使用Selenium python库和geckodriver收集数据。它使用代理。该应用程序在我本地的Windows机器上运行得非常好,但在Ubuntu服务器上,我遇到以下错误:

.py", line 318, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/remote_connection.py", line 472, in execute
    return self._request(command_info[0], url, body=data)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/remote_connection.py", line 495, in _request
    self._conn.request(method, parsed_url.path, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 936, in _send_output
    self.send(message_body)
  File "/usr/lib/python3.5/http/client.py", line 908, in send
    self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe
selenium的配置如下所示:

PROXY_PORT = '3128'
PROXY_HOST = '178.128.186.103'
fp = webdriver.FirefoxProfile()

fp.set_preference("network.proxy.type", 1)
fp.set_preference("network.proxy.http", PROXY_HOST)
fp.set_preference("network.proxy.http_port", int(PROXY_PORT))
fp.set_preference("network.proxy.https", PROXY_HOST)
fp.set_preference("network.proxy.https_port", int(PROXY_PORT))
fp.set_preference("network.proxy.ssl", PROXY_HOST)
fp.set_preference("network.proxy.ssl_port", int(PROXY_PORT))
fp.set_preference("network.proxy.ftp", PROXY_HOST)
fp.set_preference("network.proxy.ftp_port", int(PROXY_PORT))
fp.set_preference("network.proxy.socks", PROXY_HOST)
fp.set_preference("network.proxy.socks_port", int(PROXY_PORT))
# fp.set_preference("general.useragent.override", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A")
fp.update_preferences()
gecko = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'geckodriver')
options = Options()
options.add_argument('--headless')

你能用Selenium、Python、GeckoDriver和Firefox版本信息更新这个问题吗?此外,我没有看到你调用
get()
或类似的东西,你如何接收
self.sock.sendall(数据)
?我错过什么了吗?