The problem is that Chrome is not in the same directory or path with all of the users
so I tried to make this code, and it is a small part of yours because you did not provide some additional files like "messages.pkl"
I have deleted this line :
options.add_argument(r"--user-data-dir=C:\Users\Urano\AppData\Local\Google\Chrome\User Data")
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
def run():
options = webdriver.ChromeOptions()
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--profile-directory=Default")
service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service, options=options)
print("Abriendo WhatsApp Web...")
driver.get("https://web.whatsapp.com")
input("Escaneá el código QR y presioná ENTER cuando WhatsApp Web esté cargado...\n")
driver.quit()
print("\n✅ Todos los mensajes procesados.")
if __name__ == "__main__":
run()
then converted it into exe file using this command:
pyinstaller --noconfirm --onefile --console "your_file.py" --workpath "Final_exe_file/build" --distpath "Final_exe_file/exe"