currently im working on project that require me to use python and laravel .I've searched a lot in the internet and apparently the solution to call python function is to use symphony. Im pretty sure that i already tried everything and somehow it doesn't work
Controller
--first try (Using Symfony):
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
class AdminController extends Controller
{
function PythonRun()
{
$process = new Process(['/usr/bin/python3', 'test.py']);
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
$data = $process->getOutput();
dd($data);
}
}
-- Second try (Using Exec):
class AdminController extends Controller
{
function PythonRun()
{
exec("/usr/bin/python3 /python/test.py");
}
}
Both of them return " The system cannot find speciefied path". i already tried to put the python in the app folder and in the public folder. both doesnt work.