HENNGE / arsenic

Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Other
349 stars 52 forks source link

AttributeError: 'str' object has no attribute 'fileno' #150

Closed Utkarsh-TG closed 2 years ago

Utkarsh-TG commented 2 years ago

I m new to arsenic and am getting this error i guess on this line async with get_session(Chromedriver("./chromedriver.exe"), Chrome()) as session:

Traceback (most recent call last): File "d:\Coding\WebScraping\StockAnalyzer\run.py", line 21, in test = asyncio.get_event_loop().run_until_complete( File "C:\Users\utkar\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete return future.result() File "d:\Coding\WebScraping\StockAnalyzer\stocks_scraper.py", line 107, in scrape_stock_details results = await asyncio.gather(*tasks) File "d:\Coding\WebScraping\StockAnalyzer\stocks_scraper.py", line 70, in request_stock_details async with get_session(Chromedriver("./chromedriver.exe"), Chrome()) as session: File "D:\Coding\WebScraping\StockAnalyzer\env\lib\site-packages\arsenic__init.py", line 16, in aenter__ self.session = await start_session(self.service, self.browser, self.bind) File "D:\Coding\WebScraping\StockAnalyzer\env\lib\site-packages\arsenic__init.py", line 28, in start_session driver = await service.start() File "D:\Coding\WebScraping\StockAnalyzer\env\lib\site-packages\arsenic\services.py", line 122, in start return await subprocess_based_service( File "D:\Coding\WebScraping\StockAnalyzer\env\lib\site-packages\arsenic\services.py", line 39, in subprocess_based_service process = await impl.start_process(cmd, log_file) File "D:\Coding\WebScraping\StockAnalyzer\env\lib\site-packages\arsenic\subprocess.py", line 56, in start_process return await asyncio.create_subprocess_exec( File "C:\Users\utkar\AppData\Local\Programs\Python\Python39\lib\asyncio\subprocess.py", line 236, in create_subprocess_exec transport, protocol = await loop.subprocess_exec( File "C:\Users\utkar\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1661, in subprocess_exec transport = await self._make_subprocess_transport( File "C:\Users\utkar\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 389, in _make_subprocess_transport transp = _WindowsSubprocessTransport(self, protocol, args, shell, File "C:\Users\utkar\AppData\Local\Programs\Python\Python39\lib\asyncio\base_subprocess.py", line 36, in init self._start(args=args, shell=shell, stdin=stdin, stdout=stdout, File "C:\Users\utkar\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 885, in _start self._proc = windows_utils.Popen( File "C:\Users\utkar\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_utils.py", line 153, in init super().init(args, stdin=stdin_rfd, stdout=stdout_wfd, File "C:\Users\utkar\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 829, in init__ errread, errwrite) = self._get_handles(stdin, stdout, stderr) File "C:\Users\utkar\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1284, in _get_handles c2pwrite = msvcrt.get_osfhandle(stdout.fileno()) AttributeError: 'str' object has no attribute 'fileno'

Utkarsh-TG commented 2 years ago

had to add binary

async with get_session(Chromedriver(binary="./chromedriver.exe"), Chrome()) as session: