EchoLogic EchoLogic - 9 months ago 92
Python Question

How to run python script with Laravel's command fire method?

I have a need to execute a Python script from a Laravel Command, but I can't find any methods in

to complete my task.

I want to run this command via the console:

C:\Python34\python H:\myapp\app\python\

To do so, I tried the following in my commands

public function fire()
$this->call('C:\Python34\python H:\myapp\app\python\');

public function fire()
$this->line('C:\Python34\python H:\myapp\app\python\');

None of them work, as Laravel is expecting me to be calling another Laravel command from them. What is the best way to call a simple python script via a Laravel Command?


try PHP exec function:

exec('C:\Python34\python H:\myapp\app\python\');