Python and selenium web scraping error : OSError: [WinError 193] %1 is not a valid Win32 application

I got the next error in my python rutine: “OSError: [WinError 193] %1 is not a valid Win32 application”.

I have the chrome version installed: Versión 127.0.6533.89 (Build oficial) (64 bits)

This is my code:

def start_chrome(ruta_descarga):
    """Inicia Chrome con los parametros indicados y devuelve el Driver"""
    #Intalamos la version de ChromeDriver correspondiente
    ruta = ChromeDriverManager().install()
    #OPCIONES DE CHROME:
    options = Options() #instanciamos las opciones de chrome
    user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
    options.add_argument(f"user-agent={user_agent}") # define un user agent perzonalizado
    #options.add_argument("--windows-size=1000,1000") # para configurar un alto y ancho de la ventana
    options.add_argument("--start-maximized") #para maximar la ventana de Chrome (solo funciona si no se indica windows size)
    options.add_argument("--disable-web-security") #desahabilita la politica del mismo origen o Same Origine Policy
    options.add_argument("--disable-    ") # para que no cargue las extensiones de Chrome
    options.add_argument("--disable-notifications") # para bloquear notificaciones de Chrome 
    options.add_argument("--ignore-certificate-errors") # Para ignorar el aviso "Su conexion no es segura"
    options.add_argument("--no-sandbox") # deshabilita el modo sanbox, No se sabe para que sirve pero en tutoriales lo utilizan
    options.add_argument("--log-level=3") #para que Chromedriver no muestre nada en la terminal 
    options.add_argument("--allow-running-insecure-content") # desactiva el aviso de "contenido no seguro"
    options.add_argument("--no-default-browser-check") # Evita el aviso de Chrome no es navegador por defecto
    options.add_argument("--no-first-run") # evita le ejecucion de ciertas tareas que se realizan la primera vez que se ejecuta Chrome
    options.add_argument("--no-proxy-server") # para no usar el proxy, sino conexiones directas
    options.add_argument("--disable-blink-features=AutomationControlled") # evita que selenium sea detectados por sistemas anti bots
    options.add_argument("--user-data-dir=C:/Users/Probook/AppData/Local/Google/Chrome/User Data/Profile 1")
    #PARAMETROS A OMIITR EN EL INICIO DE CHROMEDRIVE
    exp_opt = [
        'enable-automation', #para que no muestre la notificacion de "Un software automatizado de pruebas está controlado Chrome"
        'ignore-certificate-errors', # para ignorar errores de cerficados (a veces estan caducados)
        'enable-logging' # para que no se muestre en la terminal "DevTools listening on..."
        ]
    options.add_experimental_option("excludeSwitches", exp_opt)

    #PARAMETROS QUE DEFINEN LAS PREFERENCIAS EN CHROMEDRIVER
    prefs = {
        "profile.default_content_setting_values.notifications" : 2, # notificaciones: 0=preguntar | 1:permitir | 2:no permitir
        "intl.accept_languages"                                : ["es-ES","es"], # para definir el idioma del navegador
        "credentials_enable_service"                           : False, # para evitar que Chrome pregunte si queremos guardar la contresaña al loguearnos
        "download.default_directory"                           : f"{ruta_descarga}"
        }
    options.add_experimental_option("prefs", prefs)
    #instancia el servicio de chromedriver
    s = Service(ruta) 
    #instanciamos webdriver de selenium con Chrome
    driver = webdriver.Chrome(service=s, options=options) #se añade el argmento OPTIONS
    #devolvemos el driver
    return driver

This is the error:

Traceback (most recent call last):
  File "G:Mi unidadDeclaracionesProgramasdescarga_exogena.py", line 596, in <module>
    desca_archivo_dian(ruta_proyecto,rango,year_consulta)
  File "G:Mi unidadDeclaracionesProgramasdescarga_exogena.py", line 455, in desca_archivo_dian
    driver = start_chrome(ruta_folder_name)
  File "G:Mi unidadDeclaracionesProgramasdescarga_exogena.py", line 429, in start_chrome
    driver = webdriver.Chrome(service=s, options=options) #se añade el argmento OPTIONS
  File "C:UsersProbookAppDataLocalProgramsPythonPython39libsite-packagesseleniumwebdriverchromewebdriver.py", line 45, in __init__
    super().__init__(
  File "C:UsersProbookAppDataLocalProgramsPythonPython39libsite-packagesseleniumwebdriverchromiumwebdriver.py", line 55, in __init__
    self.service.start()
  File "C:UsersProbookAppDataLocalProgramsPythonPython39libsite-packagesseleniumwebdrivercommonservice.py", line 98, in start   
    self._start_process(self._path)
  File "C:UsersProbookAppDataLocalProgramsPythonPython39libsite-packagesseleniumwebdrivercommonservice.py", line 208, in _start_process
    self.process = subprocess.Popen(
  File "C:UsersProbookAppDataLocalProgramsPythonPython39libsubprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:UsersProbookAppDataLocalProgramsPythonPython39libsubprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 no es una aplicación Win32 válida

I tried deleting the chromedriver in the folder in the path : “C:Usersmyuser.wdmdriverschromedriverwin64”. But it didn’t work.

Thanks for your help

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật