'OSError: [WinError 193] %1 is not a valid Win32 application webdriver.Chrome

I cloned the following git https://github.com/NLPatVCU/PaperScraper and ran the setup file. After running from paperscraper import PaperScraperin VS Code I tried to instantiate a PaperScraper class but the error below merged. What can I do?


OSError                                   Traceback (most recent call last)
d:\ML\PS_scrapping.ipynb Cell 3' in <cell line: 1>()
----> 1 PaperScraper()

File c:\Users\USER\anaconda3\envs\ML\lib\site-packages\paperscraper-0.2-py3.10.egg\paperscraper\PaperScraper.py:45, in PaperScraper.__init__(self, webdriver_path)
     42 if ('webdriver_path' is not None):
     43     self.webdriver_path = webdriver_path
---> 45 self.driver = webdriver.Chrome(webdriver_path, options=options)

File c:\Users\USER\anaconda3\envs\ML\lib\site-packages\selenium\webdriver\chrome\webdriver.py:70, in WebDriver.__init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, service, keep_alive)
     67 if not service:
     68     service = Service(executable_path, port, service_args, service_log_path)
---> 70 super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
     71                                 port, options,
     72                                 service_args, desired_capabilities,
     73                                 service_log_path, service, keep_alive)

File c:\Users\USER\anaconda3\envs\ML\lib\site-packages\selenium\webdriver\chromium\webdriver.py:89, in ChromiumDriver.__init__(self, browser_name, vendor_prefix, port, options, service_args, desired_capabilities, service_log_path, service, keep_alive)
     86     raise AttributeError('service cannot be None')
     88 self.service = service
---> 89 self.service.start()
     91 try:
     92     RemoteWebDriver.__init__(
     93         self,
     94         command_executor=ChromiumRemoteConnection(
   (...)
     97             keep_alive=keep_alive, ignore_proxy=_ignore_proxy),
     98         options=options)

File c:\Users\USER\anaconda3\envs\ML\lib\site-packages\selenium\webdriver\common\service.py:71, in Service.start(self)
     69     cmd = [self.path]
     70     cmd.extend(self.command_line_args())
---> 71     self.process = subprocess.Popen(cmd, env=self.env,
     72                                     close_fds=system() != 'Windows',
     73                                     stdout=self.log_file,
     74                                     stderr=self.log_file,
     75                                     stdin=PIPE,
     76                                     creationflags=self.creationflags)
     77 except TypeError:
     78     raise

File c:\Users\USER\anaconda3\envs\ML\lib\subprocess.py:966, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize)
    962         if self.text_mode:
    963             self.stderr = io.TextIOWrapper(self.stderr,
    964                     encoding=encoding, errors=errors)
--> 966     self._execute_child(args, executable, preexec_fn, close_fds,
    967                         pass_fds, cwd, env,
    968                         startupinfo, creationflags, shell,
    969                         p2cread, p2cwrite,
    970                         c2pread, c2pwrite,
    971                         errread, errwrite,
    972                         restore_signals,
    973                         gid, gids, uid, umask,
    974                         start_new_session)
    975 except:
    976     # Cleanup if the child failed starting.
    977     for f in filter(None, (self.stdin, self.stdout, self.stderr)):

File c:\Users\USER\anaconda3\envs\ML\lib\subprocess.py:1435, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
   1433 # Start the process
   1434 try:
-> 1435     hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
   1436                              # no special security
   1437                              None, None,
   1438                              int(not close_fds),
   1439                              creationflags,
   1440                              env,
   1441                              cwd,
   1442                              startupinfo)
   1443 finally:
   1444     # Child is launched. Close the parent's copy of those pipe
   1445     # handles that only the child should have open.  You need
   (...)
   1448     # pipe will not close when the child process exits and the
   1449     # ReadFile will hang.
   1450     self._close_pipe_fds(p2cread, p2cwrite,
   1451                          c2pread, c2pwrite,
   1452                          errread, errwrite)
OSError: [WinError 193] %1 is not a valid Win32 application

I downloaded chromedriver and swapped the files in the folders of the package, but it did not work



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source