So I'm trying to use the Symfony process to call a Python script from a controller in my Laravel project.
$process = new Process(['python',
'C:\projects\laravel_project\src\public\car_tuner.py', $args]);
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
$result = $process->getOutput();
Log::info($result);
This is the error i am getting:
"The command "'python' 'C:\projects\laravel_project\src\public\car_tuner.py'" failed.\n\nExit Code: 127(Command not found)\n\nWorking directory: /var/www/html/public\n\nOutput:\n================\n\n\nError Output:\n================\nsh: exec: line 1: python: not found\n" trace: [{file: "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php", line: 54,…},…]
Python 3.10 is installed, and running this command in the command prompt works correctly. I've also tried using the PHP shell_exec() function with no success also. Any help is appreciated.