0

I am getting the following errors while trying all the solutions I could find on my own with no success like copying the whole selenium folder to main python folder, changing the path, using the absolute path etc, I would really appreciate the help as a newbie who just got started with python and selenium.

C:\Users\WorkStation\Desktop\chromedriver.exe 

Error : -

C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py File "C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py", line 3 driver = webdriver.Chrome("C:\Users\WorkStation\Desktop\chromedriver.exe") ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Process finished with exit code 1

Then I tried this and now more errors:

driver = webdriver.Chrome("C:\\Users\\WorkStation\\Desktop\\chromedriver.exe") 

Error : -

C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py Traceback (most recent call last): File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start stdout=self.log_file, stderr=self.log_file) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 665, in init errread, errwrite) = self._get_handles(stdin, stdout, stderr) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 910, in _get_handles c2pwrite = msvcrt.get_osfhandle(self._get_devnull()) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 770, in _get_devnull self._devnull = os.open(os.devnull, os.O_RDWR) FileNotFoundError: [Errno 2] No such file or directory: 'nul'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py", line 3, in driver = webdriver.Chrome("C:\Users\WorkStation\Desktop\chromedriver.exe") File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in init self.service.start() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH.

Exception ignored in: > Traceback (most recent call last): File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 173, in del self.stop() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 145, in stop if self.process is None: AttributeError: 'Service' object has no attribute 'process'

Process finished with exit code 1

Even after copying the selenium files from the site-packages folder to the main python folder and adding the absolute path is not working After doing the above step here is the error

C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py Traceback (most recent call last): File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", line 74, in start stdout=self.log_file, stderr=self.log_file) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 665, in init errread, errwrite) = self._get_handles(stdin, stdout, stderr) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 910, in _get_handles c2pwrite = msvcrt.get_osfhandle(self._get_devnull()) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 770, in _get_devnull self._devnull = os.open(os.devnull, os.O_RDWR) FileNotFoundError: [Errno 2] No such file or directory: 'nul'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py", line 3, in driver = webdriver.Chrome("C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\chrome\chromedriver.exe") File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\chrome\webdriver.py", line 62, in init self.service.start() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", line 81, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH.

Exception ignored in: > Traceback (most recent call last): File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", line 173, in del self.stop() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py", line 145, in stop if self.process is None: AttributeError: 'Service' object has no attribute 'process'

Process finished with exit code 1

Here is the screenshot of the issue in PyCharm

enter image description here

System Config:

windows 32-bit PyDispatcher 2.0.5 2.0.5 attrs 16.3.0 16.3.0 beautifulsoup4 4.5.3 4.5.3 cffi 1.9.1 1.9.1 constantly 15.1.0 15.1.0 cryptography 1.7.1 1.7.1 cssselect 1.0.0 1.0.0 idna 2.2 2.2 incremental 16.10.1 16.10.1 mechanize 0.2.5 0.2.5 pip 9.0.1 9.0.1 pyOpenSSL 16.2.0 16.2.0 pyasn1 0.1.9 0.1.9 pyasn1-modules 0.0.8 0.0.8 pycparser 2.17 2.17 requests 2.12.4 2.12.4 selenium 3.0.2 3.0.2 service-identity 16.0.0 setuptools 32.3.1 32.3.1 six 1.10.0 1.10.0 urllib3 1.19.1 1.19.1 wheel 0.29.0 0.30.0a0 zope.interface 4.3.3 4.3.3 Chrome webdriver Latest Version 2.27 Chrome browser Version Version 55.0.2883.87 m (Up to date) 
1

1 Answer 1

3

This SO Q&A might answer your question

I had this problem and I changed the backslash (\\) to forward slash (/).

try this:

driver = webdriver.Chrome('C:/Users/WorkStation/Desktop/chromedriver.exe') 
Sign up to request clarification or add additional context in comments.

1 Comment

Sure will try this out

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.