AgiMaulana / Instagram-Comments-Scraper

Instagram comment scraper using python and selenium. Save the comments into excel.
MIT License
140 stars 43 forks source link

Error when running script #5

Closed JuliBait closed 4 years ago

JuliBait commented 4 years ago

Hi, sorry if this is a noob question. I've just tried to run the code and I ended up with this error. (I've been reinstalling and manually specifying the path to chromedriver.exe all day and it still doesn't work! Help me out please?)

C:\Users\user1\Instagram-Comments-Scraper>python scraper.py https://www.instagram.com/p/BqUfulwH6O4/ 5 Traceback (most recent call last): File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\common\service.py", line 72, in start self.process = subprocess.Popen(cmd, env=self.env, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64qbz5n2kfra8p0\lib\subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64qbz5n2kfra8p0\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "scraper.py", line 5, in driver = webdriver.Chrome() File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init self.service.start() File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\common\service.py", line 81, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

AgiMaulana commented 4 years ago

Thank you for reporting this issue, as the last exception message you can try to include chrome driver executable to the PATH on your Windows user/system variable. You can follow this Add to The Path on Windows 10 after this maybe you need to restart your system, this is equivalent with moving the chrome driver to the bin directory on Ubuntu, so you can call the chrome driver from anywhere. To make sure you've successfully added the chrome driver to the PATH on your Windows, call the chrome driver from your terminal. I'll update the read me for Windows user soon.

ref: https://chromedriver.chromium.org/getting-started

AgiMaulana commented 4 years ago

Hi @JuliBait , I've updated the readme. The readme recommends to use a virtual environment, this should works also on Windows platform without changing the actual system behaviour.

AgiMaulana commented 4 years ago

Since this issue is not related to code. I'll close this issue. Thank you for the elaboration.