Fórum Erro no visual studio code ao Rodar projeto Python #620308
27/07/2023
0
Olá, estou tentando executar um projeto, e o meu Visual Studio Code, alguém pode me ajudar?
está apresentando a seguinte mensagem:
está apresentando a seguinte mensagem:
1 2 3 4 5 6 7 8 9 10 11 | from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.firefox.options import Options url = "https://pt.aliexpress.com/w/wholesale-rel%C3%B3gio-masculino.html?catId=0&initiative_id=AS_20230727091506&SearchText=rel%C3%B3gio+masculino&spm=a2g0o.home.1000002.0" option = Options() option.headless = False driver = webdriver.Firefox(options = option) driver.get(url) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | PS C:\Python\ScrapingAliexpress> & C: / Users / User / AppData / Local / Programs / Python / Python311 / python.exe c: / Python / ScrapingAliexpress / scraping_aliexpress.py c:\Python\ScrapingAliexpress\scraping_aliexpress.py: 8 : DeprecationWarning: headless property is deprecated, instead use add_argument(' '-headless' ') option.headless = False Traceback (most recent call last): File "c:\Python\ScrapingAliexpress\scraping_aliexpress.py" , line 9 , in <module> driver = webdriver.Firefox(options = option) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\firefox\webdriver.py" , line 61 , in __init__ self .service.start() File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\common\service.py" , line 93 , in start self ._start_process( self ._path) File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\common\service.py" , line 194 , in _start_process self .process = subprocess.Popen( ^^^^^^^^^^^^^^^^^ File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\subprocess.py" , line 1026 , in __init__ self ._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\subprocess.py" , line 1538 , in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [WinError 216 ] Esta versão de % 1 não é compatível com a versão do Windows sendo executada. Verifique as informações de sistema do computador e contate o fornecedor do software PS C:\Python\ScrapingAliexpress> |

Henrique Marinho
Curtir tópico
+ 0
Responder
Posts
07/12/2023
Leticia Lima
Oii Tudo bem ?
Verifica se está instalado os pacotes no seu venv.
1 | pip install beautifulsoup4 selenium |
propriedade headless está obsoleta. Para corrigir isso, você pode usar add_argument('--headless') ao configurar as opções do Firefox.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.firefox.options import Options url = "https://pt.aliexpress.com/w/wholesale-rel%C3%B3gio-masculino.html?catId=0&initiative_id=AS_20230727091506&SearchText=rel%C3%B3gio+masculino&spm=a2g0o.home.1000002.0" options = Options() options.add_argument( '--headless' ) # Use essa linha para executar sem abrir a interface gráfica do navegador # Certifique-se de ter a versão correta do geckodriver para o seu Firefox instalado no PATH # Você pode baixar o geckodriver em https://github.com/mozilla/geckodriver/releases # Extraia o arquivo e adicione o local ao PATH ou forneça o caminho completo abaixo driver = webdriver.Firefox(options = options, executable_path = r 'C:\\caminho\\para\\geckodriver.exe' ) driver.get(url) |
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)