Search code examples
pythonseleniumgeckodriver

geckodriver path error - if i am using a batch file to start my python script


I want to execute my python script by a batch file. I have no problem if i execute my python script manually, but if i use a batch file to execute it then i get the "'geckodriver' executable needs to be in Path" error. In both ways I use the same interpreter.

My batch file:

C:\Users\murac\PycharmProjects\IP_Klima_Strom\venv\Scripts\python.exe C:\Users\murac\PycharmProjects\IP_Klima_Strom\main.py
pause

my error warning:

Traceback (most recent call last):
  File "C:\Users\murac\PycharmProjects\IP_Klima_Strom\main.py", line 166, in <module>
    driver = webdriver.Firefox(firefox_profile=browser_profile, options=opts)
  File "C:\Users\murac\PycharmProjects\IP_Klima_Strom\venv\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 164, in __init__
    self.service.start()
  File "C:\Users\murac\PycharmProjects\IP_Klima_Strom\venv\lib\site-packages\selenium\webdriver\common\service.py", line 83, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

My path Confi

I alreay updated my geckodriver and updated the path too, but nothing has changed. DO you have any idea to fix this?


Solution

  • i guess if you put you geckodriver in the same folder with script its gonna work