Instapy(路径)中的Selenium错误,同时设置了所有内容

时间:2018-03-30 23:07:05

标签: python selenium

我刚刚下载了Instapy并且我决定尝试一下,但是我得到了关于Selenium的错误,而我有多个selenium路径,甚至是这里的路径:instabot \ assets \ chromedriver,但我仍然得到这个错误。你们有什么想法可以解决问题吗?那个PermissionsError怎么样? (我一直在寻找但却无法找到它)

顺便说一句,我是以管理员身份运行CMD所以问题不存在,我没有管理员权限

ERROR [2018-03-31 01:01:06] [XXXXXXXXX]  Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Traceback (most recent call last):
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
    stdin=PIPE)
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
PermissionError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\StyleZ\PycharmProjects\instabot\instapy\instapy.py", line 256, in set_selenium_local_session
    chrome_options=chrome_options)
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 68, in __init__
    self.service.start()
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 88, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Traceback (most recent call last):
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
    stdin=PIPE)
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
PermissionError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\StyleZ\PycharmProjects\instabot\instapy\instapy.py", line 256, in set_selenium_local_session
    chrome_options=chrome_options)
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 68, in __init__
    self.service.start()
  File "C:\Users\StyleZ\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 88, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "quickstart.py", line 22, in <module>
    multi_logs=True)
  File "C:\Users\StyleZ\PycharmProjects\instabot\instapy\instapy.py", line 152, in __init__
    self.set_selenium_local_session()
  File "C:\Users\StyleZ\PycharmProjects\instabot\instapy\instapy.py", line 260, in set_selenium_local_session
    Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at C:\Users\StyleZ\PycharmProjects\instabot\assets\chromedriver

1 个答案:

答案 0 :(得分:0)

嘿伙计:)我修好了:)因为我有一个窗户我必须使用绝对路径,所以而不是:

chromedriver_location = os.path.join(BASE_DIR, 'assets', 'chromedriver')

我不得不使用:

chromedriver_location = os.path.join("C:/webdrivers/chromedriver.exe")