I'm trying to run python script via laravel using symfony process but when i run it I get this error: 'Python' is not recognized as an internal or external command, operable program or batch file. I tried to run the python script with cmd and it run and return the result
my laravel code is this:
`
$text="I luv my <3 iphone & you're awsm apple. DisplayIsAwesome, sooo happppppy http://www.apple.com";
$process=new Process("Python C:\Users\Bcc\PycharmProjects\twitter-data\Car.py \"{$text}\"");
$process->run();
if (!$process->isSuccessful()){
throw new ProcessFailedException($process);
}
var_dump($process->getOutput());
die();
` I run this command on cmd: Python C:\Users\Bcc\PycharmProjects\twitter-data\Car.py "I luv my <3 iphone & you're awsm apple. DisplayIsAwesome, sooo happppppy http://www.apple.com"
EDIT: Problem Solved.I move python script to controllers folder and use shell_exec ,so just replace that code with this
$text="I luv my <3 iphone & you're awsm apple. DisplayIsAwesome, sooo happppppy http://www.apple.com";
$result = shell_exec("python ". app_path()."\Http\Controllers\Car.py " . escapeshellarg($text));
var_dump($result);
die();