I am new to programing, did some python courses and am trying to apply what I've been learning.
I am running a macOS Sierra and have python2 and 3 installed in my machine, even though I just wanted to use the python3, but my previous course had instructed me to start with python2, which I don't know if it was a bad thing.
Anyway, taking the Automate the Boring Stuff with Python course (which uses python3) I ran into this code:
#! python3
from selenium import webdriver
browser = webdriver.Firefox()
and got the following error message:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/Alex/Anaconda/Templates/selenium_firefox.py", line 3, in <module>
browser = webdriver.Firefox()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__
self.service.start()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/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 ignored in: <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x1029777f0>>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 163, in __del__
self.stop()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 135, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
[Finished in 0.501s]
I found an answer that seems to solve my problem here: Selenium using Python - Geckodriver executable needs to be in PATH
But I can't quite understand how to manipulate PATHs in my computer or how to organize my files in a way that the computer works.
I executed the following code on my terminal (as instructed in the other query): exportPATH=$PATH:/path/to/directory/of/executable/downloaded/in/previous/step
But it does not make any sense to me nor did it work. I also tried taking the Geckodriver file from the downloads (where it was originally) and placing it inside my Anaconda folder.
Anyway, I am quite sure the problem is that I don't really know how the computer organize itself, thus cannot properly address the code.
Therefore, I would like to ask a solution for my specific case and a reference text, tutorial, video or anything alike that I could use to better understand how all this works (I still didn't find any good material on that matter).
Thanks in advance!