1

I am executing a simple python -v from:

$process = new Process(['python -v']);
$process->run();

try {
      if (!$process->isSuccessful()) 
      {
        throw new ProcessFailedException($process);
      }
     }
      catch (\Exception $e) {
            $this->logger->error($e->getMessage());
     }

but I get the exception:

The command "'python -v'" failed.  Exit Code: 127(Command not found)  Working directory: /var/www/symfony/symfony/public  Output: ================   Error Output: ================ sh: 1: exec: python -v: not found

If I run the same command from the shell all works fine.

1 Answer 1

2

Change

$process = new Process(['phyton -v']);

to

$process = new Process(['phyton',  '-v']);

Ref. https://symfony.com/doc/current/components/process.html#usage

Sign up to request clarification or add additional context in comments.

1 Comment

Did you mean python instead of phyton?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.