Service ./selenium/geckodriver/mac64/0.34.0/geckodriver unexpectedly exited. Status code was: 64

15 Views Asked by At

I program a python script with selenium, I launch my script from a php website, when I launch it from my PC locally I manage to launch geckodriver, but when I am on my xampp server, I get this message:

error: Service ./selenium/geckodriver/mac64/0.34.0/geckodriver unexpectedly exited. Status code was: 64

I put python in my server as well as selenium so that all the paths are relative but that doesn't change anything, here is my python script:

from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from selenium.common.exceptions import WebDriverException

geckodriver_path = "./selenium/geckodriver/mac64/0.34.0/geckodriver"

firefox_binary_path = "./selenium/firefox/mac64/123.0.1/Firefox.app/Contents/MacOS/firefox"

service = Service(executable_path=geckodriver_path)
options = webdriver.FirefoxOptions()
options.binary_location = firefox_binary_path

try:
    driver = webdriver.Firefox(service=service, options=options)
    print("Firefox browser started successfully!")

    driver.get("https://www.example.com")

except WebDriverException as e:
    print("An error occurred while starting the Firefox browser: ", e)

and here is my php code:

<?php
// set read access to all files

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// $username = 'noabacle';
// $command = ' /Library/Frameworks/Python.framework/Versions/3.12/bin/python3 /Users/noabacle/Desktop/main2.py 2>&1';
// $command = ' /Library/Frameworks/Python.framework/Versions/3.12/bin/python3 ./web/test.py 2>&1';
$command = ' ./Python.framework/Versions/3.12/bin/python3 ./web/test.py 2>&1';
$output = shell_exec($command);
echo "<pre>$output</pre>";
}
?>

I don't know what to do anymore knowing that it's not a version problem, it works when I'm local.

I tried to update the versions, to put the files in relative, to set the rights to all the users but nothing worked...

0

There are 0 best solutions below