导航:首页 > 编程语言 > python代理打不开网页

python代理打不开网页

发布时间:2024-05-13 16:56:58

python 制作网页打不开 直接跳到打开或者保存文件

需要对Lighttpd进行配置,指明py文件是作为cgi程序运行的。
修改配置文件:/etc/lighttpd/lighttpd.conf
在以下小节内添加python内容:
server.moles = ( "mod_cgi", )
cgi.assign = (
".py" => "/usr/bin/python"
)

Ⅱ python鍙浠ョ敤镊锷ㄥ寲镓扑笉寮娴忚埚櫒

闇瑕佷笅杞藉畨瑁単eckodriver, 铹跺悗灏嗗叾锷犲叆鐜澧冨彉閲.
Zidon鍒板崥瀹㈢粰浣犳惉杩囨潵浜

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
version: selenium==3.0.1
姝ょ増链镓ц岄渶瑕侀┍锷锛欢eckodriver
鍙浠ュ幓缃戝潃https://github.com/mozilla/geckodriver/releases 杩欓噷涓嬭浇链鏂扮殑鐗堟湰銆
铹跺悗灏嗘枃浠跺す瑙e帇鍒癈:\geckodriver澶勶纴鍐嶅炲姞鍦ㄧ数鑴戣剧疆鐜澧冨彉閲忥纴濡备笅锲炬墍绀

铹跺悗鍦ㄥ垱寤篎irefox镄勬椂鍊栾剧疆镓ц岃矾寰
browser = webdriver.Firefox(executable_path = 'C:\geckodriver\geckodriver.exe')
Traceback (most recent call last): File "C:\learnplace\python_webdevelop_testdriver\functional_tests.py", line 10, in <mole>
browser = webdriver.Firefox() File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__ self.service.start() File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x00000000030E7CF8>> ignored

涓嶈繃姝ゆ椂浼氩嚭鐜板彟澶栦竴涓寮傚父锛
Traceback (most recent call last): File "C:\learnplace\python_webdevelop_testdriver\functional_tests.py", line 10, in <mole>
browser = webdriver.Firefox(executable_path = 'C:\geckodriver\geckodriver.exe') File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 145, in __init__
keep_alive=True) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__ self.start_session(desired_capabilities, browser_profile) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

闇瑕佸皢binary镄勬祻瑙埚櫒璺寰勬坊锷犱互涓
from selenium import webdriverfrom selenium.webdriver.firefox.firefox_binary import FirefoxBinary# browser = webdriver.Firefox(# firefox_binary='C:\Program Files (x86)\Mozilla Firefox')# browser.get('http://localhost:8000')# assert 'Django' in browser.titlebinary = FirefoxBinary(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe')
browser = webdriver.Firefox(firefox_binary=binary)
browser.get('http://localhost:8000')

涓嶈繃鍙埚嚭鐜颁互涓嫔纾甯搞伞伞
Traceback (most recent call last): File "C:\learnplace\python_webdevelop_testdriver\functional_tests.py", line 18, in <mole>
browser = webdriver.Firefox(firefox_binary=binary) File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 145, in __init__
keep_alive=True) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__ self.start_session(desired_capabilities, browser_profile) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unsupported Marionette protocol version 2, required 3

浠ヤ笂闂棰桦彧瑕佹洿鏂癴irefox鍒47鐗堟湰灏卞彲浠ヤ简銆傜粓浜庤В鍐充简銆伞
浣跨敤PhantomJS 镞犲ご娴忚埚櫒
self.browser = webdriver.PhantomJS(executable_path=r'C:\phantomjs\bin\phantomjs.exe')

Ⅲ python爬虫怎么处理豆瓣网页异常请求

1.URLError

首先解释下URLError可能产生的原因:

阅读全文

与python代理打不开网页相关的资料

热点内容
mac电脑怎么打开终端命令 浏览:741
androidvpn待机不断 浏览:756
硬盘的文件夹如何设置密码 浏览:384
plc定位编程 浏览:47
mac命令添加用户 浏览:815
android时间widget 浏览:393
qd128h压缩机参数 浏览:287
用单片机测车距 浏览:394
去哪里找加密的便签 浏览:19
武汉订酒店旅馆哪个app平台好 浏览:114
c语言在线编译器字节流 浏览:317
带队伍pdf 浏览:951
电脑如何形成服务器 浏览:522
javaprint换行 浏览:785
华为手机压缩文件夹怎么操作 浏览:99
c语言垃圾堆这个文件夹可以删吗 浏览:758
websocketssl加密 浏览:924
系统类算法 浏览:657
ai算法血检t细胞衰老 浏览:473
如何查看文件夹是否安装过程 浏览:195